batch commit
This commit is contained in:
BIN
CryptNote - Very First Project/.vs/CryptNote/v14/.suo
Normal file
BIN
CryptNote - Very First Project/.vs/CryptNote/v14/.suo
Normal file
Binary file not shown.
22
CryptNote - Very First Project/CryptNote.sln
Normal file
22
CryptNote - Very First Project/CryptNote.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CryptNote", "Journal\CryptNote.csproj", "{74D8C056-DD54-4548-85F1-E0FC7DD16B7A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{74D8C056-DD54-4548-85F1-E0FC7DD16B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74D8C056-DD54-4548-85F1-E0FC7DD16B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74D8C056-DD54-4548-85F1-E0FC7DD16B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{74D8C056-DD54-4548-85F1-E0FC7DD16B7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
186
CryptNote - Very First Project/Journal/32bitEncryption.cs
Normal file
186
CryptNote - Very First Project/Journal/32bitEncryption.cs
Normal file
@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Cryptography;
|
||||
using System.IO;
|
||||
namespace Journal
|
||||
{
|
||||
public class _32bitEncryption
|
||||
{
|
||||
string Plain_Text;
|
||||
byte[] Encrypted_Bytes;
|
||||
string Encrypted_sting;
|
||||
//This class here the Rijndael is what will have most all of the methods we need to do aes encryption.
|
||||
//When this is called it will create both a key and Initialization Vector to use.
|
||||
RijndaelManaged Crypto = new RijndaelManaged();
|
||||
//This is just here to convert the Encrypted byte array to a string for viewing purposes.
|
||||
UTF8Encoding UTF = new UTF8Encoding();
|
||||
public _32bitEncryption() { }
|
||||
public _32bitEncryption(string _text, byte[] Key, byte[] IV)
|
||||
{
|
||||
Plain_Text = _text;
|
||||
Crypto.Key = Key;
|
||||
Crypto.IV = IV;
|
||||
Encrypted_Bytes = encrypt_function(Plain_Text, Crypto.Key, Crypto.IV);
|
||||
Encrypted_sting = ReturnEncrtpedbytetostring();
|
||||
}
|
||||
#region GettersAndSetters
|
||||
public string ReturnEncrtpedbytetostring()
|
||||
{
|
||||
return UTF.GetString(Encrypted_Bytes);
|
||||
}
|
||||
public string ReturnEncrtpedbytetostring(byte[] _tmp)
|
||||
{
|
||||
return UTF.GetString(_tmp);
|
||||
}
|
||||
public RijndaelManaged GetCrypto()
|
||||
{
|
||||
return Crypto;
|
||||
}
|
||||
public void SetCrypto(RijndaelManaged _tmp)
|
||||
{
|
||||
Crypto = _tmp;
|
||||
}
|
||||
public void SetText(string _str)
|
||||
{
|
||||
Plain_Text = _str;
|
||||
}
|
||||
public string GetText()
|
||||
{
|
||||
return Plain_Text;
|
||||
}
|
||||
public void SetEncrptedText(string _str)
|
||||
{
|
||||
Encrypted_sting = _str;
|
||||
}
|
||||
public string GetEncryptrdText()
|
||||
{
|
||||
return Encrypted_sting;
|
||||
}
|
||||
public byte[] GetEncrptBytes()
|
||||
{
|
||||
return Encrypted_Bytes;
|
||||
}
|
||||
#endregion
|
||||
public byte[] encrypt_function(string plainText, byte[] Key, byte[] IV)
|
||||
|
||||
{
|
||||
byte[] initVectorBytes = IV;
|
||||
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||
PasswordDeriveBytes password = new PasswordDeriveBytes(Properties.Settings.Default.Password, null);
|
||||
byte[] keyBytes = password.GetBytes(256 / 8);
|
||||
RijndaelManaged symmetricKey = new RijndaelManaged();
|
||||
symmetricKey.Padding = PaddingMode.Zeros;
|
||||
symmetricKey.Mode = CipherMode.CBC;
|
||||
ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes);
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
|
||||
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
byte[] cipherTextBytes = memoryStream.ToArray();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
return cipherTextBytes;
|
||||
#region Doesnt work
|
||||
//RijndaelManaged Crypto = null;
|
||||
//MemoryStream MemStream = null;
|
||||
////I crypto transform is used to perform the actual decryption vs encryption, hash function are a version of crypto transforms.
|
||||
//ICryptoTransform Encryptor = null;
|
||||
////Crypto streams allow for encryption in memory.
|
||||
//CryptoStream Crypto_Stream = null;
|
||||
//System.Text.UTF8Encoding Byte_Transform = new System.Text.UTF8Encoding();
|
||||
////Just grabbing the bytes since most crypto functions need bytes.
|
||||
//byte[] PlainBytes = Byte_Transform.GetBytes(Plain_Text);
|
||||
//try
|
||||
//{
|
||||
// Crypto = new RijndaelManaged();
|
||||
// Crypto.Key = Key;
|
||||
// Crypto.IV = IV;
|
||||
// MemStream = new MemoryStream();
|
||||
// //Calling the method create encryptor method Needs both the Key and IV these have to be from the original Rijndael call
|
||||
// //If these are changed nothing will work right.
|
||||
// Encryptor = Crypto.CreateEncryptor(Crypto.Key, Crypto.IV);
|
||||
// //The big parameter here is the cryptomode.write, you are writing the data to memory to perform the transformation
|
||||
// Crypto_Stream = new CryptoStream(MemStream, Encryptor, CryptoStreamMode.Write);
|
||||
// //The method write takes three params the data to be written (in bytes) the offset value (int) and the length of the stream (int)
|
||||
// Crypto_Stream.Write(PlainBytes, 0, PlainBytes.Length);
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
// //if the crypto blocks are not clear lets make sure the data is gone
|
||||
// if (Crypto != null)
|
||||
// Crypto.Clear();
|
||||
// //Close because of my need to close things then done.
|
||||
// Crypto_Stream.Close();
|
||||
//}
|
||||
////Return the memory byte array
|
||||
//return MemStream.ToArray();
|
||||
//if (plainText == null || plainText.Length <= 0)
|
||||
// throw new ArgumentNullException("plainText");
|
||||
//if (Key == null || Key.Length <= 0)
|
||||
// throw new ArgumentNullException("Key");
|
||||
//if (IV == null || IV.Length <= 0)
|
||||
// throw new ArgumentNullException("IV");
|
||||
//byte[] encrypted;
|
||||
//// Create an Aes object
|
||||
//// with the specified key and IV.
|
||||
//using (Aes aesAlg = Aes.Create())
|
||||
//{
|
||||
// aesAlg.Key = Key;
|
||||
// aesAlg.IV = IV;
|
||||
|
||||
// // Create a decrytor to perform the stream transform.
|
||||
// ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
// // Create the streams used for encryption.
|
||||
// using (MemoryStream msEncrypt = new MemoryStream())
|
||||
// {
|
||||
// using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
// {
|
||||
// using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
|
||||
// {
|
||||
|
||||
// //Write all data to the stream.
|
||||
// swEncrypt.Write(plainText);
|
||||
// }
|
||||
// encrypted = msEncrypt.ToArray();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// Return the encrypted bytes from the memory stream.
|
||||
//return encrypted;
|
||||
#endregion
|
||||
}
|
||||
public string decrypt_function(byte[] cipherText, byte[] Key, byte[] IV )
|
||||
{
|
||||
|
||||
byte[] initVectorBytes = IV;
|
||||
byte[] cipherTextBytes = cipherText;
|
||||
PasswordDeriveBytes password = new PasswordDeriveBytes(Properties.Settings.Default.Password, null);
|
||||
byte[] keyBytes = password.GetBytes(256 / 8);
|
||||
RijndaelManaged symmetricKey = new RijndaelManaged();
|
||||
symmetricKey.Padding = PaddingMode.Zeros;
|
||||
symmetricKey.Mode = CipherMode.CBC;
|
||||
ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes);
|
||||
MemoryStream memoryStream = new MemoryStream(cipherTextBytes);
|
||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);
|
||||
byte[] plainTextBytes = new byte[cipherTextBytes.Length];
|
||||
int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
|
||||
}
|
||||
|
||||
public byte[] GetBytes(string str)
|
||||
{
|
||||
byte[] bytes = new byte[str.Length * sizeof(char)];
|
||||
Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
187
CryptNote - Very First Project/Journal/64bitCreateAccount.Designer.cs
generated
Normal file
187
CryptNote - Very First Project/Journal/64bitCreateAccount.Designer.cs
generated
Normal file
@ -0,0 +1,187 @@
|
||||
namespace Journal
|
||||
{
|
||||
partial class _64bitCreateAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.InfoText = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.PasswordText = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.VerifyTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.UserPasMatch = new System.Windows.Forms.Label();
|
||||
this.OkButton = new System.Windows.Forms.Button();
|
||||
this.CancelButton = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// InfoText
|
||||
//
|
||||
this.InfoText.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.InfoText.Enabled = false;
|
||||
this.InfoText.Location = new System.Drawing.Point(12, 217);
|
||||
this.InfoText.Multiline = true;
|
||||
this.InfoText.Name = "InfoText";
|
||||
this.InfoText.ReadOnly = true;
|
||||
this.InfoText.Size = new System.Drawing.Size(258, 49);
|
||||
this.InfoText.TabIndex = 33;
|
||||
this.InfoText.Text = "CrypteNote will like to remind you that its not the safiest program. We are only " +
|
||||
"using a 64-bit encrpytion. Best regards from ZeroUnderscoreZero\r\n";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(18, 112);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(25, 13);
|
||||
this.label1.TabIndex = 34;
|
||||
this.label1.Text = "Key";
|
||||
//
|
||||
// PasswordText
|
||||
//
|
||||
this.PasswordText.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.PasswordText.Location = new System.Drawing.Point(12, 128);
|
||||
this.PasswordText.MaxLength = 64;
|
||||
this.PasswordText.Name = "PasswordText";
|
||||
this.PasswordText.PasswordChar = '*';
|
||||
this.PasswordText.Size = new System.Drawing.Size(243, 20);
|
||||
this.PasswordText.TabIndex = 35;
|
||||
this.PasswordText.Enter += new System.EventHandler(this.PasswordText_Enter);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(18, 157);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(62, 13);
|
||||
this.label2.TabIndex = 36;
|
||||
this.label2.Text = "Retype Key";
|
||||
//
|
||||
// VerifyTextBox
|
||||
//
|
||||
this.VerifyTextBox.Location = new System.Drawing.Point(12, 173);
|
||||
this.VerifyTextBox.MaxLength = 64;
|
||||
this.VerifyTextBox.Name = "VerifyTextBox";
|
||||
this.VerifyTextBox.PasswordChar = '*';
|
||||
this.VerifyTextBox.Size = new System.Drawing.Size(243, 20);
|
||||
this.VerifyTextBox.TabIndex = 37;
|
||||
this.VerifyTextBox.Enter += new System.EventHandler(this.VerifyTextBox_Enter);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Times New Roman", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label3.Location = new System.Drawing.Point(56, 77);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(136, 31);
|
||||
this.label3.TabIndex = 38;
|
||||
this.label3.Text = "Create Key";
|
||||
//
|
||||
// UserPasMatch
|
||||
//
|
||||
this.UserPasMatch.AutoSize = true;
|
||||
this.UserPasMatch.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.UserPasMatch.ForeColor = System.Drawing.Color.Red;
|
||||
this.UserPasMatch.Location = new System.Drawing.Point(60, 196);
|
||||
this.UserPasMatch.Name = "UserPasMatch";
|
||||
this.UserPasMatch.Size = new System.Drawing.Size(146, 18);
|
||||
this.UserPasMatch.TabIndex = 39;
|
||||
this.UserPasMatch.Text = "Keys do NOT match!";
|
||||
this.UserPasMatch.Visible = false;
|
||||
//
|
||||
// OkButton
|
||||
//
|
||||
this.OkButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
|
||||
this.OkButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.OkButton.Location = new System.Drawing.Point(207, 275);
|
||||
this.OkButton.Name = "OkButton";
|
||||
this.OkButton.Size = new System.Drawing.Size(71, 23);
|
||||
this.OkButton.TabIndex = 40;
|
||||
this.OkButton.Text = "Ok";
|
||||
this.OkButton.UseVisualStyleBackColor = true;
|
||||
this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
this.CancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.CancelButton.Location = new System.Drawing.Point(126, 275);
|
||||
this.CancelButton.Name = "CancelButton";
|
||||
this.CancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.CancelButton.TabIndex = 41;
|
||||
this.CancelButton.Text = "Cancel";
|
||||
this.CancelButton.UseVisualStyleBackColor = true;
|
||||
this.CancelButton.Click += new System.EventHandler(this.CancelButton_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("Times New Roman", 29F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label6.Location = new System.Drawing.Point(44, 9);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(195, 44);
|
||||
this.label6.TabIndex = 42;
|
||||
this.label6.Text = "CryptNote";
|
||||
//
|
||||
// _64bitCreateAccount
|
||||
//
|
||||
this.AcceptButton = this.OkButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(282, 301);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.CancelButton);
|
||||
this.Controls.Add(this.OkButton);
|
||||
this.Controls.Add(this.UserPasMatch);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.VerifyTextBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.PasswordText);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.InfoText);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Name = "_64bitCreateAccount";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Key Creation";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TextBox InfoText;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox PasswordText;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox VerifyTextBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label UserPasMatch;
|
||||
private System.Windows.Forms.Button OkButton;
|
||||
public System.Windows.Forms.Button CancelButton;
|
||||
private System.Windows.Forms.Label label6;
|
||||
}
|
||||
}
|
85
CryptNote - Very First Project/Journal/64bitCreateAccount.cs
Normal file
85
CryptNote - Very First Project/Journal/64bitCreateAccount.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Journal
|
||||
{
|
||||
public partial class _64bitCreateAccount : Form
|
||||
{
|
||||
public _64bitCreateAccount()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(PasswordText.Text.Length < 20 && PasswordText.Text.Length > 0)
|
||||
{
|
||||
const string message =
|
||||
"Are you sure your password is Under 20 characters";
|
||||
const string caption = "Set Password";
|
||||
var result = MessageBox.Show(message, caption,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question);
|
||||
|
||||
// If the no button was pressed ...
|
||||
if (result == DialogResult.No)
|
||||
{
|
||||
// cancel the closure of the form.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(PasswordText.Text.Length == 0)
|
||||
{
|
||||
const string message =
|
||||
"Please enter a password!";
|
||||
const string caption = "No Password";
|
||||
var result = MessageBox.Show(message, caption,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question);
|
||||
|
||||
// If the no button was pressed ...
|
||||
|
||||
// cancel the closure of the form.
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
if (PasswordText.Text == VerifyTextBox.Text)
|
||||
{
|
||||
Properties.Settings.Default.Password = PasswordText.Text;
|
||||
Properties.Settings.Default.Save();
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
UserPasMatch.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void PasswordText_Enter(object sender, EventArgs e)
|
||||
{
|
||||
// OkButton.PerformClick();
|
||||
}
|
||||
|
||||
private void VerifyTextBox_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if(VerifyTextBox.Text.Length > 0)
|
||||
OkButton.PerformClick();
|
||||
}
|
||||
}
|
||||
}
|
120
CryptNote - Very First Project/Journal/64bitCreateAccount.resx
Normal file
120
CryptNote - Very First Project/Journal/64bitCreateAccount.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
42
CryptNote - Very First Project/Journal/App.config
Normal file
42
CryptNote - Very First Project/Journal/App.config
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="CryptNote.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Journal.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<CryptNote.Properties.Settings>
|
||||
<setting name="Username" serializeAs="String">
|
||||
<value>Admin</value>
|
||||
</setting>
|
||||
<setting name="Password" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="SourceFile" serializeAs="String">
|
||||
<value>Entery.txt</value>
|
||||
</setting>
|
||||
<setting name="IV_per" serializeAs="String">
|
||||
<value>42</value>
|
||||
</setting>
|
||||
</CryptNote.Properties.Settings>
|
||||
<Journal.Properties.Settings>
|
||||
<setting name="Username" serializeAs="String">
|
||||
<value>Admin</value>
|
||||
</setting>
|
||||
<setting name="Password" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="SourceFile" serializeAs="String">
|
||||
<value>Entery.txt</value>
|
||||
</setting>
|
||||
<setting name="IV_per" serializeAs="String">
|
||||
<value>42</value>
|
||||
</setting>
|
||||
</Journal.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
80
CryptNote - Very First Project/Journal/BinaryRW.cs
Normal file
80
CryptNote - Very First Project/Journal/BinaryRW.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace Journal
|
||||
{
|
||||
class BinaryRW
|
||||
{
|
||||
public byte[] ReadBytes(string source)
|
||||
{
|
||||
try
|
||||
{
|
||||
return File.ReadAllBytes(source);
|
||||
}
|
||||
catch (Exception _Exception)
|
||||
{
|
||||
Console.WriteLine("Exception caught in process: {0}",
|
||||
_Exception.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool writeBytes(byte[] _write, string source)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Open file for reading
|
||||
System.IO.FileStream _FileStream =
|
||||
new System.IO.FileStream(source, System.IO.FileMode.Create,
|
||||
System.IO.FileAccess.Write);
|
||||
// Writes a block of bytes to this stream using data from
|
||||
// a byte array.
|
||||
_FileStream.Write(_write, 0, _write.Length);
|
||||
|
||||
// close file stream
|
||||
_FileStream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception _Exception)
|
||||
{
|
||||
// Error
|
||||
Console.WriteLine("Exception caught in process: {0}",
|
||||
_Exception.ToString());
|
||||
}
|
||||
|
||||
// error occured, return false
|
||||
return false;
|
||||
}
|
||||
public bool writeString(string _write, string _source)
|
||||
{
|
||||
if (_write.Length > 0 && _source.Length > 0)
|
||||
{
|
||||
File.WriteAllText(_source, _write);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public string readString(string _source)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_source.Length > 0)
|
||||
{
|
||||
string _read = File.ReadAllText(_source);
|
||||
return _read;
|
||||
}
|
||||
}
|
||||
catch (Exception _Exception)
|
||||
{
|
||||
Console.WriteLine("Exception caught in process: {0}",
|
||||
_Exception.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user