batch commit
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CryptNote")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CryptNote")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("74d8c056-dd54-4548-85f1-e0fc7dd16b7a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
63
CryptNote - Very First Project/Journal/Properties/Resources.Designer.cs
generated
Normal file
63
CryptNote - Very First Project/Journal/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Journal.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Journal.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
CryptNote - Very First Project/Journal/Properties/Resources.resx
Normal file
117
CryptNote - Very First Project/Journal/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
74
CryptNote - Very First Project/Journal/Properties/Settings.Designer.cs
generated
Normal file
74
CryptNote - Very First Project/Journal/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Journal.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Admin")]
|
||||
public string Username {
|
||||
get {
|
||||
return ((string)(this["Username"]));
|
||||
}
|
||||
set {
|
||||
this["Username"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string Password {
|
||||
get {
|
||||
return ((string)(this["Password"]));
|
||||
}
|
||||
set {
|
||||
this["Password"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Entery.txt")]
|
||||
public string SourceFile {
|
||||
get {
|
||||
return ((string)(this["SourceFile"]));
|
||||
}
|
||||
set {
|
||||
this["SourceFile"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("42")]
|
||||
public string IV_per {
|
||||
get {
|
||||
return ((string)(this["IV_per"]));
|
||||
}
|
||||
set {
|
||||
this["IV_per"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Journal.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Username" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Admin</Value>
|
||||
</Setting>
|
||||
<Setting Name="Password" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="SourceFile" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Entery.txt</Value>
|
||||
</Setting>
|
||||
<Setting Name="IV_per" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">42</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
Binary file not shown.
After Width: | Height: | Size: 247 B |
BIN
CryptNote - Very First Project/Journal/RegistrationScriptRGS.ico
Normal file
BIN
CryptNote - Very First Project/Journal/RegistrationScriptRGS.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
279
CryptNote - Very First Project/Journal/Save_Open _File.cs
Normal file
279
CryptNote - Very First Project/Journal/Save_Open _File.cs
Normal file
@ -0,0 +1,279 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static Journal.Form1;
|
||||
|
||||
namespace Journal
|
||||
{
|
||||
class Save_Open__File
|
||||
{
|
||||
List<DataVariable> DataVar;
|
||||
private string Source;
|
||||
byte[] Encryptedbytes;
|
||||
// List<string> FileSources = new List<string>();
|
||||
_32bitEncryption _32bit = new _32bitEncryption();
|
||||
|
||||
public Save_Open__File(List<DataVariable> _DataVar, string _Source)
|
||||
{
|
||||
DataVar = _DataVar;
|
||||
Source = _Source;
|
||||
}
|
||||
public void SetEncryptedBytes(byte[] _Encrypt)
|
||||
{
|
||||
Encryptedbytes = _Encrypt;
|
||||
}
|
||||
public string Encrypt(string _tmp)
|
||||
{
|
||||
string EncrptText = "";
|
||||
byte[] Key;
|
||||
Key = _32bit.GetBytes(Properties.Settings.Default.Password);
|
||||
byte[] bytetostring;
|
||||
byte[] IV = _32bit.GetBytes("12700779");
|
||||
bytetostring = _32bit.encrypt_function(_tmp, Key, IV);
|
||||
EncrptText = Convert.ToBase64String(bytetostring);
|
||||
Encryptedbytes = bytetostring;
|
||||
//Debug.WriteLine("Encrpting Tab index: " + FileTabs.SelectedIndex.ToString() + " Name: " + Tabs[FileTabs.SelectedIndex].Name);
|
||||
return EncrptText;
|
||||
}
|
||||
|
||||
public string Decrypt(string _tmp)
|
||||
{
|
||||
string DecryptText = "";
|
||||
byte[] Key;
|
||||
Key = _32bit.GetBytes(Properties.Settings.Default.Password);
|
||||
BinaryRW Read = new BinaryRW();
|
||||
byte[] bytetostring;
|
||||
byte[] IV = _32bit.GetBytes("12700779");
|
||||
bytetostring = Convert.FromBase64String(_tmp);
|
||||
DecryptText = _32bit.decrypt_function(bytetostring, Key, IV);
|
||||
//Debug.WriteLine("Decrypting Tab index: " + FileTabs.SelectedIndex.ToString() + " Name: " + Tabs[FileTabs.SelectedIndex].Name);
|
||||
return DecryptText;
|
||||
}
|
||||
public void SaveFile(TabControl FileTabs, List<DataVariable> DataVar)
|
||||
{
|
||||
|
||||
string RTBText = "";
|
||||
|
||||
string FileName = FileTabs.SelectedTab.Text;
|
||||
if (FileName.Contains("NewPage"))
|
||||
{
|
||||
FileName = "";
|
||||
Stream myStream;
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
int FileNameL = 0;
|
||||
saveFileDialog1.Filter = "txt files (*.txt)|*.txt";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if ((myStream = saveFileDialog1.OpenFile()) != null)
|
||||
{
|
||||
// Code to write the stream goes here.
|
||||
string change;
|
||||
change = saveFileDialog1.FileName;
|
||||
for (int loop = 0; loop < change.Length; loop++)
|
||||
{
|
||||
if (change[loop] == '\\')
|
||||
{
|
||||
FileNameL = 0;
|
||||
}
|
||||
else
|
||||
FileNameL++;
|
||||
}
|
||||
for (int loop = change.Length - FileNameL; loop < change.Length; loop++)
|
||||
{
|
||||
FileName += change[loop];
|
||||
}
|
||||
FileTabs.SelectedTab.Text = FileName;
|
||||
FileName = change;
|
||||
myStream.Close();
|
||||
//DataVar[FileTabs.SelectedIndex].FileSources = change;
|
||||
DataVariable DatavarTemp = new DataVariable();
|
||||
DatavarTemp.Tabs = DataVar[FileTabs.SelectedIndex].Tabs;
|
||||
DatavarTemp.Encrypted = DataVar[FileTabs.SelectedIndex].Encrypted;
|
||||
DatavarTemp.FileSources = change;
|
||||
DataVar[FileTabs.SelectedIndex] = DatavarTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DataVar[FileTabs.SelectedIndex].Encrypted)
|
||||
RTBText = Encrypt(DataVar[FileTabs.SelectedIndex].Tabs.Rtf);
|
||||
BinaryRW write = new BinaryRW();
|
||||
write.writeBytes(Encryptedbytes, DataVar[FileTabs.SelectedIndex].FileSources);
|
||||
// Debug.WriteLine("Save Passed " + FileName);
|
||||
|
||||
}
|
||||
public void SaveAllFile(TabControl FileTabs, List<DataVariable> DataVar, int NumberPages)
|
||||
{
|
||||
for (int mainloop = 0; mainloop < NumberPages; mainloop++)
|
||||
{
|
||||
string SaveText = "";
|
||||
|
||||
FileTabs.SelectTab(mainloop);
|
||||
string FileName = FileTabs.SelectedTab.Text;
|
||||
if (FileName.Contains("NewPage"))
|
||||
{
|
||||
FileName = "";
|
||||
Stream myStream;
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
int FileNameL = 0;
|
||||
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if ((myStream = saveFileDialog1.OpenFile()) != null)
|
||||
{
|
||||
// Code to write the stream goes here.
|
||||
string change;
|
||||
change = saveFileDialog1.FileName;
|
||||
for (int loop = 0; loop < change.Length; loop++)
|
||||
{
|
||||
if (change[loop] == '\\')
|
||||
{
|
||||
FileNameL = 0;
|
||||
}
|
||||
else
|
||||
FileNameL++;
|
||||
}
|
||||
for (int loop = change.Length - FileNameL; loop < change.Length; loop++)
|
||||
{
|
||||
FileName += change[loop];
|
||||
}
|
||||
FileTabs.SelectedTab.Text = FileName;
|
||||
FileName = change;
|
||||
myStream.Close();
|
||||
DataVariable DatavarTemp = new DataVariable();
|
||||
DatavarTemp.Tabs = DataVar[mainloop].Tabs;
|
||||
DatavarTemp.Encrypted = DataVar[mainloop].Encrypted;
|
||||
DatavarTemp.FileSources = change;
|
||||
DataVar[mainloop] = DatavarTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DataVar[FileTabs.SelectedIndex].Encrypted)
|
||||
SaveText = Encrypt(DataVar[mainloop].Tabs.Rtf);
|
||||
BinaryRW write = new BinaryRW();
|
||||
write.writeBytes(Encryptedbytes, DataVar[mainloop].FileSources);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveAs(TabControl FileTabs, List<DataVariable> DataVar)
|
||||
{
|
||||
string SaveAsText = "";
|
||||
string FileName = "";
|
||||
Stream myStream;
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
int FileNameL = 0;
|
||||
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if ((myStream = saveFileDialog1.OpenFile()) != null)
|
||||
{
|
||||
// Code to write the stream goes here.
|
||||
string change;
|
||||
change = saveFileDialog1.FileName;
|
||||
for (int loop = 0; loop < change.Length; loop++)
|
||||
{
|
||||
if (change[loop] == '\\')
|
||||
FileNameL = 0;
|
||||
else
|
||||
FileNameL++;
|
||||
}
|
||||
for (int loop = change.Length - FileNameL; loop < change.Length; loop++)
|
||||
{
|
||||
FileName += change[loop];
|
||||
}
|
||||
FileTabs.SelectedTab.Text = FileName;
|
||||
FileName = change;
|
||||
myStream.Close();
|
||||
// FileSources[FileTabs.SelectedIndex] = change;
|
||||
DataVariable DatavarTemp = new DataVariable();
|
||||
DatavarTemp.Tabs = DataVar[FileTabs.SelectedIndex].Tabs;
|
||||
DatavarTemp.Encrypted = DataVar[FileTabs.SelectedIndex].Encrypted; ;
|
||||
DatavarTemp.FileSources = change;
|
||||
DataVar[FileTabs.SelectedIndex] = DatavarTemp;
|
||||
}
|
||||
}
|
||||
if (!DataVar[FileTabs.SelectedIndex].Encrypted)
|
||||
SaveAsText = Encrypt(DataVar[FileTabs.SelectedIndex].Tabs.Rtf);
|
||||
BinaryRW write = new BinaryRW();
|
||||
write.writeBytes(Encryptedbytes, FileName);
|
||||
}
|
||||
public string[] OpenFile()
|
||||
{
|
||||
string[] ArgVal = new string[3];
|
||||
OpenSource dlg = new OpenSource();
|
||||
string FileName = "";
|
||||
int FileNameL = 0;
|
||||
Stream myStream = null;
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
openFileDialog1.InitialDirectory = "c:\\";
|
||||
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
|
||||
openFileDialog1.FilterIndex = 2;
|
||||
openFileDialog1.RestoreDirectory = true;
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((myStream = openFileDialog1.OpenFile()) != null)
|
||||
{
|
||||
using (myStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
Source = openFileDialog1.FileName;
|
||||
//FileSources.Add(Source);
|
||||
string DecryotedText;
|
||||
string GrabbedText;
|
||||
byte[] bytes;
|
||||
BinaryRW Read = new BinaryRW();
|
||||
bytes = Read.ReadBytes(Source);
|
||||
GrabbedText = Convert.ToBase64String(bytes);
|
||||
DecryotedText = Decrypt(GrabbedText);
|
||||
for (int loop = 0; loop < Source.Length; loop++)
|
||||
{
|
||||
if (Source[loop] == '\\')
|
||||
{
|
||||
FileNameL = 0;
|
||||
}
|
||||
else
|
||||
FileNameL++;
|
||||
}
|
||||
for (int loop = Source.Length - FileNameL; loop < Source.Length; loop++)
|
||||
{
|
||||
FileName += Source[loop];
|
||||
}
|
||||
ArgVal[0] = FileName;
|
||||
ArgVal[1] = DecryotedText;
|
||||
ArgVal[2] = Source;
|
||||
return ArgVal;
|
||||
// AddPage(FileName, DecryotedText);
|
||||
//Debug.WriteLine("Open File Passed " + FileName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Debug.WriteLine("Open File Failed " + FileName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
BIN
CryptNote - Very First Project/Journal/StoredProcedureCLR.ico
Normal file
BIN
CryptNote - Very First Project/Journal/StoredProcedureCLR.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
93
CryptNote - Very First Project/Journal/Undo_Redo.cs
Normal file
93
CryptNote - Very First Project/Journal/Undo_Redo.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Journal
|
||||
{
|
||||
public struct UnRedo
|
||||
{
|
||||
public string m_var;
|
||||
public int m_position;
|
||||
public UnRedo(string _var, int _pos)
|
||||
{
|
||||
m_var = _var;
|
||||
m_position = _pos;
|
||||
}
|
||||
}
|
||||
class Undo_Redo
|
||||
{
|
||||
|
||||
List<Stack<UnRedo>> Undo;
|
||||
List<Stack<UnRedo>> Redo;
|
||||
List<bool> CanUndo;
|
||||
List<bool> CanRedu;
|
||||
UnRedo m_Buffer;
|
||||
public Undo_Redo()
|
||||
{
|
||||
Undo = new List<Stack<UnRedo>>();
|
||||
Redo = new List<Stack<UnRedo>>();
|
||||
CanUndo = new List<bool>();
|
||||
CanRedu = new List<bool>();
|
||||
AddPage();
|
||||
}
|
||||
public void AddPage()
|
||||
{
|
||||
Undo.Add(new Stack<UnRedo>());
|
||||
Redo.Add(new Stack<UnRedo>());
|
||||
CanUndo.Add(false);
|
||||
CanRedu.Add(false);
|
||||
}
|
||||
public void RemovePage(int _index)
|
||||
{
|
||||
Undo.RemoveAt(_index);
|
||||
Redo.RemoveAt(_index);
|
||||
CanRedu.RemoveAt(_index);
|
||||
CanUndo.RemoveAt(_index);
|
||||
}
|
||||
public void AddToUndo(int _index, string _var, int _position)
|
||||
{
|
||||
m_Buffer = new UnRedo(_var, _position);
|
||||
Undo[_index].Push(m_Buffer);
|
||||
CanUndo[_index] = true;
|
||||
}
|
||||
public UnRedo GetUndo(int _index)
|
||||
{
|
||||
if (Undo[_index].Count == 1)
|
||||
CanUndo[_index] = false;
|
||||
UnRedo _TP = Undo[_index].Pop();
|
||||
Redo[_index].Push(_TP);
|
||||
CanRedu[_index] = true;
|
||||
return _TP;
|
||||
}
|
||||
public UnRedo GetRedo(int _index)
|
||||
{
|
||||
if (Redo[_index].Count == 1)
|
||||
CanRedu[_index] = false;
|
||||
UnRedo _TP = Redo[_index].Pop();
|
||||
Undo[_index].Push(_TP);
|
||||
return _TP;
|
||||
}
|
||||
public void ClearRedo(int _index)
|
||||
{
|
||||
Redo[_index].Clear();
|
||||
CanRedu[_index] = false;
|
||||
}
|
||||
public void ClearUndo(int _index)
|
||||
{
|
||||
Redo[_index].Clear();
|
||||
CanUndo[_index] = false;
|
||||
}
|
||||
public bool CheckUndo(int _index)
|
||||
{
|
||||
return CanUndo[_index];
|
||||
}
|
||||
public bool CheckRedu(int _index)
|
||||
{
|
||||
return CanRedu[_index];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
BIN
CryptNote - Very First Project/Journal/WPFPage_gray.ico
Normal file
BIN
CryptNote - Very First Project/Journal/WPFPage_gray.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user