Initial commit

This commit is contained in:
Sigmanor 2016-01-06 16:47:38 +02:00
parent 4c4f809a0a
commit f7a9f9c27c
26 changed files with 6258 additions and 0 deletions

28
EncryptPad.sln Normal file
View file

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EncryptPad", "EncryptPad\EncryptPad.csproj", "{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Debug|x86.ActiveCfg = Debug|x86
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Debug|x86.Build.0 = Debug|x86
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Release|Any CPU.Build.0 = Release|Any CPU
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Release|x86.ActiveCfg = Release|x86
{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

93
EncryptPad/AES.cs Normal file
View file

@ -0,0 +1,93 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace EncryptPad
{
class AES
{
public static string Encrypt(string plainText, string password,
string salt = "Kosher", string hashAlgorithm = "SHA1",
int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY",
int keySize = 256)
{
if (string.IsNullOrEmpty(plainText))
return "";
byte[] initialVectorBytes = Encoding.ASCII.GetBytes(initialVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(salt);
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
PasswordDeriveBytes derivedPassword = new PasswordDeriveBytes
(password, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes = derivedPassword.GetBytes(keySize / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
byte[] cipherTextBytes = null;
using (ICryptoTransform encryptor = symmetricKey.CreateEncryptor
(keyBytes, initialVectorBytes))
{
using (MemoryStream memStream = new MemoryStream())
{
using (CryptoStream cryptoStream = new CryptoStream
(memStream, encryptor, CryptoStreamMode.Write))
{
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
cipherTextBytes = memStream.ToArray();
memStream.Close();
cryptoStream.Close();
}
}
}
symmetricKey.Clear();
return Convert.ToBase64String(cipherTextBytes);
}
public static string Decrypt(string cipherText, string password,
string salt = "Kosher", string hashAlgorithm = "SHA1",
int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY",
int keySize = 256)
{
if (string.IsNullOrEmpty(cipherText))
return "";
byte[] initialVectorBytes = Encoding.ASCII.GetBytes(initialVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(salt);
byte[] cipherTextBytes = Convert.FromBase64String(cipherText);
PasswordDeriveBytes derivedPassword = new PasswordDeriveBytes
(password, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes = derivedPassword.GetBytes(keySize / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
byte[] plainTextBytes = new byte[cipherTextBytes.Length];
int byteCount = 0;
using (ICryptoTransform decryptor = symmetricKey.CreateDecryptor
(keyBytes, initialVectorBytes))
{
using (MemoryStream memStream = new MemoryStream(cipherTextBytes))
{
using (CryptoStream cryptoStream
= new CryptoStream(memStream, decryptor, CryptoStreamMode.Read))
{
byteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
memStream.Close();
cryptoStream.Close();
}
}
}
symmetricKey.Clear();
return Encoding.UTF8.GetString(plainTextBytes, 0, byteCount);
}
}
}

96
EncryptPad/App.config Normal file
View file

@ -0,0 +1,96 @@
<?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="EncryptPad.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="Encryption_Tool.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"/></startup>
<userSettings>
<EncryptPad.Properties.Settings>
<setting name="TopPosition" serializeAs="String">
<value>0</value>
</setting>
<setting name="LeftPosition" serializeAs="String">
<value>0</value>
</setting>
<setting name="RichTextFont" serializeAs="String">
<value>Consolas</value>
</setting>
<setting name="RichForeColor" serializeAs="String">
<value>228, 228, 228</value>
</setting>
<setting name="FormWidth" serializeAs="String">
<value>687</value>
</setting>
<setting name="FormHeight" serializeAs="String">
<value>428</value>
</setting>
<setting name="RichBackColor" serializeAs="String">
<value>56, 56, 56</value>
</setting>
<setting name="MenuWrap" serializeAs="String">
<value>True</value>
</setting>
<setting name="RichWrap" serializeAs="String">
<value>True</value>
</setting>
<setting name="RichTextSize" serializeAs="String">
<value>11</value>
</setting>
<setting name="HighlightsColor" serializeAs="String">
<value>101, 51, 6</value>
</setting>
<setting name="AssociateCheck" serializeAs="String">
<value>False</value>
</setting>
<setting name="HashAlgorithm" serializeAs="String">
<value>SHA1</value>
</setting>
<setting name="KeySize" serializeAs="String">
<value>192</value>
</setting>
<setting name="TheSalt" serializeAs="String">
<value />
</setting>
<setting name="PasswordIterations" serializeAs="String">
<value>2</value>
</setting>
<setting name="FirstLaunch" serializeAs="String">
<value>False</value>
</setting>
</EncryptPad.Properties.Settings>
<Encryption_Tool.Properties.Settings>
<setting name="TopPosition" serializeAs="String">
<value>0</value>
</setting>
<setting name="LeftPosition" serializeAs="String">
<value>0</value>
</setting>
<setting name="RichTextFont" serializeAs="String">
<value>Consolas, 9.75pt</value>
</setting>
<setting name="RichTextColor" serializeAs="String">
<value>66, 66, 74</value>
</setting>
<setting name="FormWidth" serializeAs="String">
<value>687</value>
</setting>
<setting name="FormHeight" serializeAs="String">
<value>428</value>
</setting>
<setting name="RichForeColor" serializeAs="String">
<value>White</value>
</setting>
<setting name="MenuWrap" serializeAs="String">
<value>True</value>
</setting>
<setting name="RichWrap" serializeAs="String">
<value>True</value>
</setting>
</Encryption_Tool.Properties.Settings>
</userSettings>
</configuration>

36
EncryptPad/CustomRichTextBox.Designer.cs generated Normal file
View file

@ -0,0 +1,36 @@
namespace EncryptPad
{
partial class CustomRichTextBox
{
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View file

@ -0,0 +1,129 @@
/****************************** Module Header ******************************\
* Module Name: CustomRichTextBox.cs
* Project: CSWinFormSearchAndHighlightText
* Copyright(c) Microsoft Corporation.
*
* Theclass is used to create custom RichTextBox
* The custom RichTextBox add custom Highlight and ClearHighlight method
*
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/en-us/openness/licenses.aspx.
* All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System;
namespace EncryptPad
{
/// <summary>
/// Custom RichTextBox control
/// </summary>
public partial class CustomRichTextBox : RichTextBox
{
public CustomRichTextBox()
: base()
{
InitializeComponent();
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
//this message is sent to the control when we scroll using the mouse
private const int WM_MOUSEWHEEL = 0x20A;
//and this one issues the control to perform scrolling
private const int WM_VSCROLL = 0x115;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEWHEEL)
{
int scrollLines = SystemInformation.MouseWheelScrollLines;
for (int i = 0; i < scrollLines; i++)
{
if ((int)m.WParam > 0) // when wParam is greater than 0
SendMessage(this.Handle, WM_VSCROLL, (IntPtr)0, IntPtr.Zero); // scroll up
else
SendMessage(this.Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero); // else scroll down
}
return;
}
base.WndProc(ref m);
}
/// <summary>
/// Search and Highlight all text in RichTextBox Control
/// </summary>
/// <param name="findWhat">Find What</param>
/// <param name="highlightColor">Highlight Color</param>
/// <param name="ismatchCase">Is Match Case</param>
/// <param name="ismatchWholeWord">Is Match Whole Word</param>
/// <returns></returns>
public bool Highlight(string findWhat, Color highlightColor, bool ismatchCase, bool ismatchWholeWord)
{
// Clear all highlights before searching text again
ClearHighlight();
int startSearch = 0;
//int searchLength = findWhat.Length;
RichTextBoxFinds findoptions = default(RichTextBoxFinds);
// Setup the search options.
if (ismatchCase && ismatchWholeWord)
{
findoptions = RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord;
}
else if (ismatchCase)
{
findoptions = RichTextBoxFinds.MatchCase;
}
else if (ismatchWholeWord)
{
findoptions = RichTextBoxFinds.WholeWord;
}
else
{
findoptions = RichTextBoxFinds.None;
}
// detect whether search text exists in richtextbox
bool isfind = false;
int index = -1;
// Search text in RichTextBox and highlight them with color.
int max = this.TextLength;
while (startSearch < max && (index = this.Find(findWhat, startSearch, findoptions)) > -1)
{
isfind = true;
this.SelectionBackColor = highlightColor;
// Continue after the one we searched
startSearch = index + 1;
}
// If the text exist in RichTextBox control, then return true, otherwise, return false
return isfind;
}
/// <summary>
/// Clear all Highlights
/// </summary>
private void ClearHighlight()
{
Properties.Settings ps = Properties.Settings.Default;
this.SelectAll();
this.SelectionBackColor = ps.RichBackColor;
}
}
}

View file

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{06D6F36C-FAFA-4B88-BE04-3F73EB28C21E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EncryptPad</RootNamespace>
<AssemblyName>EncryptPad</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<IsWebBootstrapper>false</IsWebBootstrapper>
<ApplicationIcon>locked.ico</ApplicationIcon>
<SignAssembly>False</SignAssembly>
<DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<RunCodeAnalysis>False</RunCodeAnalysis>
<SourceAnalysisOverrideSettingsFile>C:\Users\Alex\AppData\Roaming\ICSharpCode/SharpDevelop4\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>PdbOnly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AES.cs" />
<Compile Include="CustomRichTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomRichTextBox.Designer.cs">
<DependentUpon>CustomRichTextBox.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="MessageBoxCenter.cs" />
<Compile Include="PortableSettingsProvider.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="locked.ico" />
<None Include="bin\Debug\doc.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 и x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>Клиентский профиль .NET Framework 3.5 с пакетом обновления 1 %28SP1%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1 @@
<OpenCoverSettings />

44
EncryptPad/Encryption.cs Normal file
View file

@ -0,0 +1,44 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace EncryptPad
{
class Encryption
{
public static string key = "";
public static TripleDES Create3DES()
{
MD5 md5 = new MD5CryptoServiceProvider();
TripleDES des = new TripleDESCryptoServiceProvider();
des.Key = md5.ComputeHash(Encoding.Unicode.GetBytes(key));
des.IV = new byte[des.BlockSize / 8];
return des;
}
public static string EncrypTo3DES(string PlainText)
{
if (string.IsNullOrEmpty(PlainText))
{
return null;
}
TripleDES des = Create3DES();
ICryptoTransform ct = des.CreateEncryptor();
byte[] input = Encoding.Unicode.GetBytes(PlainText);
byte[] resArr = ct.TransformFinalBlock(input, 0, input.Length);
string result = Convert.ToBase64String(resArr);
return result;
}
public static string DecryptFrom3Des(string CypherText)
{
if (string.IsNullOrEmpty(CypherText))
{
return null;
}
byte[] b = Convert.FromBase64String(CypherText);
TripleDES des = Create3DES();
ICryptoTransform ct = des.CreateDecryptor();
byte[] output = ct.TransformFinalBlock(b, 0, b.Length);
return Encoding.Unicode.GetString(output);
}
}
}

717
EncryptPad/Form1.Designer.cs generated Normal file
View file

@ -0,0 +1,717 @@
namespace EncryptPad
{
partial class MainWindow
{
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
public void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
this.MainMenu = new System.Windows.Forms.MenuStrip();
this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.создатьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.открытьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.сохранитьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.сохранитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.открытьРасположениеФайлаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.УдалитьФайлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.выходToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.правкаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отменаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.вырезатьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.копироватьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.вставитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.findToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.выделитьВсеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.переносПоСловамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.очиститьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.сервисToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.changeKeyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.помощьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.documentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.сheckForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.оПрограммеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.отменитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.вырезатьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.копироватьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.вставитьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.выделитьВсеToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.порядокЧтенияСправаНалевоToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.очиститьToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.OpenFile = new System.Windows.Forms.OpenFileDialog();
this.SaveFile = new System.Windows.Forms.SaveFileDialog();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.lineStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.columnStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.searchTextBox = new System.Windows.Forms.TextBox();
this.chkMatchCase = new System.Windows.Forms.CheckBox();
this.chkMatchWholeWord = new System.Windows.Forms.CheckBox();
this.panel1 = new System.Windows.Forms.Panel();
this.customRTB = new EncryptPad.CustomRichTextBox();
this.MainMenu.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// MainMenu
//
this.MainMenu.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.MainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.файлToolStripMenuItem,
this.правкаToolStripMenuItem,
this.сервисToolStripMenuItem,
this.помощьToolStripMenuItem});
this.MainMenu.Location = new System.Drawing.Point(0, 0);
this.MainMenu.Name = "MainMenu";
this.MainMenu.Padding = new System.Windows.Forms.Padding(0);
this.MainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
this.MainMenu.Size = new System.Drawing.Size(689, 24);
this.MainMenu.TabIndex = 0;
this.MainMenu.Text = "menuStrip1";
//
// файлToolStripMenuItem
//
this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.создатьToolStripMenuItem,
this.открытьToolStripMenuItem,
this.toolStripSeparator11,
this.сохранитьToolStripMenuItem1,
this.сохранитьToolStripMenuItem,
this.toolStripSeparator4,
this.открытьРасположениеФайлаToolStripMenuItem,
this.УдалитьФайлToolStripMenuItem,
this.toolStripSeparator2,
this.выходToolStripMenuItem});
this.файлToolStripMenuItem.Name = айлToolStripMenuItem";
this.файлToolStripMenuItem.Size = new System.Drawing.Size(36, 24);
this.файлToolStripMenuItem.Text = "File";
//
// создатьToolStripMenuItem
//
this.создатьToolStripMenuItem.Name = "создатьToolStripMenuItem";
this.создатьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.создатьToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.создатьToolStripMenuItem.Text = "New File";
this.создатьToolStripMenuItem.Click += new System.EventHandler(this.новыйToolStripMenuItem_Click_1);
//
// открытьToolStripMenuItem
//
this.открытьToolStripMenuItem.Name = "открытьToolStripMenuItem";
this.открытьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.открытьToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.открытьToolStripMenuItem.Text = "Open File";
this.открытьToolStripMenuItem.Click += new System.EventHandler(this.открытьToolStripMenuItem_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(199, 6);
//
// сохранитьToolStripMenuItem1
//
this.сохранитьToolStripMenuItem1.Name = "сохранитьToolStripMenuItem1";
this.сохранитьToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.сохранитьToolStripMenuItem1.Size = new System.Drawing.Size(202, 22);
this.сохранитьToolStripMenuItem1.Text = "Save";
this.сохранитьToolStripMenuItem1.Click += new System.EventHandler(this.сохранитьToolStripMenuItem1_Click_1);
//
// сохранитьToolStripMenuItem
//
this.сохранитьToolStripMenuItem.Name = "сохранитьToolStripMenuItem";
this.сохранитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.сохранитьToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.сохранитьToolStripMenuItem.Text = "Save As...";
this.сохранитьToolStripMenuItem.Click += new System.EventHandler(this.сохранитьToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(199, 6);
//
// открытьРасположениеФайлаToolStripMenuItem
//
this.открытьРасположениеФайлаToolStripMenuItem.Name = "открытьРасположениеФайлаToolStripMenuItem";
this.открытьРасположениеФайлаToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.открытьРасположениеФайлаToolStripMenuItem.Text = "Open File Location";
this.открытьРасположениеФайлаToolStripMenuItem.Click += new System.EventHandler(this.открытьРасположениеФайлаToolStripMenuItem_Click);
//
// УдалитьФайлToolStripMenuItem
//
this.УдалитьФайлToolStripMenuItem.Name = "УдалитьФайлToolStripMenuItem";
this.УдалитьФайлToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.УдалитьФайлToolStripMenuItem.Text = "Delete File";
this.УдалитьФайлToolStripMenuItem.Click += new System.EventHandler(this.УдалитьФайлToolStripMenuItem_Click_1);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(199, 6);
//
// выходToolStripMenuItem
//
this.выходToolStripMenuItem.Name = "выходToolStripMenuItem";
this.выходToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q)));
this.выходToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.выходToolStripMenuItem.Text = "Exit";
this.выходToolStripMenuItem.Click += new System.EventHandler(this.выходToolStripMenuItem_Click);
//
// правкаToolStripMenuItem
//
this.правкаToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.отменаToolStripMenuItem,
this.toolStripSeparator1,
this.вырезатьToolStripMenuItem,
this.копироватьToolStripMenuItem,
this.вставитьToolStripMenuItem,
this.удалитьToolStripMenuItem,
this.toolStripSeparator9,
this.findToolStripMenuItem2,
this.toolStripSeparator3,
this.выделитьВсеToolStripMenuItem,
this.переносПоСловамToolStripMenuItem,
this.toolStripSeparator5,
this.очиститьToolStripMenuItem});
this.правкаToolStripMenuItem.Name = "правкаToolStripMenuItem";
this.правкаToolStripMenuItem.Size = new System.Drawing.Size(40, 24);
this.правкаToolStripMenuItem.Text = "Edit";
this.правкаToolStripMenuItem.MouseDown += new System.Windows.Forms.MouseEventHandler(this.правкаToolStripMenuItem_MouseDown);
//
// отменаToolStripMenuItem
//
this.отменаToolStripMenuItem.Name = "отменаToolStripMenuItem";
this.отменаToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.отменаToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.отменаToolStripMenuItem.Text = "Undo";
this.отменаToolStripMenuItem.Click += new System.EventHandler(this.отменаToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(162, 6);
//
// вырезатьToolStripMenuItem
//
this.вырезатьToolStripMenuItem.Enabled = false;
this.вырезатьToolStripMenuItem.Name = "вырезатьToolStripMenuItem";
this.вырезатьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.вырезатьToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.вырезатьToolStripMenuItem.Text = "Cut";
this.вырезатьToolStripMenuItem.Click += new System.EventHandler(this.вырезатьToolStripMenuItem_Click);
//
// копироватьToolStripMenuItem
//
this.копироватьToolStripMenuItem.Enabled = false;
this.копироватьToolStripMenuItem.Name = опироватьToolStripMenuItem";
this.копироватьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.копироватьToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.копироватьToolStripMenuItem.Text = "Copy";
this.копироватьToolStripMenuItem.Click += new System.EventHandler(this.копироватьToolStripMenuItem_Click);
//
// вставитьToolStripMenuItem
//
this.вставитьToolStripMenuItem.Name = ставитьToolStripMenuItem";
this.вставитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.вставитьToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.вставитьToolStripMenuItem.Text = "Paste";
this.вставитьToolStripMenuItem.Click += new System.EventHandler(this.вставитьToolStripMenuItem_Click);
//
// удалитьToolStripMenuItem
//
this.удалитьToolStripMenuItem.Enabled = false;
this.удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
this.удалитьToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.удалитьToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.удалитьToolStripMenuItem.Text = "Delete";
this.удалитьToolStripMenuItem.Click += new System.EventHandler(this.удалитьToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(162, 6);
//
// findToolStripMenuItem2
//
this.findToolStripMenuItem2.Name = "findToolStripMenuItem2";
this.findToolStripMenuItem2.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findToolStripMenuItem2.Size = new System.Drawing.Size(165, 22);
this.findToolStripMenuItem2.Text = "Find";
this.findToolStripMenuItem2.Click += new System.EventHandler(this.findToolStripMenuItem2_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(162, 6);
//
// выделитьВсеToolStripMenuItem
//
this.выделитьВсеToolStripMenuItem.Name = "выделитьВсеToolStripMenuItem";
this.выделитьВсеToolStripMenuItem.ShortcutKeyDisplayString = "";
this.выделитьВсеToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.выделитьВсеToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.выделитьВсеToolStripMenuItem.Text = "Select All";
this.выделитьВсеToolStripMenuItem.Click += new System.EventHandler(this.выделитьВсеToolStripMenuItem_Click);
//
// переносПоСловамToolStripMenuItem
//
this.переносПоСловамToolStripMenuItem.Checked = true;
this.переносПоСловамToolStripMenuItem.CheckOnClick = true;
this.переносПоСловамToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.переносПоСловамToolStripMenuItem.Name = "переносПоСловамToolStripMenuItem";
this.переносПоСловамToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.переносПоСловамToolStripMenuItem.Text = "Word Wrap";
this.переносПоСловамToolStripMenuItem.Click += new System.EventHandler(this.переносПоСловамToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(162, 6);
//
// очиститьToolStripMenuItem
//
this.очиститьToolStripMenuItem.Name = "очиститьToolStripMenuItem";
this.очиститьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)));
this.очиститьToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.очиститьToolStripMenuItem.Text = "Clear";
this.очиститьToolStripMenuItem.Click += new System.EventHandler(this.очиститьToolStripMenuItem_Click);
//
// сервисToolStripMenuItem
//
this.сервисToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.changeKeyToolStripMenuItem,
this.settingsToolStripMenuItem});
this.сервисToolStripMenuItem.Name = "сервисToolStripMenuItem";
this.сервисToolStripMenuItem.Size = new System.Drawing.Size(48, 24);
this.сервисToolStripMenuItem.Text = "Tools";
//
// changeKeyToolStripMenuItem
//
this.changeKeyToolStripMenuItem.Enabled = false;
this.changeKeyToolStripMenuItem.Name = "changeKeyToolStripMenuItem";
this.changeKeyToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.changeKeyToolStripMenuItem.Text = "Change Key";
this.changeKeyToolStripMenuItem.Click += new System.EventHandler(this.changeKeyToolStripMenuItem_Click);
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.settingsToolStripMenuItem.Text = "Settings";
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click);
//
// помощьToolStripMenuItem
//
this.помощьToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.documentationToolStripMenuItem,
this.сheckForUpdatesToolStripMenuItem,
this.оПрограммеToolStripMenuItem});
this.помощьToolStripMenuItem.Name = "помощьToolStripMenuItem";
this.помощьToolStripMenuItem.Size = new System.Drawing.Size(43, 24);
this.помощьToolStripMenuItem.Text = "Help";
//
// documentationToolStripMenuItem
//
this.documentationToolStripMenuItem.Name = "documentationToolStripMenuItem";
this.documentationToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.documentationToolStripMenuItem.Text = "Documentation";
this.documentationToolStripMenuItem.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click);
//
// сheckForUpdatesToolStripMenuItem
//
this.сheckForUpdatesToolStripMenuItem.Enabled = false;
this.сheckForUpdatesToolStripMenuItem.Name = "сheckForUpdatesToolStripMenuItem";
this.сheckForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.сheckForUpdatesToolStripMenuItem.Text = "Сheck For Updates...";
//
// оПрограммеToolStripMenuItem
//
this.оПрограммеToolStripMenuItem.Name = "оПрограммеToolStripMenuItem";
this.оПрограммеToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.оПрограммеToolStripMenuItem.Text = "About";
this.оПрограммеToolStripMenuItem.Click += new System.EventHandler(this.оПрограммеToolStripMenuItem_Click);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.отменитьToolStripMenuItem,
this.toolStripSeparator6,
this.вырезатьToolStripMenuItem1,
this.копироватьToolStripMenuItem1,
this.вставитьToolStripMenuItem1,
this.удалитьToolStripMenuItem1,
this.toolStripSeparator8,
this.выделитьВсеToolStripMenuItem1,
this.порядокЧтенияСправаНалевоToolStripMenuItem,
this.toolStripSeparator7,
this.очиститьToolStripMenuItem1});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(259, 198);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// отменитьToolStripMenuItem
//
this.отменитьToolStripMenuItem.Name = "отменитьToolStripMenuItem";
this.отменитьToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
this.отменитьToolStripMenuItem.Text = "Отменить";
this.отменитьToolStripMenuItem.Click += new System.EventHandler(this.отменитьToolStripMenuItem_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(255, 6);
//
// вырезатьToolStripMenuItem1
//
this.вырезатьToolStripMenuItem1.Name = "вырезатьToolStripMenuItem1";
this.вырезатьToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.вырезатьToolStripMenuItem1.Text = "Вырезать";
this.вырезатьToolStripMenuItem1.Click += new System.EventHandler(this.вырезатьToolStripMenuItem1_Click);
//
// копироватьToolStripMenuItem1
//
this.копироватьToolStripMenuItem1.Name = опироватьToolStripMenuItem1";
this.копироватьToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.копироватьToolStripMenuItem1.Text = "Копировать";
this.копироватьToolStripMenuItem1.Click += new System.EventHandler(this.копироватьToolStripMenuItem1_Click);
//
// вставитьToolStripMenuItem1
//
this.вставитьToolStripMenuItem1.Name = ставитьToolStripMenuItem1";
this.вставитьToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.вставитьToolStripMenuItem1.Text = "Вставить";
this.вставитьToolStripMenuItem1.Click += new System.EventHandler(this.вставитьToolStripMenuItem1_Click);
//
// удалитьToolStripMenuItem1
//
this.удалитьToolStripMenuItem1.Name = "удалитьToolStripMenuItem1";
this.удалитьToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.удалитьToolStripMenuItem1.Text = "Удалить";
this.удалитьToolStripMenuItem1.Click += new System.EventHandler(this.удалитьToolStripMenuItem1_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(255, 6);
//
// выделитьВсеToolStripMenuItem1
//
this.выделитьВсеToolStripMenuItem1.Name = "выделитьВсеToolStripMenuItem1";
this.выделитьВсеToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.выделитьВсеToolStripMenuItem1.Text = "Выделить все";
this.выделитьВсеToolStripMenuItem1.Click += new System.EventHandler(this.выделитьВсеToolStripMenuItem1_Click);
//
// порядокЧтенияСправаНалевоToolStripMenuItem
//
this.порядокЧтенияСправаНалевоToolStripMenuItem.CheckOnClick = true;
this.порядокЧтенияСправаНалевоToolStripMenuItem.Name = "порядокЧтенияСправаНалевоToolStripMenuItem";
this.порядокЧтенияСправаНалевоToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
this.порядокЧтенияСправаНалевоToolStripMenuItem.Text = "Порядок чтения: справа налево";
this.порядокЧтенияСправаНалевоToolStripMenuItem.Click += new System.EventHandler(this.порядокЧтенияСправаНалевоToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(255, 6);
//
// очиститьToolStripMenuItem1
//
this.очиститьToolStripMenuItem1.Name = "очиститьToolStripMenuItem1";
this.очиститьToolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
this.очиститьToolStripMenuItem1.Text = "Очистить";
this.очиститьToolStripMenuItem1.Click += new System.EventHandler(this.очиститьToolStripMenuItem1_Click);
//
// OpenFile
//
this.OpenFile.Filter = "Encryption files (*.enp)|*.enp";
//
// SaveFile
//
this.SaveFile.Filter = "Encryption files (*.enp)|*.enp";
//
// button1
//
this.button1.Location = new System.Drawing.Point(701, 151);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 3;
this.button1.Text = "ENC";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
//
// button2
//
this.button2.Location = new System.Drawing.Point(701, 180);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 4;
this.button2.Text = "DEC";
this.button2.UseVisualStyleBackColor = true;
this.button2.Visible = false;
//
// statusStrip1
//
this.statusStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35)))));
this.statusStrip1.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.lineStripStatusLabel,
this.columnStripStatusLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 439);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.ShowItemToolTips = true;
this.statusStrip1.Size = new System.Drawing.Size(689, 22);
this.statusStrip1.SizingGrip = false;
this.statusStrip1.TabIndex = 5;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(42, 17);
this.toolStripStatusLabel1.Text = "Ready";
//
// lineStripStatusLabel
//
this.lineStripStatusLabel.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.lineStripStatusLabel.Margin = new System.Windows.Forms.Padding(50, 3, 20, 2);
this.lineStripStatusLabel.Name = "lineStripStatusLabel";
this.lineStripStatusLabel.Overflow = System.Windows.Forms.ToolStripItemOverflow.Always;
this.lineStripStatusLabel.Size = new System.Drawing.Size(42, 17);
this.lineStripStatusLabel.Text = "Line:";
//
// columnStripStatusLabel
//
this.columnStripStatusLabel.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.columnStripStatusLabel.Name = "columnStripStatusLabel";
this.columnStripStatusLabel.Overflow = System.Windows.Forms.ToolStripItemOverflow.Always;
this.columnStripStatusLabel.Size = new System.Drawing.Size(56, 17);
this.columnStripStatusLabel.Text = "Column:";
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(670, 7);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(14, 14);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 14;
this.pictureBox1.TabStop = false;
this.toolTip1.SetToolTip(this.pictureBox1, "Close");
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// searchTextBox
//
this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.searchTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.searchTextBox.Location = new System.Drawing.Point(496, 3);
this.searchTextBox.Name = "searchTextBox";
this.searchTextBox.Size = new System.Drawing.Size(168, 21);
this.searchTextBox.TabIndex = 9;
this.searchTextBox.TabStop = false;
this.searchTextBox.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
this.searchTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchTextBox_KeyDown);
//
// chkMatchCase
//
this.chkMatchCase.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMatchCase.AutoSize = true;
this.chkMatchCase.Location = new System.Drawing.Point(410, 5);
this.chkMatchCase.Name = "chkMatchCase";
this.chkMatchCase.Size = new System.Drawing.Size(80, 17);
this.chkMatchCase.TabIndex = 11;
this.chkMatchCase.Text = "Match case";
this.chkMatchCase.UseVisualStyleBackColor = true;
this.chkMatchCase.CheckedChanged += new System.EventHandler(this.chkMatchCase_CheckedChanged);
//
// chkMatchWholeWord
//
this.chkMatchWholeWord.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMatchWholeWord.AutoSize = true;
this.chkMatchWholeWord.Location = new System.Drawing.Point(289, 5);
this.chkMatchWholeWord.Name = "chkMatchWholeWord";
this.chkMatchWholeWord.Size = new System.Drawing.Size(113, 17);
this.chkMatchWholeWord.TabIndex = 12;
this.chkMatchWholeWord.Text = "Match whole word";
this.chkMatchWholeWord.UseVisualStyleBackColor = true;
this.chkMatchWholeWord.CheckedChanged += new System.EventHandler(this.chkMatchWholeWord_CheckedChanged);
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.searchTextBox);
this.panel1.Controls.Add(this.chkMatchCase);
this.panel1.Controls.Add(this.chkMatchWholeWord);
this.panel1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.panel1.Location = new System.Drawing.Point(0, 413);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(689, 27);
this.panel1.TabIndex = 13;
this.panel1.Visible = false;
//
// customRTB
//
this.customRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.customRTB.BackColor = System.Drawing.SystemColors.Window;
this.customRTB.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.customRTB.ContextMenuStrip = this.contextMenuStrip1;
this.customRTB.DetectUrls = false;
this.customRTB.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.customRTB.ForeColor = System.Drawing.SystemColors.WindowText;
this.customRTB.Location = new System.Drawing.Point(0, 24);
this.customRTB.Name = "customRTB";
this.customRTB.Size = new System.Drawing.Size(689, 416);
this.customRTB.TabIndex = 10;
this.customRTB.Text = "";
this.customRTB.SelectionChanged += new System.EventHandler(this.customRTB_SelectionChanged_1);
this.customRTB.TextChanged += new System.EventHandler(this.customRTB_TextChanged);
//
// MainWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(689, 461);
this.Controls.Add(this.panel1);
this.Controls.Add(this.customRTB);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.MainMenu);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.MainMenu;
this.MinimumSize = new System.Drawing.Size(500, 300);
this.Name = "MainWindow";
this.Text = "EncryptPad";
this.Activated += new System.EventHandler(this.MainWindow_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainWindow_FormClosing);
this.Load += new System.EventHandler(this.MainWindow_Load);
this.MainMenu.ResumeLayout(false);
this.MainMenu.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip MainMenu;
private System.Windows.Forms.ToolStripMenuItem файлToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem правкаToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem помощьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem сохранитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem выходToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem оПрограммеToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog OpenFile;
private System.Windows.Forms.SaveFileDialog SaveFile;
private System.Windows.Forms.ToolStripMenuItem создатьToolStripMenuItem;
private System.Windows.Forms.Button button1;
public System.Windows.Forms.Button button2;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripMenuItem сервисToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem очиститьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem открытьToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem сохранитьToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem выделитьВсеToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem вырезатьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem копироватьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem вставитьToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem УдалитьФайлToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem открытьРасположениеФайлаToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem переносПоСловамToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem отменитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem отменаToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripMenuItem вырезатьToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem копироватьToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem вставитьToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem удалитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem удалитьToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
private System.Windows.Forms.ToolStripMenuItem выделитьВсеToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
private System.Windows.Forms.ToolStripMenuItem порядокЧтенияСправаНалевоToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem очиститьToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
private System.Windows.Forms.ToolStripMenuItem changeKeyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem сheckForUpdatesToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel lineStripStatusLabel;
private System.Windows.Forms.ToolStripStatusLabel columnStripStatusLabel;
private System.Windows.Forms.ToolStripMenuItem documentationToolStripMenuItem;
private System.Windows.Forms.TextBox searchTextBox;
private System.Windows.Forms.CheckBox chkMatchCase;
private System.Windows.Forms.CheckBox chkMatchWholeWord;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
public CustomRichTextBox customRTB;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem2;
}
}

666
EncryptPad/Form1.cs Normal file
View file

@ -0,0 +1,666 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace EncryptPad
{
public partial class MainWindow : Form
{
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam);
public static string filename = "Unnamed.enp";
public static string key = "";
public static int textSave = 0;
public static string[] args = Environment.GetCommandLineArgs();
Properties.Settings ps = Properties.Settings.Default;
public MainWindow()
{
InitializeComponent();
}
void SaltMAC()
{
var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (var networkInterface in networkInterfaces)
{
if (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
var address = networkInterface.GetPhysicalAddress().ToString();
if (ps.FirstLaunch == false)
{
DialogResult res = new DialogResult();
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
res = MessageBox.Show("Get The Salt from mac address? (You can edit it by himself in Settings)", "The Salt",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
ps.TheSalt = address;
ps.FirstLaunch = true;
ps.Save();
}
}
}
}
}
private void открытьToolStripMenuItem_Click(object sender, EventArgs e)
{
int Cikil = 0;
try
{
if (OpenFile.ShowDialog() != DialogResult.OK) return;
{
string NameWithotPath = Path.GetFileName(OpenFile.FileName);
string opnfile = File.ReadAllText(OpenFile.FileName);
Form2 f2 = new Form2();
f2.ShowDialog();
if (Form2.formClosing == true)
{
return;
}
string de = AES.Decrypt(opnfile, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = de;
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (OpenFile.FileName);
}
}
catch
{
string NameWithotPath = Path.GetFileName(OpenFile.FileName);
string opnfile = File.ReadAllText(OpenFile.FileName, Encoding.Default);
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (OpenFile.FileName);
do
{
Cikil = 0;
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
DialogResult dialogResult = MessageBox.Show("Wrong key!", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
if (dialogResult == DialogResult.Retry)
{
Form2 Form2 = new Form2();
Form2.ShowDialog();
try
{
string de = AES.Decrypt(opnfile, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = de;
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (OpenFile.FileName);
}
catch
{
Cikil = 1;
}
}
if (dialogResult == DialogResult.Cancel)
{
toolStripStatusLabel1.Text = "Ready";
}
} while (Cikil == 1);
filename = OpenFile.FileName;
textSave = 0;
customRTB.Select(0, 0);
return;
}
filename = OpenFile.FileName;
textSave = 0;
customRTB.Select(0, 0);
}
private void openAsotiations()
{
Form2 Form2 = new Form2();
Form2.StartPosition = FormStartPosition.CenterScreen;
try
{
string NameWithotPath = Path.GetFileName(args[1]);
string opnfile = File.ReadAllText(args[1]);
Form2.ShowDialog();
if (Form2.formClosing == true)
{
return;
}
string de = AES.Decrypt(opnfile, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = de;
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (args[1]);
}
catch
{
string NameWithotPath = Path.GetFileName(args[1]);
string opnfile = File.ReadAllText(args[1]);
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (args[1]);
ComeHere:
DialogResult dialogResult = MessageBox.Show("Wrong key!", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
if (dialogResult == DialogResult.Retry)
{
Form2.ShowDialog();
try
{
string de = AES.Decrypt(opnfile, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = de;
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (args[1]);
}
catch
{
goto ComeHere;
}
}
if (dialogResult == DialogResult.Cancel)
{
Application.Exit();
}
}
filename = args[1];
textSave = 0;
customRTB.Select(0, 0);
}
private void новыйToolStripMenuItem_Click_1(object sender, EventArgs e)
{
customRTB.Clear();
Form2 Form2 = new Form2();
Form2.ShowDialog();
if (SaveFile.ShowDialog() != DialogResult.OK) return;
StreamWriter sw = new StreamWriter(SaveFile.FileName);
string NameWithotPath = Path.GetFileName(SaveFile.FileName);
toolStripStatusLabel1.Text = NameWithotPath;
toolStripStatusLabel1.ToolTipText = (SaveFile.FileName);
filename = SaveFile.FileName;
sw.Close();
}
private async void сохранитьToolStripMenuItem_Click(object sender, EventArgs e)
{
string NameWithotPath = Path.GetFileName(OpenFile.FileName);
if (string.IsNullOrEmpty(key))
{
Form2 Form2 = new Form2();
Form2.ShowDialog();
}
if (SaveFile.ShowDialog() != DialogResult.OK) return;
filename = SaveFile.FileName;
string noenc = customRTB.Text;
string en = AES.Encrypt(customRTB.Text, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = en;
StreamWriter sw = new StreamWriter(filename);
int i = customRTB.Lines.Count();
int j = 0;
i = i - 1;
while (j <= i)
{
sw.WriteLine(customRTB.Lines.GetValue(j).ToString());
j = j + 1;
}
sw.Close();
customRTB.Text = noenc;
toolStripStatusLabel1.Text = "Saved in: " + filename;
textSave = 0;
await Task.Delay(4000);
toolStripStatusLabel1.Text = "Ready";
}
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
ps.TopPosition = this.Top;
ps.LeftPosition = this.Left;
ps.FormWidth = this.Width;
ps.FormHeight = this.Height;
ps.MenuWrap = переносПоСловамToolStripMenuItem.Checked;
ps.RichWrap = customRTB.WordWrap;
ps.Save();
if (textSave == 1)
{
string f = "Unnamed.enp";
if (customRTB.Text != "")
{
DialogResult res = new DialogResult();
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
res = MessageBox.Show("Save changes in:\n" + filename + " ?",
"",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
if (filename == f)
{
SaveFile.FileName = f;
сохранитьToolStripMenuItem_Click(this, new EventArgs());
}
if (filename != f)
{
сохранитьToolStripMenuItem1_Click_1(this, new EventArgs());
}
Environment.Exit(0);
}
try
{
if (res == DialogResult.No)
{
Environment.Exit(0);
}
if (res == DialogResult.Cancel)
{
e.Cancel = true;
}
}
catch (Exception)
{
}
}
}
}
void LineAndColumn()
{
int line = customRTB.GetLineFromCharIndex(customRTB.SelectionStart);
int column = customRTB.SelectionStart - customRTB.GetFirstCharIndexFromLine(line);
line += 1;
column += 1;
lineStripStatusLabel.Text = "Line: " + line.ToString();
columnStripStatusLabel.Text = "Column: " + column.ToString();
}
private void MainWindow_Load(object sender, EventArgs e)
{
this.Top = ps.TopPosition;
this.Left = ps.LeftPosition;
this.Width = ps.FormWidth;
this.Height = ps.FormHeight;
customRTB.Font = new Font(ps.RichTextFont, ps.RichTextSize);
customRTB.ForeColor = ps.RichForeColor;
customRTB.BackColor = ps.RichBackColor;
переносПоСловамToolStripMenuItem.Checked = ps.MenuWrap;
customRTB.WordWrap = ps.RichWrap;
customRTB.SelectionIndent += 6;
customRTB.SelectionRightIndent += 7;
LineAndColumn();
if (args.Length > 1)
{
openAsotiations();
}
SaltMAC();
}
private void очиститьToolStripMenuItem_Click(object sender, EventArgs e)
{
customRTB.Clear();
}
private async void сохранитьToolStripMenuItem1_Click_1(object sender, EventArgs e)
{
string f = "Unnamed.enp";
string NameWithotPath = Path.GetFileName(OpenFile.FileName);
if (filename == f)
{
SaveFile.FileName = f;
сохранитьToolStripMenuItem_Click(this, new EventArgs());
}
string noenc = customRTB.Text;
string en = AES.Encrypt(customRTB.Text, key, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, "16CHARSLONG12345", ps.KeySize);
customRTB.Text = en;
StreamWriter sw = new StreamWriter(filename);
int i = customRTB.Lines.Count();
int j = 0;
i = i - 1;
while (j <= i)
{
sw.WriteLine(customRTB.Lines.GetValue(j).ToString());
j = j + 1;
}
sw.Close();
customRTB.Text = noenc;
toolStripStatusLabel1.Text = "Saved in: " + filename;
await Task.Delay(4000);
toolStripStatusLabel1.Text = "Ready";
textSave = 0;
}
private void выходToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void выделитьВсеToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customRTB.Focused == true)
customRTB.SelectAll();
else searchTextBox.SelectAll();
}
private void вырезатьToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customRTB.Focused == true)
customRTB.Cut();
else
searchTextBox.Cut();
}
private void копироватьToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customRTB.Focused == true)
customRTB.Copy();
else
searchTextBox.Copy();
}
private void вставитьToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customRTB.Focused == true)
customRTB.Paste(DataFormats.GetFormat(DataFormats.Text));
else
searchTextBox.Paste();
}
private void правкаToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)
{
if (customRTB.SelectionLength != 0)
{
вырезатьToolStripMenuItem.Enabled = true;
копироватьToolStripMenuItem.Enabled = true;
удалитьToolStripMenuItem.Enabled = true;
}
if (customRTB.SelectionLength == 0)
{
вырезатьToolStripMenuItem.Enabled = false;
копироватьToolStripMenuItem.Enabled = false;
удалитьToolStripMenuItem.Enabled = false;
}
}
private void УдалитьФайлToolStripMenuItem_Click_1(object sender, EventArgs e)
{
if (filename != "Unnamed.enp")
{
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
if (MessageBox.Show("Delete file: " + filename + " ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
File.Delete(filename);
toolStripStatusLabel1.Text = filename + " deleted";
customRTB.Clear();
}
}
if (filename == "Unnamed.enp")
{
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
MessageBox.Show("No open files", "", MessageBoxButtons.OK, MessageBoxIcon.Question);
}
}
private void открытьРасположениеФайлаToolStripMenuItem_Click(object sender, EventArgs e)
{
if (filename != "Unnamed.enp")
{
System.Diagnostics.Process.Start("explorer.exe", @"/select, " + filename);
}
if (filename == "Unnamed.enp")
{
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
MessageBox.Show("No open files", "", MessageBoxButtons.OK, MessageBoxIcon.Question);
}
}
private void переносПоСловамToolStripMenuItem_Click(object sender, EventArgs e)
{
if (переносПоСловамToolStripMenuItem.Checked == true)
{
customRTB.WordWrap = true;
}
if (переносПоСловамToolStripMenuItem.Checked == false)
{
customRTB.WordWrap = false;
}
}
private void отменитьToolStripMenuItem_Click(object sender, EventArgs e)
{
отменаToolStripMenuItem_Click(this, new EventArgs());
}
public void отменаToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customRTB.CanUndo == true)
{
customRTB.Undo();
}
else customRTB.Redo();
}
private void вырезатьToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.Cut();
}
private void копироватьToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.Copy();
}
private void вставитьToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.Paste(DataFormats.GetFormat(DataFormats.Text));
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
if (customRTB.SelectionLength != 0)
{
вырезатьToolStripMenuItem1.Enabled = true;
копироватьToolStripMenuItem1.Enabled = true;
удалитьToolStripMenuItem1.Enabled = true;
}
if (customRTB.SelectionLength == 0)
{
вырезатьToolStripMenuItem1.Enabled = false;
копироватьToolStripMenuItem1.Enabled = false;
удалитьToolStripMenuItem1.Enabled = false;
}
}
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
{
customRTB.SelectedText = "";
}
private void удалитьToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.SelectedText = "";
}
private void порядокЧтенияСправаНалевоToolStripMenuItem_Click(object sender, EventArgs e)
{
if (порядокЧтенияСправаНалевоToolStripMenuItem.Checked == true)
{
customRTB.RightToLeft = RightToLeft.Yes;
}
if (порядокЧтенияСправаНалевоToolStripMenuItem.Checked == false)
{
customRTB.RightToLeft = RightToLeft.No;
}
}
private void очиститьToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.Clear();
}
private void оПрограммеToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
MessageBox.Show("EncryptPad v0.1 \nBuilt on MVSC 2015\nDeveloped by Sigmanor", "",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void выделитьВсеToolStripMenuItem1_Click(object sender, EventArgs e)
{
customRTB.SelectAll();
}
private void changeKeyToolStripMenuItem_Click(object sender, EventArgs e)
{
}
public int FindMyTextNext(string text, int start)
{
int returnValue = -1;
if (text.Length > 0 && start >= 0)
{
int indexToText = customRTB.Find(text, start, RichTextBoxFinds.MatchCase);
if (indexToText >= 0)
{
returnValue = indexToText;
}
}
return returnValue;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
bool isexist = customRTB.Highlight(searchTextBox.Text, ps.HighlightsColor, chkMatchCase.Checked, chkMatchWholeWord.Checked);
}
private void searchTextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
searchTextBox.Text = "";
panel1.Visible = false;
customRTB.Height = customRTB.Height += 27;
customRTB.Focus();
customRTB.DeselectAll();
e.Handled = e.SuppressKeyPress = true;
}
}
private void customRTB_SelectionChanged_1(object sender, EventArgs e)
{
LineAndColumn();
}
private void customRTB_TextChanged(object sender, EventArgs e)
{
textSave = 1;
LineAndColumn();
}
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
SettingsForm sf = new SettingsForm();
sf.StartPosition = FormStartPosition.Manual;
sf.Location = new Point(this.Location.X + (this.Width - sf.Width) / 2, this.Location.Y + (this.Height - sf.Height) / 2);
sf.ShowDialog(this);
}
private void MainWindow_Activated(object sender, EventArgs e)
{
customRTB.Font = new Font(ps.RichTextFont, ps.RichTextSize);
customRTB.ForeColor = ps.RichForeColor;
customRTB.BackColor = ps.RichBackColor;
}
private void chkMatchCase_CheckedChanged(object sender, EventArgs e)
{
bool isexist = customRTB.Highlight(searchTextBox.Text, ps.HighlightsColor, chkMatchCase.Checked, chkMatchWholeWord.Checked);
}
private void chkMatchWholeWord_CheckedChanged(object sender, EventArgs e)
{
bool isexist = customRTB.Highlight(searchTextBox.Text, ps.HighlightsColor, chkMatchCase.Checked, chkMatchWholeWord.Checked);
}
private void pictureBox1_Click(object sender, EventArgs e)
{
searchTextBox.Text = "";
panel1.Visible = false;
customRTB.Height = customRTB.Height += 27;
customRTB.Focus();
SendMessage(customRTB.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(1));
customRTB.DeselectAll();
}
private void findToolStripMenuItem2_Click(object sender, EventArgs e)
{
if (panel1.Visible == false)
{
panel1.Visible = true;
searchTextBox.Focus();
SendMessage(customRTB.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1));
customRTB.Height = customRTB.Height - 27;
return;
}
if (panel1.Visible == true)
{
searchTextBox.Text = "";
panel1.Visible = false;
customRTB.Height = customRTB.Height += 27;
customRTB.Focus();
SendMessage(customRTB.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(1));
customRTB.DeselectAll();
}
}
private void documentationToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}

2453
EncryptPad/Form1.resx Normal file

File diff suppressed because it is too large Load diff

97
EncryptPad/Form2.Designer.cs generated Normal file
View file

@ -0,0 +1,97 @@
namespace EncryptPad
{
partial class Form2
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(156, 20);
this.textBox1.TabIndex = 0;
this.textBox1.UseSystemPasswordChar = true;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
//
// button1
//
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(12, 38);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(168, 6);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(32, 32);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(200, 69);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form2";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Encryption key";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

53
EncryptPad/Form2.cs Normal file
View file

@ -0,0 +1,53 @@
using System;
using System.Windows.Forms;
namespace EncryptPad
{
public partial class Form2 : Form
{
public static bool formClosing = false;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MainWindow.key = textBox1.Text;
textBox1.Focus();
textBox1.Text = "";
this.Hide();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text.Length > 0)
button1.Enabled = true;
else
button1.Enabled = false;
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
button1_Click(sender, e);
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (textBox1.UseSystemPasswordChar == true)
{
textBox1.UseSystemPasswordChar = false;
return;
}
if (textBox1.UseSystemPasswordChar == false)
{
textBox1.UseSystemPasswordChar = true;
return;
}
}
}
}

133
EncryptPad/Form2.resx Normal file
View file

@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAZdJREFUWEft
lD1Iw1AUhYtkkE5SHEqnTk4OIp1EHE36l6aBttSSxoJ1KElHpy4ZnBwdnZwcnJxExKE4FhERBxEHBwfp
6FBESj0vnEyO5nXxffAIOblw7k/uSygUCkXc9Ho9rd/va3ydL51OZ7FYLF6USqXTwWCwQHk+uK6bhPm1
ruszcSzL2uUn+TiOs1QoFG4jcyRyn8/n3+r1epYh8mg2m8swH9F8CuNXJHBTLpfP8HxgmBwajUYaho+R
eaVS2W+1WikYD1H9eq1WW2Xo3/A8TzNN00Old4ZhfOD5hAoPYf5C82/MfIfh8SLWChVd0ujXQUJfMLcY
Hj+o9IBmU6zXMTphQgtgPBE6tHOGygHtDtsM0yNKIchjjx2Y+L6fpBw/mHPY6mq1ukkpBKNJC12cdru9
Qjl+0IGxMBEVUwqxbXuLCUy73W6KcvxgxifCCK0ew3Q7CAIN65VDZ56FjgSHDJUDdj0Ds3dWO4tGwqQ+
kdQaQ+WBirNYxavIWBxUPoJ5jiHzAT9bBjfcBm47+Xe8QqH4JyQSP8mesSKSooDOAAAAAElFTkSuQmCC
</value>
</data>
</root>

View file

@ -0,0 +1,83 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
internal static class MessageBoxCenter
{
internal static void PrepToCenterMessageBoxOnForm(Form form)
{
MessageBoxCenterHelper helper = new MessageBoxCenterHelper();
helper.Prep(form);
}
private class MessageBoxCenterHelper
{
private int messageHook;
private IntPtr parentFormHandle;
public void Prep(Form form)
{
NativeMethods.CenterMessageCallBackDelegate callBackDelegate = new NativeMethods.CenterMessageCallBackDelegate(CenterMessageCallBack);
GCHandle.Alloc(callBackDelegate);
parentFormHandle = form.Handle;
messageHook = NativeMethods.SetWindowsHookEx(5, callBackDelegate, new IntPtr(NativeMethods.GetWindowLong(parentFormHandle, -6)), NativeMethods.GetCurrentThreadId()).ToInt32();
}
private int CenterMessageCallBack(int message, int wParam, int lParam)
{
NativeMethods.RECT formRect;
NativeMethods.RECT messageBoxRect;
int xPos;
int yPos;
if (message == 5)
{
NativeMethods.GetWindowRect(parentFormHandle, out formRect);
NativeMethods.GetWindowRect(new IntPtr(wParam), out messageBoxRect);
xPos = (int)((formRect.Left + (formRect.Right - formRect.Left) / 2) - ((messageBoxRect.Right - messageBoxRect.Left) / 2));
yPos = (int)((formRect.Top + (formRect.Bottom - formRect.Top) / 2) - ((messageBoxRect.Bottom - messageBoxRect.Top) / 2));
NativeMethods.SetWindowPos(wParam, 0, xPos, yPos, 0, 0, 0x1 | 0x4 | 0x10);
NativeMethods.UnhookWindowsHookEx(messageHook);
}
return 0;
}
}
private static class NativeMethods
{
internal struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
internal delegate int CenterMessageCallBackDelegate(int message, int wParam, int lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool UnhookWindowsHookEx(int hhk);
[DllImport("user32.dll", SetLastError = true)]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("kernel32.dll")]
internal static extern int GetCurrentThreadId();
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr SetWindowsHookEx(int hook, CenterMessageCallBackDelegate callback, IntPtr hMod, int dwThreadId);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SetWindowPos(int hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
}
}

View file

@ -0,0 +1,245 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Configuration.Provider;
using System.Windows.Forms;
using System.Collections.Specialized;
using Microsoft.Win32;
using System.Xml;
using System.IO;
public class PortableSettingsProvider : SettingsProvider
{
const string SETTINGSROOT = "Settings";
//XML Root Node
public override void Initialize(string name, NameValueCollection col)
{
base.Initialize(this.ApplicationName, col);
}
public override string ApplicationName
{
get
{
if (Application.ProductName.Trim().Length > 0)
{
return Application.ProductName;
}
else
{
FileInfo fi = new FileInfo(Application.ExecutablePath);
return fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
}
}
set
{
}
//Do nothing
}
public override string Name
{
get
{
return "PortableSettingsProvider";
}
}
public virtual string GetAppSettingsPath()
{
//Used to determine where to store the settings
System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath);
return fi.DirectoryName;
}
public virtual string GetAppSettingsFilename()
{
//Used to determine the filename to store the settings
return ApplicationName + ".settings";
}
public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
{
//Iterate through the settings to be stored
//Only dirty settings are included in propvals, and only ones relevant to this provider
foreach (SettingsPropertyValue propval in propvals)
{
SetValue(propval);
}
try
{
SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
}
catch (Exception)
{
}
//Ignore if cant save, device been ejected
}
public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props)
{
//Create new collection of values
SettingsPropertyValueCollection values = new SettingsPropertyValueCollection();
//Iterate through the settings to be retrieved
foreach (SettingsProperty setting in props)
{
SettingsPropertyValue value = new SettingsPropertyValue(setting);
value.IsDirty = false;
value.SerializedValue = GetValue(setting);
values.Add(value);
}
return values;
}
private XmlDocument _settingsXML = null;
private XmlDocument SettingsXML
{
get
{
//If we dont hold an xml document, try opening one.
//If it doesnt exist then create a new one ready.
if (_settingsXML == null)
{
_settingsXML = new XmlDocument();
try
{
_settingsXML.Load(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
}
catch (Exception)
{
//Create new document
XmlDeclaration dec = _settingsXML.CreateXmlDeclaration("1.0", "utf-8", string.Empty);
_settingsXML.AppendChild(dec);
XmlNode nodeRoot = default(XmlNode);
nodeRoot = _settingsXML.CreateNode(XmlNodeType.Element, SETTINGSROOT, "");
_settingsXML.AppendChild(nodeRoot);
}
}
return _settingsXML;
}
}
private string GetValue(SettingsProperty setting)
{
string ret = "";
try
{
if (IsRoaming(setting))
{
ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + setting.Name).InnerText;
}
else
{
ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + "Parameters" + "/" + setting.Name).InnerText;
}
}
catch (Exception)
{
if ((setting.DefaultValue != null))
{
ret = setting.DefaultValue.ToString();
}
else
{
ret = "";
}
}
return ret;
}
private void SetValue(SettingsPropertyValue propVal)
{
XmlElement MachineNode = default(XmlElement);
XmlElement SettingNode = default(XmlElement);
//Determine if the setting is roaming.
//If roaming then the value is stored as an element under the root
//Otherwise it is stored under a machine name node
try
{
if (IsRoaming(propVal.Property))
{
SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + propVal.Name);
}
else
{
SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + "Parameters" + "/" + propVal.Name);
}
}
catch (Exception)
{
SettingNode = null;
}
//Check to see if the node exists, if so then set its new value
if ((SettingNode != null))
{
SettingNode.InnerText = propVal.SerializedValue.ToString();
}
else
{
if (IsRoaming(propVal.Property))
{
//Store the value as an element of the Settings Root Node
SettingNode = SettingsXML.CreateElement(propVal.Name);
SettingNode.InnerText = propVal.SerializedValue.ToString();
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(SettingNode);
}
else
{
//Its machine specific, store as an element of the machine name node,
//creating a new machine name node if one doesnt exist.
try
{
MachineNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + "Parameters");
}
catch (Exception)
{
MachineNode = SettingsXML.CreateElement("Parameters");
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode);
}
if (MachineNode == null)
{
MachineNode = SettingsXML.CreateElement("Parameters");
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode);
}
SettingNode = SettingsXML.CreateElement(propVal.Name);
SettingNode.InnerText = propVal.SerializedValue.ToString();
MachineNode.AppendChild(SettingNode);
}
}
}
private bool IsRoaming(SettingsProperty prop)
{
//Determine if the setting is marked as Roaming
foreach (DictionaryEntry d in prop.Attributes)
{
Attribute a = (Attribute)d.Value;
if (a is System.Configuration.SettingsManageabilityAttribute)
{
return true;
}
}
return false;
}
}

22
EncryptPad/Program.cs Normal file
View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace EncryptPad
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("EncryptPad")]
[assembly: AssemblyDescription("Simple editor with encryption features")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EncryptPad")]
[assembly: AssemblyCopyright("Sigmanor")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("969df047-1cd0-4744-aeed-8d8877b6c909")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EncryptPad.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[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>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </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("EncryptPad.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View 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>

245
EncryptPad/Properties/Settings.Designer.cs generated Normal file
View file

@ -0,0 +1,245 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EncryptPad.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.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int TopPosition {
get {
return ((int)(this["TopPosition"]));
}
set {
this["TopPosition"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int LeftPosition {
get {
return ((int)(this["LeftPosition"]));
}
set {
this["LeftPosition"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Consolas")]
public string RichTextFont {
get {
return ((string)(this["RichTextFont"]));
}
set {
this["RichTextFont"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("228, 228, 228")]
public global::System.Drawing.Color RichForeColor {
get {
return ((global::System.Drawing.Color)(this["RichForeColor"]));
}
set {
this["RichForeColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("687")]
public int FormWidth {
get {
return ((int)(this["FormWidth"]));
}
set {
this["FormWidth"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("428")]
public int FormHeight {
get {
return ((int)(this["FormHeight"]));
}
set {
this["FormHeight"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("56, 56, 56")]
public global::System.Drawing.Color RichBackColor {
get {
return ((global::System.Drawing.Color)(this["RichBackColor"]));
}
set {
this["RichBackColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool MenuWrap {
get {
return ((bool)(this["MenuWrap"]));
}
set {
this["MenuWrap"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool RichWrap {
get {
return ((bool)(this["RichWrap"]));
}
set {
this["RichWrap"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("11")]
public int RichTextSize {
get {
return ((int)(this["RichTextSize"]));
}
set {
this["RichTextSize"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("101, 51, 6")]
public global::System.Drawing.Color HighlightsColor {
get {
return ((global::System.Drawing.Color)(this["HighlightsColor"]));
}
set {
this["HighlightsColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool AssociateCheck {
get {
return ((bool)(this["AssociateCheck"]));
}
set {
this["AssociateCheck"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SHA1")]
public string HashAlgorithm {
get {
return ((string)(this["HashAlgorithm"]));
}
set {
this["HashAlgorithm"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("192")]
public int KeySize {
get {
return ((int)(this["KeySize"]));
}
set {
this["KeySize"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string TheSalt {
get {
return ((string)(this["TheSalt"]));
}
set {
this["TheSalt"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2")]
public int PasswordIterations {
get {
return ((int)(this["PasswordIterations"]));
}
set {
this["PasswordIterations"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool FirstLaunch {
get {
return ((bool)(this["FirstLaunch"]));
}
set {
this["FirstLaunch"] = value;
}
}
}
}

View file

@ -0,0 +1,57 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="EncryptPad.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="TopPosition" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LeftPosition" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="RichTextFont" Provider="PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)">Consolas</Value>
</Setting>
<Setting Name="RichForeColor" Provider="PortableSettingsProvider" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">228, 228, 228</Value>
</Setting>
<Setting Name="FormWidth" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">687</Value>
</Setting>
<Setting Name="FormHeight" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">428</Value>
</Setting>
<Setting Name="RichBackColor" Provider="PortableSettingsProvider" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">56, 56, 56</Value>
</Setting>
<Setting Name="MenuWrap" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="RichWrap" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="RichTextSize" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">11</Value>
</Setting>
<Setting Name="HighlightsColor" Provider="PortableSettingsProvider" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">101, 51, 6</Value>
</Setting>
<Setting Name="AssociateCheck" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="HashAlgorithm" Provider="PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)">SHA1</Value>
</Setting>
<Setting Name="KeySize" Provider="PortableSettingsProvider" Type="System.Int32" Scope="User">
<Value Profile="(Default)">192</Value>
</Setting>
<Setting Name="TheSalt" Provider="PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="PasswordIterations" Type="System.Int32" Scope="User">
<Value Profile="(Default)">2</Value>
</Setting>
<Setting Name="FirstLaunch" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

399
EncryptPad/SettingsForm.Designer.cs generated Normal file
View file

@ -0,0 +1,399 @@
namespace EncryptPad
{
partial class SettingsForm
{
/// <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.BackgroundColorLabel = new System.Windows.Forms.Label();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.saveSettingsButton = new System.Windows.Forms.Button();
this.fontLabel = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.panel3 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.comboBox3 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.comboBox4 = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// BackgroundColorLabel
//
this.BackgroundColorLabel.AutoSize = true;
this.BackgroundColorLabel.Location = new System.Drawing.Point(7, 86);
this.BackgroundColorLabel.Name = "BackgroundColorLabel";
this.BackgroundColorLabel.Size = new System.Drawing.Size(58, 13);
this.BackgroundColorLabel.TabIndex = 0;
this.BackgroundColorLabel.Text = "Font Color:";
//
// colorDialog1
//
this.colorDialog1.AnyColor = true;
this.colorDialog1.FullOpen = true;
//
// saveSettingsButton
//
this.saveSettingsButton.Location = new System.Drawing.Point(183, 225);
this.saveSettingsButton.Name = "saveSettingsButton";
this.saveSettingsButton.Size = new System.Drawing.Size(75, 23);
this.saveSettingsButton.TabIndex = 2;
this.saveSettingsButton.Text = "Save";
this.saveSettingsButton.UseVisualStyleBackColor = true;
this.saveSettingsButton.Click += new System.EventHandler(this.saveSettingsButton_Click);
//
// fontLabel
//
this.fontLabel.AutoSize = true;
this.fontLabel.Location = new System.Drawing.Point(7, 18);
this.fontLabel.Name = "fontLabel";
this.fontLabel.Size = new System.Drawing.Size(62, 13);
this.fontLabel.TabIndex = 1;
this.fontLabel.Text = "Font Name:";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(2, 2);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(260, 218);
this.tabControl1.TabIndex = 4;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.panel3);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.comboBox2);
this.tabPage1.Controls.Add(this.label2);
this.tabPage1.Controls.Add(this.label1);
this.tabPage1.Controls.Add(this.panel2);
this.tabPage1.Controls.Add(this.panel1);
this.tabPage1.Controls.Add(this.comboBox1);
this.tabPage1.Controls.Add(this.fontLabel);
this.tabPage1.Controls.Add(this.BackgroundColorLabel);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(252, 192);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Fonts and Colors";
this.tabPage1.UseVisualStyleBackColor = true;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Cursor = System.Windows.Forms.Cursors.Hand;
this.panel3.Location = new System.Drawing.Point(136, 151);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(100, 21);
this.panel3.TabIndex = 12;
this.panel3.Click += new System.EventHandler(this.panel3_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(7, 154);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(83, 13);
this.label3.TabIndex = 11;
this.label3.Text = "Highlights Color:";
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"8",
"9",
"10",
"11",
"12",
"14",
"16",
"18",
"20",
"22",
"24",
"26",
"28",
"36",
"48",
"72"});
this.comboBox2.Location = new System.Drawing.Point(136, 49);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(100, 21);
this.comboBox2.TabIndex = 6;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(95, 13);
this.label2.TabIndex = 10;
this.label2.Text = "Background Color:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 52);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 9;
this.label1.Text = "Font Size:";
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Cursor = System.Windows.Forms.Cursors.Hand;
this.panel2.Location = new System.Drawing.Point(136, 117);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(100, 21);
this.panel2.TabIndex = 8;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Cursor = System.Windows.Forms.Cursors.Hand;
this.panel1.Location = new System.Drawing.Point(136, 83);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(100, 21);
this.panel1.TabIndex = 7;
this.panel1.Click += new System.EventHandler(this.panel1_Click_1);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(136, 15);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(100, 21);
this.comboBox1.TabIndex = 5;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.textBox2);
this.tabPage2.Controls.Add(this.label7);
this.tabPage2.Controls.Add(this.comboBox4);
this.tabPage2.Controls.Add(this.textBox1);
this.tabPage2.Controls.Add(this.comboBox3);
this.tabPage2.Controls.Add(this.label6);
this.tabPage2.Controls.Add(this.label5);
this.tabPage2.Controls.Add(this.label4);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(252, 192);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Encrypt/Decrypt";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.checkBox2);
this.tabPage3.Controls.Add(this.checkBox1);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(252, 192);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Application";
this.tabPage3.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Enabled = false;
this.checkBox2.Location = new System.Drawing.Point(7, 47);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(120, 17);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "Auto Check Update";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(7, 18);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(224, 17);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "Associate EncryptPad with .enp extension";
this.checkBox1.UseVisualStyleBackColor = true;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 18);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(84, 13);
this.label4.TabIndex = 0;
this.label4.Text = "Hash Algorithm: ";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(7, 52);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(51, 13);
this.label5.TabIndex = 1;
this.label5.Text = "Key Size:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(7, 86);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(50, 13);
this.label6.TabIndex = 2;
this.label6.Text = "The Salt:";
//
// comboBox3
//
this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox3.FormattingEnabled = true;
this.comboBox3.Items.AddRange(new object[] {
"128",
"192",
"256"});
this.comboBox3.Location = new System.Drawing.Point(136, 49);
this.comboBox3.Name = "comboBox3";
this.comboBox3.Size = new System.Drawing.Size(100, 21);
this.comboBox3.TabIndex = 3;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(136, 83);
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 4;
//
// comboBox4
//
this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox4.FormattingEnabled = true;
this.comboBox4.Items.AddRange(new object[] {
"SHA1",
"MD5"});
this.comboBox4.Location = new System.Drawing.Point(136, 15);
this.comboBox4.Name = "comboBox4";
this.comboBox4.Size = new System.Drawing.Size(100, 21);
this.comboBox4.TabIndex = 5;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(7, 120);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(102, 13);
this.label7.TabIndex = 6;
this.label7.Text = "Password Iterations:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(136, 117);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 7;
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(263, 254);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.saveSettingsButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Settings";
this.TopMost = true;
this.Load += new System.EventHandler(this.SettingsForm_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label BackgroundColorLabel;
private System.Windows.Forms.Button saveSettingsButton;
private System.Windows.Forms.Label fontLabel;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.ComboBox comboBox3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboBox4;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label7;
}
}

113
EncryptPad/SettingsForm.cs Normal file
View file

@ -0,0 +1,113 @@
using Microsoft.Win32;
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace EncryptPad
{
public partial class SettingsForm : Form
{
Properties.Settings ps = Properties.Settings.Default;
MainWindow ma = new MainWindow();
public SettingsForm()
{
InitializeComponent();
}
private void SettingsForm_Load(object sender, EventArgs e)
{
foreach (FontFamily fonts in FontFamily.Families)
{
comboBox1.Items.Add(fonts.Name);
}
comboBox1.Text = ps.RichTextFont;
comboBox2.Text = ps.RichTextSize.ToString();
comboBox4.Text = ps.HashAlgorithm;
comboBox3.Text = ps.KeySize.ToString();
textBox1.Text = ps.TheSalt;
textBox2.Text = ps.PasswordIterations.ToString();
checkBox1.Checked = ps.AssociateCheck;
panel1.BackColor = ps.RichForeColor;
panel2.BackColor = ps.RichBackColor;
panel3.BackColor = ps.HighlightsColor;
}
private void saveSettingsButton_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
AssociateExtension(Assembly.GetEntryAssembly().Location, "enp");
}
if (checkBox1.Checked == false)
{
DissociateExtension(Assembly.GetEntryAssembly().Location, "enp");
}
ps.RichForeColor = panel1.BackColor;
ps.RichBackColor = panel2.BackColor;
ps.HighlightsColor = panel3.BackColor;
ps.RichTextFont = comboBox1.Text;
ps.RichTextSize = Convert.ToInt32(comboBox2.Text.ToString());
ps.AssociateCheck = checkBox1.Checked;
ps.HashAlgorithm = comboBox4.Text;
ps.KeySize = Convert.ToInt32(comboBox3.Text.ToString());
ps.TheSalt = textBox1.Text;
ps.PasswordIterations = Convert.ToInt32(textBox2.Text.ToString());
ps.Save();
this.Hide();
}
public static void AssociateExtension(string applicationExecutablePath, string extension)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Classes", true);
key.CreateSubKey("." + extension).SetValue(string.Empty, extension + "_auto_file");
key = key.CreateSubKey(extension + "_auto_file");
key.CreateSubKey("DefaultIcon").SetValue(string.Empty, Path.GetDirectoryName(Application.ExecutablePath) + "\\EncryptPad.exe" + ",0");
key = key.CreateSubKey("Shell");
key.SetValue(string.Empty, "Open");
key = key.CreateSubKey("Open");
key.CreateSubKey("Command").SetValue(string.Empty, "\"" + applicationExecutablePath + "\" \"%1\"");
key.CreateSubKey("ddeexec\\Topic").SetValue(string.Empty, "System");
}
public static void DissociateExtension(string applicationExecutablePath, string extension)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Classes", true);
key.DeleteSubKeyTree(extension + "_auto_file");
key.DeleteSubKeyTree("." + extension);
}
private void panel1_Click_1(object sender, EventArgs e)
{
colorDialog1.Color = panel1.BackColor;
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
colorDialog1.ShowDialog();
panel1.BackColor = colorDialog1.Color;
}
private void panel2_Click(object sender, EventArgs e)
{
colorDialog1.Color = panel2.BackColor;
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
colorDialog1.ShowDialog();
panel2.BackColor = colorDialog1.Color;
}
private void panel3_Click(object sender, EventArgs e)
{
colorDialog1.Color = panel3.BackColor;
MessageBoxCenter.PrepToCenterMessageBoxOnForm(this);
colorDialog1.ShowDialog();
panel3.BackColor = colorDialog1.Color;
}
}
}

View file

@ -0,0 +1,123 @@
<?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>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

BIN
EncryptPad/locked.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB