Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2984 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
27 changed files with 4873 additions and 143 deletions
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00 |
||||
# Visual Studio 2008 |
||||
# SharpDevelop 3.0.0.2956 |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HexEditor", "Project\HexEditor.csproj", "{E618A9CD-A39F-4925-A538-E8A3FEF24E54}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
EndGlobalSection |
||||
EndGlobal |
||||
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System.Reflection; |
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("HexEditor")] |
||||
[assembly: AssemblyDescription("SharpDevelop Hex Editor AddIn")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
<AddIn name = "HexEditor" |
||||
author = "Siegfried Pammer" |
||||
url = "" |
||||
description = "Hexadecimal Editor DisplayBinding"> |
||||
|
||||
<Manifest> |
||||
<Identity name="SiegfriedPammer.HexEditor" version="0.0.2" /> |
||||
<Dependency addin="SharpDevelop" version="3.0"/> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly = "HexEditor.dll"/> |
||||
<Import assembly = ":ICSharpCode.SharpDevelop"/> |
||||
</Runtime> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/DisplayBindings"> |
||||
<DisplayBinding id = "HexEditor" |
||||
insertbefore = "Text" |
||||
supportedformats = "Binaries" |
||||
title = "Hex editor" |
||||
class = "HexEditor.View.HexEditDisplayBinding"/> |
||||
</Path> |
||||
|
||||
<!-- <Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions"> |
||||
<DialogPanel id = "HexEditor" |
||||
label = "HexEditor" |
||||
class = "HexEditor.View.HexEditOptionsPanel"/> |
||||
</Path> --> |
||||
|
||||
<!-- Right click menu --> |
||||
<Path name = "/AddIns/HexEditor/Editor/ContextMenu"> |
||||
<Include id = "Cut" item = "/SharpDevelop/Workbench/MainMenu/Edit/Cut"/> |
||||
<Include id = "Copy" item = "/SharpDevelop/Workbench/MainMenu/Edit/Copy"/> |
||||
<Include id = "Paste" item = "/SharpDevelop/Workbench/MainMenu/Edit/Paste"/> |
||||
<Include id = "Delete" item = "/SharpDevelop/Workbench/MainMenu/Edit/Delete"/> |
||||
<MenuItem id = "Separator1" type = "Separator"/> |
||||
<Include id = "SelectAll" item="/SharpDevelop/Workbench/MainMenu/Edit/SelectAll"/> |
||||
<MenuItem id = "Separator1" type = "Separator"/> |
||||
<MenuItem id = "Save" |
||||
label = "${res:XML.MainMenu.FileMenu.Save}" |
||||
icon = "Icons.16x16.SaveIcon" |
||||
shortcut = "Control|S" |
||||
class = "ICSharpCode.SharpDevelop.Commands.SaveFile"/> |
||||
<MenuItem id = "SaveAs" |
||||
label = "${res:XML.MainMenu.FileMenu.SaveAs}" |
||||
class = "ICSharpCode.SharpDevelop.Commands.SaveFileAs"/> |
||||
<MenuItem id = "Separator1" type = "Separator"/> |
||||
<MenuItem id = "Close" |
||||
label = "${res:XML.MainMenu.FileMenu.Close}" |
||||
class = "ICSharpCode.SharpDevelop.Commands.CloseFile"/> |
||||
</Path> |
||||
|
||||
<!-- File extensions that will be opened in the Hex Editor --> |
||||
<Path name = "/AddIns/HexEditor/Editor"> |
||||
<String id = "SupportedFileExtensions" text = ".exe;.dll"/> |
||||
</Path> |
||||
</AddIn> |
||||
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{E618A9CD-A39F-4925-A538-E8A3FEF24E54}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>HexEditor</RootNamespace> |
||||
<AssemblyName>HexEditor</AssemblyName> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
||||
<SignAssembly>True</SignAssembly> |
||||
<DelaySign>False</DelaySign> |
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<FileUpgradeFlags> |
||||
</FileUpgradeFlags> |
||||
<OldToolsVersion>2.0</OldToolsVersion> |
||||
<UpgradeBackupLocation> |
||||
</UpgradeBackupLocation> |
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\HexEditor</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
<StartAction>Program</StartAction> |
||||
<StartProgram>..\..\..\..\bin\SharpDevelop.exe</StartProgram> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\HexEditor</OutputPath> |
||||
<DebugSymbols>false</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\HexEditControl.cs"> |
||||
<SubType>UserControl</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\HexEditControl.Designer.cs"> |
||||
<DependentUpon>HexEditControl.cs</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\Util\BufferManager.cs" /> |
||||
<Compile Include="Src\Util\Caret.cs" /> |
||||
<Compile Include="Src\Util\ClipboardManager.cs" /> |
||||
<Compile Include="Src\Util\NativeMethods.cs" /> |
||||
<Compile Include="Src\Util\UndoAction.cs" /> |
||||
<Compile Include="Src\Util\UndoEventArgs.cs" /> |
||||
<Compile Include="Src\Util\UndoStep.cs" /> |
||||
<Compile Include="Src\Util\SelectionManager.cs" /> |
||||
<Compile Include="Src\Util\UndoManager.cs" /> |
||||
<Compile Include="Src\Util\ViewMode.cs" /> |
||||
<Compile Include="Src\View\HexEditContainer.cs"> |
||||
<SubType>UserControl</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\View\HexEditContainer.Designer.cs"> |
||||
<DependentUpon>HexEditContainer.cs</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\View\HexEditDisplayBinding.cs" /> |
||||
<Compile Include="Src\View\HexEditOptionsPanel.cs"> |
||||
<SubType>UserControl</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\View\HexEditView.cs" /> |
||||
<None Include="changes.txt" /> |
||||
<None Include="HexEditor.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<EmbeddedResource Include="Src\HexEditControl.resx"> |
||||
<DependentUpon>HexEditControl.cs</DependentUpon> |
||||
</EmbeddedResource> |
||||
<EmbeddedResource Include="Src\View\HexEditContainer.resx"> |
||||
<SubType>Designer</SubType> |
||||
<DependentUpon>HexEditContainer.cs</DependentUpon> |
||||
</EmbeddedResource> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<EmbeddedResource Include="Resources\sizefittowindow.bmp" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<EmbeddedResource Include="Resources\HexEditOptions.xfrm" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Src\View" /> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
</Project> |
||||
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="HexEditOptions" /> |
||||
<ClientSize value="{Width=348, Height=210}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="btnSelectFont" /> |
||||
<Location value="128, 90" /> |
||||
<Text value="Select font ..." /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Size value="93, 26" /> |
||||
<TabIndex value="13" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox2" /> |
||||
<Location value="3, 122" /> |
||||
<Text value="Preview" /> |
||||
<Size value="340, 82" /> |
||||
<TabIndex value="12" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblOffsetPreview" /> |
||||
<Location value="3, 16" /> |
||||
<Text value="Offset" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Size value="334, 31" /> |
||||
<ForeColor value="Color [ControlText]" /> |
||||
<Dock value="Top" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblDataPreview" /> |
||||
<Location value="3, 47" /> |
||||
<Text value="Data" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Size value="334, 32" /> |
||||
<Dock value="Bottom" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox1" /> |
||||
<Location value="256, 3" /> |
||||
<Text value="Textstyles" /> |
||||
<Size value="87, 81" /> |
||||
<TabIndex value="11" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbItalic" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 40" /> |
||||
<Text value="Italic" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="48, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbBold" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 19" /> |
||||
<Text value="Bold" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="47, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbUnderline" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 60" /> |
||||
<Text value="Underline" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="71, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label3" /> |
||||
<Location value="111, 47" /> |
||||
<Text value="Background color:" /> |
||||
<Size value="94, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="10" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label2" /> |
||||
<Location value="111, 0" /> |
||||
<Text value="Foreground color:" /> |
||||
<Size value="90, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="9" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label1" /> |
||||
<Location value="0, 0" /> |
||||
<Text value="Elements:" /> |
||||
<Size value="53, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="8" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ListBox> |
||||
<Name value="lstElements" /> |
||||
<Size value="102, 69" /> |
||||
<TabIndex value="7" /> |
||||
<FormattingEnabled value="True" /> |
||||
<Location value="3, 16" /> |
||||
</System.Windows.Forms.ListBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="cmbBackColor" /> |
||||
<Size value="138, 21" /> |
||||
<TabIndex value="1" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<Location value="111, 63" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="cmbForeColor" /> |
||||
<Size value="137, 21" /> |
||||
<TabIndex value="0" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<Location value="112, 16" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
||||
|
After Width: | Height: | Size: 774 B |
@ -0,0 +1,125 @@
@@ -0,0 +1,125 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
namespace HexEditor |
||||
{ |
||||
public partial class HexEditControl |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.bWorker = new System.ComponentModel.BackgroundWorker(); |
||||
this.VScrollBar = new System.Windows.Forms.VScrollBar(); |
||||
this.TextView = new System.Windows.Forms.Panel(); |
||||
this.HexView = new System.Windows.Forms.Panel(); |
||||
this.Side = new System.Windows.Forms.Panel(); |
||||
this.Header = new System.Windows.Forms.Panel(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// VScrollBar
|
||||
//
|
||||
this.VScrollBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.VScrollBar.Location = new System.Drawing.Point(670, 0); |
||||
this.VScrollBar.Name = "VScrollBar"; |
||||
this.VScrollBar.Size = new System.Drawing.Size(18, 365); |
||||
this.VScrollBar.TabIndex = 9; |
||||
this.VScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.VScrollBarScroll); |
||||
//
|
||||
// TextView
|
||||
//
|
||||
this.TextView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); |
||||
this.TextView.Cursor = System.Windows.Forms.Cursors.IBeam; |
||||
this.TextView.Location = new System.Drawing.Point(561, 18); |
||||
this.TextView.Name = "TextView"; |
||||
this.TextView.Size = new System.Drawing.Size(108, 347); |
||||
this.TextView.TabIndex = 12; |
||||
this.TextView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TextViewMouseDown); |
||||
this.TextView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TextViewMouseMove); |
||||
this.TextView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextViewMouseClick); |
||||
this.TextView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.TextViewMouseUp); |
||||
//
|
||||
// HexView
|
||||
//
|
||||
this.HexView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left))); |
||||
this.HexView.Cursor = System.Windows.Forms.Cursors.IBeam; |
||||
this.HexView.Location = new System.Drawing.Point(92, 18); |
||||
this.HexView.Name = "HexView"; |
||||
this.HexView.Size = new System.Drawing.Size(463, 347); |
||||
this.HexView.TabIndex = 11; |
||||
this.HexView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HexViewMouseDown); |
||||
this.HexView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HexViewMouseMove); |
||||
this.HexView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexViewMouseClick); |
||||
this.HexView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HexViewMouseUp); |
||||
//
|
||||
// Side
|
||||
//
|
||||
this.Side.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left))); |
||||
this.Side.Location = new System.Drawing.Point(0, 0); |
||||
this.Side.Name = "Side"; |
||||
this.Side.Size = new System.Drawing.Size(76, 365); |
||||
this.Side.TabIndex = 10; |
||||
//
|
||||
// Header
|
||||
//
|
||||
this.Header.Location = new System.Drawing.Point(92, 0); |
||||
this.Header.Name = "Header"; |
||||
this.Header.Size = new System.Drawing.Size(463, 18); |
||||
this.Header.TabIndex = 13; |
||||
//
|
||||
// HexEditControl
|
||||
//
|
||||
this.BackColor = System.Drawing.Color.White; |
||||
this.Controls.Add(this.Header); |
||||
this.Controls.Add(this.TextView); |
||||
this.Controls.Add(this.HexView); |
||||
this.Controls.Add(this.Side); |
||||
this.Controls.Add(this.VScrollBar); |
||||
this.DoubleBuffered = true; |
||||
this.Name = "HexEditControl"; |
||||
this.Size = new System.Drawing.Size(688, 365); |
||||
this.ContextMenuStripChanged += new System.EventHandler(this.HexEditControlContextMenuStripChanged); |
||||
this.GotFocus += new System.EventHandler(this.HexEditGotFocus); |
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.HexEditKeyPress); |
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.HexEditPaint); |
||||
this.SizeChanged += new System.EventHandler(this.HexEditSizeChanged); |
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HexEditKeyDown); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.Panel Header; |
||||
private System.Windows.Forms.Panel Side; |
||||
private System.Windows.Forms.Panel HexView; |
||||
private System.Windows.Forms.Panel TextView; |
||||
private System.ComponentModel.BackgroundWorker bWorker; |
||||
private System.Windows.Forms.VScrollBar VScrollBar; |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,126 @@
@@ -0,0 +1,126 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<metadata name="bWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>17, 17</value> |
||||
</metadata> |
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
||||
<value>79</value> |
||||
</metadata> |
||||
</root> |
||||
@ -0,0 +1,273 @@
@@ -0,0 +1,273 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Collections; |
||||
using System.Text; |
||||
using System.Windows.Forms; |
||||
using System.Diagnostics; |
||||
using System.ComponentModel; |
||||
using System.Threading; |
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Manages the data loaded into the hex editor.
|
||||
/// </summary>
|
||||
public class BufferManager |
||||
{ |
||||
internal Control parent; |
||||
OpenedFile currentFile; |
||||
Stream stream; |
||||
|
||||
/// <summary>
|
||||
/// Currently used, but not good for really big files (like 590 MB)
|
||||
/// </summary>
|
||||
private ArrayList buffer; |
||||
|
||||
/// <summary>
|
||||
/// Creates a new BufferManager and attaches it to a control.
|
||||
/// </summary>
|
||||
/// <param name="parent">The parent control to attach to.</param>
|
||||
public BufferManager(Control parent) |
||||
{ |
||||
this.parent = parent; |
||||
|
||||
this.buffer = new ArrayList(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Cleares the whole buffer.
|
||||
/// </summary>
|
||||
public void Clear() |
||||
{ |
||||
this.buffer.Clear(); |
||||
parent.Invalidate(); |
||||
GC.Collect(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Loads the data from a stream.
|
||||
/// </summary>
|
||||
public void Load(OpenedFile file, Stream stream) |
||||
{ |
||||
this.currentFile = file; |
||||
this.stream = stream; |
||||
this.buffer.Clear(); |
||||
|
||||
((HexEditControl)this.parent).Enabled = false; |
||||
|
||||
if (File.Exists(currentFile.FileName)) { |
||||
try { |
||||
BinaryReader reader = new BinaryReader(this.stream, System.Text.Encoding.Default); |
||||
|
||||
while (reader.PeekChar() != -1) { |
||||
this.buffer.AddRange(reader.ReadBytes(524288)); |
||||
UpdateProgress((int)((this.buffer.Count * 100) / reader.BaseStream.Length)); |
||||
} |
||||
|
||||
reader.Close(); |
||||
} catch (IOException ex) { |
||||
MessageService.ShowError(ex, ex.Message); |
||||
} catch (ArgumentException ex) { |
||||
MessageService.ShowError(ex, ex.Message + "\n\n" + ex.StackTrace); |
||||
} |
||||
} else { |
||||
MessageService.ShowError(new FileNotFoundException("The file " + currentFile.FileName + " doesn't exist!", currentFile.FileName), "The file " + currentFile.FileName + " doesn't exist!"); |
||||
} |
||||
|
||||
this.parent.Invalidate(); |
||||
|
||||
UpdateProgress(100); |
||||
|
||||
if (this.parent.InvokeRequired) |
||||
this.parent.Invoke(new MethodInvoker( |
||||
delegate() {this.parent.Cursor = Cursors.Default;} |
||||
)); |
||||
else {this.parent.Cursor = Cursors.Default;} |
||||
|
||||
|
||||
((HexEditControl)this.parent).LoadingFinished(); |
||||
|
||||
((HexEditControl)this.parent).Enabled = true; |
||||
|
||||
this.parent.Invalidate(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Writes all data to a stream.
|
||||
/// </summary>
|
||||
public void Save(OpenedFile file, Stream stream) |
||||
{ |
||||
BinaryWriter writer = new BinaryWriter(stream); |
||||
writer.Write((byte[])this.buffer.ToArray( typeof (byte) )); |
||||
writer.Flush(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Intern method used to load data in a separate thread.
|
||||
/// </summary>
|
||||
/// <remarks>Currently not in use.</remarks>
|
||||
private void Load() |
||||
{ |
||||
((HexEditControl)this.parent).Enabled = false; |
||||
|
||||
if (File.Exists(currentFile.FileName)) { |
||||
try { |
||||
BinaryReader reader = new BinaryReader(this.stream, System.Text.Encoding.Default); |
||||
|
||||
while (reader.PeekChar() != -1) { |
||||
this.buffer.AddRange(reader.ReadBytes(524288)); |
||||
UpdateProgress((int)((this.buffer.Count * 100) / reader.BaseStream.Length)); |
||||
} |
||||
|
||||
reader.Close(); |
||||
} catch (IOException ex) { |
||||
MessageService.ShowError(ex, ex.Message); |
||||
} catch (ArgumentException ex) { |
||||
MessageService.ShowError(ex, ex.Message + "\n\n" + ex.StackTrace); |
||||
} |
||||
} else { |
||||
MessageService.ShowError(new FileNotFoundException("The file " + currentFile.FileName + " doesn't exist!", currentFile.FileName), "The file " + currentFile.FileName + " doesn't exist!"); |
||||
} |
||||
|
||||
this.parent.Invalidate(); |
||||
|
||||
UpdateProgress(100); |
||||
|
||||
if (this.parent.InvokeRequired) |
||||
this.parent.Invoke(new MethodInvoker( |
||||
delegate() {this.parent.Cursor = Cursors.Default;} |
||||
)); |
||||
|
||||
((HexEditControl)this.parent).Enabled = true; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Used for threading to update the processbars and stuff.
|
||||
/// </summary>
|
||||
/// <param name="percentage">The current percentage of the process</param>
|
||||
private void UpdateProgress(int percentage) |
||||
{ |
||||
HexEditControl c = (HexEditControl)this.parent; |
||||
|
||||
Application.DoEvents(); |
||||
|
||||
if (c.ProgressBar != null) { |
||||
if (percentage >= 100) { |
||||
if (c.InvokeRequired) |
||||
c.Invoke(new MethodInvoker( |
||||
delegate() {c.ProgressBar.Value = 100; c.ProgressBar.Visible = false;} |
||||
)); |
||||
else { |
||||
c.ProgressBar.Value = 100; |
||||
c.ProgressBar.Visible = false; } |
||||
} else { |
||||
if (c.InvokeRequired) |
||||
c.Invoke(new MethodInvoker( |
||||
delegate() {c.ProgressBar.Value = percentage; c.ProgressBar.Visible = true;} |
||||
)); |
||||
else { c.ProgressBar.Value = percentage; c.ProgressBar.Visible = true; } |
||||
} |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the current buffer as a byte[].
|
||||
/// </summary>
|
||||
public byte[] Buffer { |
||||
get { |
||||
if (buffer == null) return new byte[0]; |
||||
return (byte[]) buffer.ToArray( typeof ( byte ) ); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The size of the current buffer.
|
||||
/// </summary>
|
||||
public int BufferSize { |
||||
get { return buffer.Count; } |
||||
} |
||||
|
||||
#region Methods
|
||||
|
||||
public byte[] GetBytes(int start, int count) |
||||
{ |
||||
if (buffer.Count == 0) return new byte[] {}; |
||||
if (start < 0) start = 0; |
||||
if (start >= buffer.Count) start = buffer.Count; |
||||
if (count < 1) count = 1; |
||||
if (count >= (buffer.Count - start)) count = (buffer.Count - start); |
||||
return (byte[])(buffer.GetRange(start, count).ToArray( typeof ( byte ) )); |
||||
} |
||||
|
||||
public byte GetByte(int offset) |
||||
{ |
||||
if (buffer.Count == 0) return 0; |
||||
if (offset < 0) offset = 0; |
||||
if (offset >= buffer.Count) offset = buffer.Count; |
||||
return (byte)buffer[offset]; |
||||
} |
||||
|
||||
public bool DeleteByte(int offset) |
||||
{ |
||||
if ((offset < buffer.Count) & (offset > -1)) { |
||||
buffer.RemoveAt(offset); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public bool RemoveByte(int offset) |
||||
{ |
||||
if ((offset < buffer.Count) & (offset > -1)) { |
||||
buffer.RemoveAt(offset); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public bool RemoveBytes(int offset, int length) |
||||
{ |
||||
if (((offset < buffer.Count) && (offset > -1)) && ((offset + length) <= buffer.Count)) { |
||||
buffer.RemoveRange(offset, length); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/// <remarks>Not Tested!</remarks>
|
||||
public void SetBytes(int start, byte[] bytes, bool overwrite) |
||||
{ |
||||
if (overwrite) { |
||||
if (bytes.Length > buffer.Count) buffer.AddRange(new byte[bytes.Length - buffer.Count]); |
||||
buffer.SetRange(start, bytes); |
||||
} else { |
||||
buffer.InsertRange(start, bytes); |
||||
} |
||||
} |
||||
|
||||
public void SetByte(int position, byte @byte, bool overwrite) |
||||
{ |
||||
if (overwrite) { |
||||
if (position > buffer.Count - 1) { |
||||
buffer.Add(@byte); |
||||
} else { |
||||
buffer[position] = @byte; |
||||
} |
||||
} else { |
||||
buffer.Insert(position, @byte); |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,106 @@
@@ -0,0 +1,106 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
using System.Drawing; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Represents a caret
|
||||
/// </summary>
|
||||
public class Caret |
||||
{ |
||||
int width; |
||||
int height; |
||||
int offset; |
||||
Control control; |
||||
|
||||
public Caret() |
||||
{ |
||||
} |
||||
|
||||
public Caret(Control control) |
||||
{ |
||||
this.control = control; |
||||
} |
||||
|
||||
public Caret(int width, int height) |
||||
{ |
||||
this.width = width; |
||||
this.height = height; |
||||
} |
||||
|
||||
public Caret(int width, int height, int offset) |
||||
{ |
||||
this.width = width; |
||||
this.height = height; |
||||
this.offset = offset; |
||||
} |
||||
|
||||
public Caret(Control control, int width, int height, int offset) |
||||
{ |
||||
this.width = width; |
||||
this.height = height; |
||||
this.offset = offset; |
||||
this.control = control; |
||||
} |
||||
|
||||
public int Width { |
||||
get { return width; } |
||||
set { width = value; } |
||||
} |
||||
|
||||
public int Height { |
||||
get { return height; } |
||||
set { height = value; } |
||||
} |
||||
|
||||
public int Offset { |
||||
get { return offset; } |
||||
set { offset = value; } |
||||
} |
||||
|
||||
public Control Control { |
||||
get { return control; } |
||||
set { control = value; } |
||||
} |
||||
|
||||
public void Create(Control control, int width, int height) |
||||
{ |
||||
NativeMethods.CreateCaret(control.Handle, 0, width, height); |
||||
this.Control = control; |
||||
this.Width = width; |
||||
this.Height = height; |
||||
} |
||||
|
||||
public void Destroy() |
||||
{ |
||||
NativeMethods.DestroyCaret(); |
||||
this.Control = null; |
||||
this.Width = 0; |
||||
this.Height = 0; |
||||
this.Offset = -1; |
||||
} |
||||
|
||||
public void Show() |
||||
{ |
||||
NativeMethods.ShowCaret(control.Handle); |
||||
} |
||||
|
||||
public void Hide() |
||||
{ |
||||
NativeMethods.HideCaret(control.Handle); |
||||
} |
||||
|
||||
public void SetToPosition(Point position) |
||||
{ |
||||
NativeMethods.SetCaretPos(position.X, position.Y); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Manages the clipboard actions.
|
||||
/// </summary>
|
||||
public static class ClipboardManager |
||||
{ |
||||
/// <summary>
|
||||
/// Used to determine if text is in the clipboard or not.
|
||||
/// </summary>
|
||||
public static bool ContainsText { |
||||
get { return Clipboard.ContainsText(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Cleares the Clipboard.
|
||||
/// </summary>
|
||||
public static void Clear() |
||||
{ |
||||
Clipboard.Clear(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Copies text into the clipboard.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to be copied to the clipboard.</param>
|
||||
public static void Copy(string text) |
||||
{ |
||||
Clipboard.SetText(text); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Pastes the text.
|
||||
/// </summary>
|
||||
/// <returns>the text in the clipboard.</returns>
|
||||
public static string Paste() |
||||
{ |
||||
return Clipboard.GetText(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Description of NativeMethods.
|
||||
/// </summary>
|
||||
public static class NativeMethods |
||||
{ |
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool CreateCaret(IntPtr hWnd, int hBitmap, int nWidth, int nHeight); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool SetCaretPos(int x, int y); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool DestroyCaret(); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool ShowCaret(IntPtr hWnd); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool HideCaret(IntPtr hWnd); |
||||
} |
||||
} |
||||
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Text; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Contains data for the selection of the HexEditor
|
||||
/// </summary>
|
||||
public class SelectionManager |
||||
{ |
||||
BufferManager buffer; |
||||
|
||||
public event EventHandler SelectionChanged; |
||||
|
||||
protected virtual void OnSelectionChanged(EventArgs e) |
||||
{ |
||||
if (SelectionChanged != null) { |
||||
SelectionChanged(this, e); |
||||
} |
||||
} |
||||
|
||||
public SelectionManager(ref BufferManager buffer) |
||||
{ |
||||
this.buffer = buffer; |
||||
} |
||||
|
||||
#region Properties
|
||||
int start, end; |
||||
bool hasSelection; |
||||
|
||||
public int Start { |
||||
get { return start; } |
||||
set { |
||||
start = value; |
||||
EventArgs e = new EventArgs(); |
||||
OnSelectionChanged(e); |
||||
} |
||||
} |
||||
|
||||
public int End { |
||||
get { return end; } |
||||
set { |
||||
end = value; |
||||
EventArgs e = new EventArgs(); |
||||
OnSelectionChanged(e); |
||||
} |
||||
} |
||||
|
||||
public bool HasSomethingSelected { |
||||
get { return hasSelection; } |
||||
set { hasSelection = value; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>A string with the selected text</returns>
|
||||
public string SelectionText { |
||||
get { |
||||
int start = this.Start; |
||||
int end = this.End; |
||||
if (this.End < this.Start) { |
||||
start = this.End; |
||||
end = this.Start; |
||||
} |
||||
return Encoding.Default.GetString(buffer.GetBytes(this.Start, Math.Abs(end - start))); |
||||
} |
||||
} |
||||
|
||||
public byte[] GetSelectionBytes() |
||||
{ |
||||
int start = this.Start; |
||||
int end = this.End; |
||||
if (this.End < this.Start) { |
||||
start = this.End; |
||||
end = this.Start; |
||||
} |
||||
return buffer.GetBytes(this.Start, Math.Abs(end - start)); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Cleares the selection (no text is altered)
|
||||
/// </summary>
|
||||
public void Clear() |
||||
{ |
||||
this.HasSomethingSelected = false; |
||||
this.Start = 0; |
||||
this.End = 0; |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Used to tell the UndoManager what to do with the changes.
|
||||
/// </summary>
|
||||
public enum UndoAction |
||||
{ |
||||
Add, Remove, Overwrite |
||||
} |
||||
} |
||||
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Used for EventArgs in the ActionUndone and ActionRedone events.
|
||||
/// </summary>
|
||||
public class UndoEventArgs : EventArgs |
||||
{ |
||||
UndoStep undostep; |
||||
bool isRedo; |
||||
|
||||
public UndoEventArgs(UndoStep step, bool redo) |
||||
{ |
||||
undostep = step; |
||||
isRedo = redo; |
||||
} |
||||
|
||||
public UndoStep UndoStep { |
||||
get { return undostep; } |
||||
} |
||||
|
||||
public bool IsRedo { |
||||
get { return isRedo; } |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,121 @@
@@ -0,0 +1,121 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Description of UndoManager.
|
||||
/// </summary>
|
||||
public class UndoManager |
||||
{ |
||||
Stack UndoStack; |
||||
Stack RedoStack; |
||||
|
||||
public event EventHandler<UndoEventArgs> ActionUndone; |
||||
public event EventHandler<UndoEventArgs> ActionRedone; |
||||
|
||||
public UndoManager() |
||||
{ |
||||
UndoStack = new Stack(); |
||||
RedoStack = new Stack(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Determines if there's any further step to undo.
|
||||
/// </summary>
|
||||
public bool CanUndo { |
||||
get { return (UndoStack.Count > 0); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Determines if there's any further step to redo.
|
||||
/// </summary>
|
||||
public bool CanRedo { |
||||
get { return (RedoStack.Count > 0); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds a step to the stack.
|
||||
/// </summary>
|
||||
/// <param name="step">The step to add.</param>
|
||||
/// <remarks>Used internally, don't use!</remarks>
|
||||
internal void AddUndoStep(UndoStep step) |
||||
{ |
||||
UndoStack.Push(step); |
||||
RedoStack.Clear(); |
||||
|
||||
EventHandler<UndoEventArgs> temp = ActionUndone; |
||||
if (temp != null) |
||||
temp(this, new UndoEventArgs(step, false)); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Undoes the last step.
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer to use</param>
|
||||
/// <remarks>Used internally, don't use!</remarks>
|
||||
internal UndoStep Undo(ref BufferManager buffer) |
||||
{ |
||||
if (UndoStack.Count > 0) { |
||||
UndoStep step = (UndoStep)UndoStack.Peek(); |
||||
RedoStack.Push(step); |
||||
UndoStack.Pop(); |
||||
switch (step.Action) { |
||||
case UndoAction.Add : |
||||
buffer.SetBytes(step.Start, step.GetBytes(), false); |
||||
break; |
||||
case UndoAction.Remove : |
||||
buffer.RemoveBytes(step.Start, step.GetBytes().Length); |
||||
break; |
||||
case UndoAction.Overwrite : |
||||
buffer.SetBytes(step.Start, step.GetOldBytes(), true); |
||||
break; |
||||
} |
||||
EventHandler<UndoEventArgs> temp = ActionUndone; |
||||
if (temp != null) |
||||
temp(this, new UndoEventArgs(step, true)); |
||||
|
||||
return step; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Redoes the last step.
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer to use</param>
|
||||
/// <remarks>Used internally, don't use!</remarks>
|
||||
internal UndoStep Redo(ref BufferManager buffer) |
||||
{ |
||||
if (RedoStack.Count > 0) { |
||||
UndoStep step = (UndoStep)RedoStack.Peek(); |
||||
UndoStack.Push(step); |
||||
RedoStack.Pop(); |
||||
switch (step.Action) { |
||||
case UndoAction.Add : |
||||
buffer.RemoveBytes(step.Start, step.GetBytes().Length); |
||||
break; |
||||
case UndoAction.Remove : |
||||
buffer.SetBytes(step.Start, step.GetBytes(), false); |
||||
break; |
||||
case UndoAction.Overwrite : |
||||
buffer.SetBytes(step.Start, step.GetBytes(), true); |
||||
break; |
||||
} |
||||
EventHandler<UndoEventArgs> temp = ActionRedone; |
||||
if (temp != null) |
||||
temp(this, new UndoEventArgs(step, false)); |
||||
|
||||
return step; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Used to save data about changes to undo/redo.
|
||||
/// </summary>
|
||||
public class UndoStep |
||||
{ |
||||
byte[] bytes, oldBytes; |
||||
int start; |
||||
long timeStamp; |
||||
UndoAction action; |
||||
|
||||
public UndoStep(byte[] bytes, byte[] oldBytes, int start, UndoAction action) |
||||
{ |
||||
this.bytes = bytes; |
||||
this.oldBytes = oldBytes; |
||||
this.start = start; |
||||
this.action = action; |
||||
this.timeStamp = DateTime.Now.Ticks; |
||||
} |
||||
|
||||
public long TimeStamp { |
||||
get { return timeStamp; } |
||||
} |
||||
|
||||
public byte[] GetBytes() { |
||||
return bytes; |
||||
} |
||||
|
||||
public byte[] GetOldBytes() { |
||||
return oldBytes; |
||||
} |
||||
|
||||
public int Start { |
||||
get { return start; } |
||||
} |
||||
|
||||
public UndoAction Action { |
||||
get { return action; } |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return "{ Bytes: " + System.Text.Encoding.Default.GetString(GetBytes()) + ", OldBytes: " + System.Text.Encoding.Default.GetString(GetOldBytes()) + ", Start: " + start.ToString() + ", Action: " + action.ToString() + " }"; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Specifies how the offset/adress numbers are displayed, either as
|
||||
/// hexadecimal, octal or decimal numbers.
|
||||
/// </summary>
|
||||
public enum ViewMode |
||||
{ |
||||
Hexadecimal, |
||||
Octal, |
||||
Decimal |
||||
} |
||||
} |
||||
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
namespace HexEditor.View |
||||
{ |
||||
partial class HexEditContainer |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) |
||||
{ |
||||
if (components != null) |
||||
{ |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HexEditContainer)); |
||||
this.tbSizeToFit = new System.Windows.Forms.ToolStripButton(); |
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.tCBViewMode = new System.Windows.Forms.ToolStripComboBox(); |
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); |
||||
this.tSTBCharsPerLine = new System.Windows.Forms.ToolStripTextBox(); |
||||
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); |
||||
this.hexEditControl = new HexEditor.HexEditControl(); |
||||
this.toolStrip1.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// tbSizeToFit
|
||||
//
|
||||
this.tbSizeToFit.CheckOnClick = true; |
||||
this.tbSizeToFit.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; |
||||
this.tbSizeToFit.Image = ((System.Drawing.Image)(resources.GetObject("tbSizeToFit.Image"))); |
||||
this.tbSizeToFit.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; |
||||
this.tbSizeToFit.ImageTransparentColor = System.Drawing.Color.Magenta; |
||||
this.tbSizeToFit.Name = "tbSizeToFit"; |
||||
this.tbSizeToFit.Size = new System.Drawing.Size(23, 22); |
||||
this.tbSizeToFit.Text = "Size to fit"; |
||||
this.tbSizeToFit.Click += new System.EventHandler(this.TbSizeToFitClick); |
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1"; |
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); |
||||
//
|
||||
// tCBViewMode
|
||||
//
|
||||
this.tCBViewMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; |
||||
this.tCBViewMode.Items.AddRange(new object[] { |
||||
"Hexadecimal", |
||||
"Octal", |
||||
"Decimal"}); |
||||
this.tCBViewMode.Name = "tCBViewMode"; |
||||
this.tCBViewMode.Size = new System.Drawing.Size(121, 25); |
||||
this.tCBViewMode.SelectedIndexChanged += new System.EventHandler(this.TCBViewModeSelectedIndexChanged); |
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.tbSizeToFit, |
||||
this.tSTBCharsPerLine, |
||||
this.toolStripSeparator1, |
||||
this.tCBViewMode, |
||||
this.toolStripProgressBar1}); |
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0); |
||||
this.toolStrip1.Name = "toolStrip1"; |
||||
this.toolStrip1.Size = new System.Drawing.Size(689, 25); |
||||
this.toolStrip1.TabIndex = 2; |
||||
this.toolStrip1.Text = "toolStrip1"; |
||||
//
|
||||
// tSTBCharsPerLine
|
||||
//
|
||||
this.tSTBCharsPerLine.Name = "tSTBCharsPerLine"; |
||||
this.tSTBCharsPerLine.Size = new System.Drawing.Size(40, 25); |
||||
this.tSTBCharsPerLine.TextChanged += new System.EventHandler(tSTBCharsPerLine_TextChanged); |
||||
//
|
||||
// toolStripProgressBar1
|
||||
//
|
||||
this.toolStripProgressBar1.Name = "toolStripProgressBar1"; |
||||
this.toolStripProgressBar1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; |
||||
this.toolStripProgressBar1.Size = new System.Drawing.Size(150, 22); |
||||
this.toolStripProgressBar1.Visible = false; |
||||
//
|
||||
// hexEditControl
|
||||
//
|
||||
this.hexEditControl.BackColor = System.Drawing.Color.White; |
||||
this.hexEditControl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; |
||||
this.hexEditControl.BytesPerLine = 16; |
||||
this.hexEditControl.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.hexEditControl.Encoding = ((System.Text.Encoding)(resources.GetObject("hexEditControl.Encoding"))); |
||||
this.hexEditControl.FileName = null; |
||||
this.hexEditControl.FitToWindowWidth = false; |
||||
this.hexEditControl.Location = new System.Drawing.Point(0, 25); |
||||
this.hexEditControl.Name = "hexEditControl"; |
||||
this.hexEditControl.ProgressBar = this.toolStripProgressBar1; |
||||
this.hexEditControl.Size = new System.Drawing.Size(689, 308); |
||||
this.hexEditControl.TabIndex = 3; |
||||
this.hexEditControl.ViewMode = HexEditor.Util.ViewMode.Hexadecimal; |
||||
//
|
||||
// HexEditContainer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.hexEditControl); |
||||
this.Controls.Add(this.toolStrip1); |
||||
this.Name = "HexEditContainer"; |
||||
this.Size = new System.Drawing.Size(689, 333); |
||||
this.Resize += new System.EventHandler(this.HexEditContainer_Resize); |
||||
this.toolStrip1.ResumeLayout(false); |
||||
this.toolStrip1.PerformLayout(); |
||||
this.ResumeLayout(false); |
||||
this.PerformLayout(); |
||||
|
||||
} |
||||
private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1; |
||||
internal HexEditor.HexEditControl hexEditControl; |
||||
private System.Windows.Forms.ToolStripComboBox tCBViewMode; |
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; |
||||
private System.Windows.Forms.ToolStripButton tbSizeToFit; |
||||
private System.Windows.Forms.ToolStrip toolStrip1; |
||||
private System.Windows.Forms.ToolStripTextBox tSTBCharsPerLine; |
||||
} |
||||
} |
||||
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
using System.IO; |
||||
|
||||
using HexEditor.Util; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
|
||||
namespace HexEditor.View |
||||
{ |
||||
public partial class HexEditContainer : UserControl |
||||
{ |
||||
public bool HasSelection { |
||||
get { return hexEditControl.HasSelection; } |
||||
} |
||||
|
||||
public bool EditorFocused { |
||||
get { return hexEditControl.HasFocus; } |
||||
} |
||||
|
||||
public bool CanUndo { |
||||
get { return hexEditControl.CanUndo; } |
||||
} |
||||
|
||||
public bool CanRedo { |
||||
get { return hexEditControl.CanRedo; } |
||||
} |
||||
|
||||
public HexEditContainer() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString(); |
||||
this.hexEditControl.ContextMenuStrip = MenuService.CreateContextMenu(this.hexEditControl, "/AddIns/HexEditor/Editor/ContextMenu"); |
||||
tCBViewMode.SelectedIndex = 0; |
||||
} |
||||
|
||||
void TbSizeToFitClick(object sender, EventArgs e) |
||||
{ |
||||
tSTBCharsPerLine.Enabled = !tbSizeToFit.Checked; |
||||
hexEditControl.FitToWindowWidth = tbSizeToFit.Checked; |
||||
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString(); |
||||
} |
||||
|
||||
void TCBViewModeSelectedIndexChanged(object sender, EventArgs e) |
||||
{ |
||||
switch (tCBViewMode.SelectedIndex) |
||||
{ |
||||
case 0: |
||||
hexEditControl.ViewMode = ViewMode.Hexadecimal; |
||||
break; |
||||
case 1: |
||||
hexEditControl.ViewMode = ViewMode.Octal; |
||||
break; |
||||
case 2: |
||||
hexEditControl.ViewMode = ViewMode.Decimal; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
void HexEditContainerGotFocus(object sender, EventArgs e) |
||||
{ |
||||
hexEditControl.Focus(); |
||||
} |
||||
|
||||
public void LoadFile(OpenedFile file, Stream stream) |
||||
{ |
||||
hexEditControl.LoadFile(file, stream); |
||||
} |
||||
|
||||
public void SaveFile(OpenedFile file, Stream stream) |
||||
{ |
||||
hexEditControl.SaveFile(file, stream); |
||||
} |
||||
|
||||
public string Cut() |
||||
{ |
||||
string text = hexEditControl.Copy(); |
||||
hexEditControl.Delete(); |
||||
return text; |
||||
} |
||||
|
||||
public string Copy() |
||||
{ |
||||
return hexEditControl.Copy(); |
||||
} |
||||
|
||||
public void Paste(string text) |
||||
{ |
||||
hexEditControl.Paste(text); |
||||
} |
||||
|
||||
public void Delete() |
||||
{ |
||||
hexEditControl.Delete(); |
||||
} |
||||
|
||||
public void SelectAll() |
||||
{ |
||||
hexEditControl.SelectAll(); |
||||
} |
||||
|
||||
public void Undo() |
||||
{ |
||||
hexEditControl.Undo(); |
||||
} |
||||
|
||||
public void Redo() |
||||
{ |
||||
hexEditControl.Redo(); |
||||
} |
||||
|
||||
void tSTBCharsPerLine_TextChanged(object sender, EventArgs e) |
||||
{ |
||||
int value = 0; |
||||
if (int.TryParse(tSTBCharsPerLine.Text, out value)) { |
||||
hexEditControl.BytesPerLine = value; |
||||
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString(); |
||||
} |
||||
} |
||||
|
||||
void HexEditContainer_Resize(object sender, EventArgs e) |
||||
{ |
||||
if (this.tbSizeToFit.Checked) tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,155 @@
@@ -0,0 +1,155 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||
<data name="tbSizeToFit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value> |
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 |
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAeZJREFUOE+dUk1P |
||||
E1EUvdWwInHjT/GDjS5d+huMGxAMCQtCdEViTDQQNSQlRgWCBEjT+AEKqcECDbWUDxubqoXpUCwtLdNS |
||||
7UynM/0aOLz3sEmNceG8zEnu3HfuuffcGcdyJA/psEKNAxacdRCda3HQGZ50sBf2iLBB4imWP9/aQuQK |
||||
HiD1sww7xx3IgJa+5oWAnFaxua0INMf/ynGOy78P4ha4QLZg/DcmfUmQJ5SzLTDuTYDebShCIK8ZaOt8 |
||||
gfm1GCzrWNhohl62hL0L7c+wHE5BUSsY+RAHvWFL/J4s4Gr3mLicX5OFFdWowqxaKFWOUCjVkMjqQvDK |
||||
b95MYAdP52TQa7bJix3PRTHHJRZzON9uCgEO3plzmnk8ds5KILc/LSxcvzstBHzhBOtqoViuQzPqrHsd |
||||
+WINOa2Gg18VMcFlZnXxyz6evIqCXCunAuXqEa71TmB2NQbNtP7aQYYVNyZZjSqIZ00MuiOgqcUftr/C |
||||
g6kwaNwj2fqRoqkS7r8MgUbfb9maILKno390A9TuXBcCe4cmdnMmZMWElDGwlTbwLamDE8MJHaHdIj7H |
||||
NazLKoIxFQFJxY17ntMJbg4F0TH0Cbce+dA18BG3Bxb+QOfDBXQPetE3vII7w370PF5i917w2hM6SQ00 |
||||
Fpb7OwAAAABJRU5ErkJggg== |
||||
</value> |
||||
</data> |
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>17, 17</value> |
||||
</metadata> |
||||
<data name="hexEditControl.Encoding" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value> |
||||
AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uVGV4dC5Db2RlUGFnZUVuY29kaW5nCAAAAAxtX2lz |
||||
UmVhZE9ubHkPZW5jb2RlckZhbGxiYWNrD2RlY29kZXJGYWxsYmFjawptX2NvZGVQYWdlCGRhdGFJdGVt |
||||
E0VuY29kaW5nK21fY29kZVBhZ2URRW5jb2RpbmcrZGF0YUl0ZW0LbWF4Q2hhclNpemUAAwMAAgACAAEq |
||||
U3lzdGVtLlRleHQuSW50ZXJuYWxFbmNvZGVyQmVzdEZpdEZhbGxiYWNrKlN5c3RlbS5UZXh0LkludGVy |
||||
bmFsRGVjb2RlckJlc3RGaXRGYWxsYmFjawgICAEJAgAAAAkDAAAA5AQAAArkBAAACgEAAAAEAgAAACpT |
||||
eXN0ZW0uVGV4dC5JbnRlcm5hbEVuY29kZXJCZXN0Rml0RmFsbGJhY2sEAAAACGVuY29kaW5nDGFycmF5 |
||||
QmVzdEZpdBtiSXNNaWNyb3NvZnRCZXN0Rml0RmFsbGJhY2srRW5jb2RlckZhbGxiYWNrK2JJc01pY3Jv |
||||
c29mdEJlc3RGaXRGYWxsYmFjawMHAAAcU3lzdGVtLlRleHQuQ29kZVBhZ2VFbmNvZGluZwMBAQkBAAAA |
||||
CgEBBAMAAAAqU3lzdGVtLlRleHQuSW50ZXJuYWxEZWNvZGVyQmVzdEZpdEZhbGxiYWNrBQAAAAhlbmNv |
||||
ZGluZwxhcnJheUJlc3RGaXQMY1JlcGxhY2VtZW50G2JJc01pY3Jvc29mdEJlc3RGaXRGYWxsYmFjaytE |
||||
ZWNvZGVyRmFsbGJhY2srYklzTWljcm9zb2Z0QmVzdEZpdEZhbGxiYWNrAwcAAAAcU3lzdGVtLlRleHQu |
||||
Q29kZVBhZ2VFbmNvZGluZwMDAQEJAQAAAAo/AQEL |
||||
</value> |
||||
</data> |
||||
</root> |
||||
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
using System.Diagnostics; |
||||
|
||||
namespace HexEditor.View |
||||
{ |
||||
public class HexEditDisplayBinding : IDisplayBinding |
||||
{ |
||||
string[] supportedBinaryFileNameExtensions; |
||||
|
||||
public HexEditDisplayBinding() |
||||
{ |
||||
} |
||||
|
||||
bool IsBinaryFileName(string fileName) |
||||
{ |
||||
if (fileName != null) { |
||||
string extension = Path.GetExtension(fileName); |
||||
foreach (string supportedExtension in GetSupportedBinaryFileExtensions()) { |
||||
if (String.Compare(supportedExtension, extension, StringComparison.InvariantCultureIgnoreCase) == 0) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
string[] GetSupportedBinaryFileExtensions() |
||||
{ |
||||
if (supportedBinaryFileNameExtensions == null) { |
||||
string extensionList = (string)AddInTree.BuildItem("/AddIns/HexEditor/Editor/SupportedFileExtensions", null); |
||||
if (extensionList != null) { |
||||
supportedBinaryFileNameExtensions = extensionList.Split(';'); |
||||
} |
||||
} |
||||
return supportedBinaryFileNameExtensions; |
||||
} |
||||
|
||||
bool IsBinary(string fileName) |
||||
{ |
||||
try { |
||||
if (!File.Exists(fileName)) return false; |
||||
|
||||
BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); |
||||
byte[] data = reader.ReadBytes(1024); |
||||
reader.Close(); |
||||
|
||||
for (int i = 0; i < data.Length; i++) { |
||||
if ((data[i] != 0xA) && (data[i] != 0xD) && (data[i] != 0x9)) { |
||||
if (data[i] < 0x20) return true; |
||||
} |
||||
} |
||||
} catch (IOException ex) { |
||||
MessageService.ShowError(ex, ex.Message); |
||||
} catch (Exception ex) { |
||||
Debug.Print(ex.ToString()); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public bool CanCreateContentForFile(string fileName) |
||||
{ |
||||
return IsBinaryFileName(fileName); |
||||
} |
||||
|
||||
public IViewContent CreateContentForFile(OpenedFile file) |
||||
{ |
||||
return new HexEditView(file); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,584 @@
@@ -0,0 +1,584 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
using System.Xml.Serialization; |
||||
using System.Drawing; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Xml; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace HexEditor.View |
||||
{ |
||||
public class HexEditOptionsPanel : AbstractOptionPanel |
||||
{ |
||||
ComboBox cmbForeColor; |
||||
ComboBox cmbBackColor; |
||||
ListBox lstElements; |
||||
CheckBox cbBold; |
||||
CheckBox cbItalic; |
||||
CheckBox cbUnderline; |
||||
Label lblOffsetPreview; |
||||
Label lblDataPreview; |
||||
Button btnSelectFont; |
||||
FontDialog fdSelectFont; |
||||
|
||||
List<Color> Colors; |
||||
Color customFore = Color.Transparent; |
||||
Color customBack = Color.Transparent; |
||||
|
||||
bool fcmanualchange = false; |
||||
bool bcmanualchange = false; |
||||
|
||||
// New values
|
||||
Color OffsetForeColor, OffsetBackColor; |
||||
Color DataForeColor, DataBackColor; |
||||
|
||||
bool OffsetBold, OffsetItalic, OffsetUnderline; |
||||
bool DataBold, DataItalic, DataUnderline; |
||||
|
||||
float FontSize = 10.0f; |
||||
|
||||
string FontName; |
||||
|
||||
public HexEditOptionsPanel() |
||||
{ |
||||
Colors = new List<Color>(); |
||||
|
||||
ListColors(); |
||||
} |
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("HexEditor.Resources.HexEditOptions.xfrm")); |
||||
this.InitializeComponents(); |
||||
string configpath = Path.GetDirectoryName(typeof(HexEditControl).Assembly.Location) + Path.DirectorySeparatorChar + "config.xml"; |
||||
|
||||
if (!File.Exists(configpath)) return; |
||||
|
||||
XmlDocument file = new XmlDocument(); |
||||
file.Load(configpath); |
||||
|
||||
foreach (XmlElement el in file.GetElementsByTagName("Setting")) { |
||||
switch(el.GetAttribute("Name")) { |
||||
case "OffsetFore" : |
||||
OffsetForeColor = Color.FromArgb(int.Parse(el.GetAttribute("R")), int.Parse(el.GetAttribute("G")), int.Parse(el.GetAttribute("B"))); |
||||
break; |
||||
case "OffsetBack" : |
||||
OffsetBackColor = Color.FromArgb(int.Parse(el.GetAttribute("R")), int.Parse(el.GetAttribute("G")), int.Parse(el.GetAttribute("B"))); |
||||
break; |
||||
case "DataFore" : |
||||
DataForeColor = Color.FromArgb(int.Parse(el.GetAttribute("R")), int.Parse(el.GetAttribute("G")), int.Parse(el.GetAttribute("B"))); |
||||
break; |
||||
case "DataBack" : |
||||
DataBackColor = Color.FromArgb(int.Parse(el.GetAttribute("R")), int.Parse(el.GetAttribute("G")), int.Parse(el.GetAttribute("B"))); |
||||
break; |
||||
case "OffsetStyle" : |
||||
OffsetBold = bool.Parse(el.GetAttribute("Bold")); |
||||
OffsetItalic = bool.Parse(el.GetAttribute("Italic")); |
||||
OffsetUnderline = bool.Parse(el.GetAttribute("Underline")); |
||||
break; |
||||
case "DataStyle" : |
||||
DataBold = bool.Parse(el.GetAttribute("Bold")); |
||||
DataItalic = bool.Parse(el.GetAttribute("Italic")); |
||||
DataUnderline = bool.Parse(el.GetAttribute("Underline")); |
||||
break; |
||||
case "Font" : |
||||
FontName = el.GetAttribute("FontName"); |
||||
FontSize = float.Parse(el.GetAttribute("FontSize")); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
lblOffsetPreview.Font = new Font(FontName, FontSize); |
||||
lblDataPreview.Font = new Font(FontName, FontSize); |
||||
|
||||
fdSelectFont.Font = new Font(FontName, FontSize); |
||||
|
||||
if (OffsetBold) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Bold); |
||||
if (OffsetItalic) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Italic); |
||||
if (OffsetUnderline) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Underline); |
||||
|
||||
if (DataBold) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Bold); |
||||
if (DataItalic) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Italic); |
||||
if (DataUnderline) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Underline); |
||||
|
||||
if (IsNamedColor(OffsetForeColor)) { |
||||
OffsetForeColor = Color.FromName(GetColorName(OffsetForeColor)); |
||||
} else { |
||||
customFore = OffsetForeColor; |
||||
} |
||||
|
||||
if (IsNamedColor(OffsetBackColor)) { |
||||
OffsetBackColor = Color.FromName(GetColorName(OffsetBackColor)); |
||||
} else { |
||||
customBack = OffsetBackColor; |
||||
} |
||||
|
||||
if (IsNamedColor(DataForeColor)) { |
||||
DataForeColor = Color.FromName(GetColorName(DataForeColor)); |
||||
} else { |
||||
customFore = DataForeColor; |
||||
} |
||||
|
||||
if (IsNamedColor(DataBackColor)) { |
||||
DataBackColor = Color.FromName(GetColorName(DataBackColor)); |
||||
} else { |
||||
customBack = DataBackColor; |
||||
} |
||||
|
||||
if (!OffsetForeColor.IsNamedColor) { |
||||
cmbForeColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbForeColor.SelectedIndex = cmbForeColor.Items.IndexOf(OffsetForeColor.Name); |
||||
} |
||||
|
||||
if (OffsetBackColor.IsNamedColor) { |
||||
cmbBackColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbBackColor.SelectedIndex = cmbBackColor.Items.IndexOf(OffsetBackColor.Name); |
||||
} |
||||
} |
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Byte.ToString")] |
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Single.ToString")] |
||||
public override bool StorePanelContents() |
||||
{ |
||||
string configpath = Path.GetDirectoryName(typeof(HexEditControl).Assembly.Location) + Path.DirectorySeparatorChar + "config.xml"; |
||||
XmlDocument file = new XmlDocument(); |
||||
file.LoadXml("<Config></Config>"); |
||||
|
||||
XmlElement el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "OffsetFore"); |
||||
el.SetAttribute("R", OffsetForeColor.R.ToString()); |
||||
el.SetAttribute("G", OffsetForeColor.G.ToString()); |
||||
el.SetAttribute("B", OffsetForeColor.B.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "OffsetBack"); |
||||
el.SetAttribute("R", OffsetBackColor.R.ToString()); |
||||
el.SetAttribute("G", OffsetBackColor.G.ToString()); |
||||
el.SetAttribute("B", OffsetBackColor.B.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "DataFore"); |
||||
el.SetAttribute("R", DataForeColor.R.ToString()); |
||||
el.SetAttribute("G", DataForeColor.G.ToString()); |
||||
el.SetAttribute("B", DataForeColor.B.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "DataBack"); |
||||
el.SetAttribute("R", DataBackColor.R.ToString()); |
||||
el.SetAttribute("G", DataBackColor.G.ToString()); |
||||
el.SetAttribute("B", DataBackColor.B.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "OffsetStyle"); |
||||
el.SetAttribute("Bold", OffsetBold.ToString()); |
||||
el.SetAttribute("Italic", OffsetItalic.ToString()); |
||||
el.SetAttribute("Underline", OffsetUnderline.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "DataStyle"); |
||||
el.SetAttribute("Bold", DataBold.ToString()); |
||||
el.SetAttribute("Italic", DataItalic.ToString()); |
||||
el.SetAttribute("Underline", DataUnderline.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
el = file.CreateElement("Setting"); |
||||
el.SetAttribute("Name", "Font"); |
||||
el.SetAttribute("FontName", FontName); |
||||
el.SetAttribute("FontSize", FontSize.ToString()); |
||||
file.FirstChild.AppendChild(el); |
||||
|
||||
file.Save(configpath); |
||||
return true; |
||||
} |
||||
|
||||
void InitializeComponents() |
||||
{ |
||||
cmbForeColor = (ComboBox)ControlDictionary["cmbForeColor"]; |
||||
cmbBackColor = (ComboBox)ControlDictionary["cmbBackColor"]; |
||||
lstElements = (ListBox)ControlDictionary["lstElements"]; |
||||
cbBold = (CheckBox)ControlDictionary["cbBold"]; |
||||
cbItalic = (CheckBox)ControlDictionary["cbItalic"]; |
||||
cbUnderline = (CheckBox)ControlDictionary["cbUnderline"]; |
||||
lblOffsetPreview = (Label)ControlDictionary["lblOffsetPreview"]; |
||||
lblDataPreview = (Label)ControlDictionary["lblDataPreview"]; |
||||
btnSelectFont = (Button)ControlDictionary["btnSelectFont"]; |
||||
fdSelectFont = new FontDialog(); |
||||
|
||||
// Initialize FontDialog
|
||||
fdSelectFont.FontMustExist = true; |
||||
fdSelectFont.FixedPitchOnly = true; |
||||
fdSelectFont.ShowEffects = false; |
||||
fdSelectFont.ShowColor = false; |
||||
|
||||
cmbForeColor.Items.Add("Custom"); |
||||
cmbBackColor.Items.Add("Custom"); |
||||
|
||||
foreach (Color c in Colors) { |
||||
cmbForeColor.Items.Add(c.Name); |
||||
cmbBackColor.Items.Add(c.Name); |
||||
} |
||||
|
||||
lstElements.Items.Add("Offset"); |
||||
lstElements.Items.Add("Data"); |
||||
|
||||
lstElements.SetSelected(0, true); |
||||
|
||||
btnSelectFont.Click += new EventHandler(this.btnSelectFontClick); |
||||
cmbForeColor.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbForeColorDrawItem); |
||||
cmbForeColor.SelectedValueChanged += new EventHandler(this.cmbForeColorSelectedValueChanged); |
||||
|
||||
cmbForeColor.DropDown += cmbForeColorDropDown; |
||||
cmbBackColor.DropDown += cmbBackColorDropDown; |
||||
|
||||
cmbBackColor.DrawItem += new DrawItemEventHandler(this.cmbBackColorDrawItem); |
||||
cmbBackColor.SelectedValueChanged += new EventHandler(this.cmbBackColorSelectedValueChanged); |
||||
|
||||
|
||||
cbBold.CheckedChanged += new EventHandler(this.cbBoldCheckedChanged); |
||||
cbItalic.CheckedChanged += new EventHandler(this.cbItalicCheckedChanged); |
||||
cbUnderline.CheckedChanged += new EventHandler(this.cbUnderlineCheckedChanged); |
||||
|
||||
lstElements.SelectedValueChanged += new EventHandler(this.lstElementsSelectedValueChanged); |
||||
} |
||||
|
||||
void ListColors() |
||||
{ |
||||
foreach (Color c in System.ComponentModel.TypeDescriptor.GetConverter(typeof (Color)).GetStandardValues()) { |
||||
Colors.Add(c); |
||||
} |
||||
} |
||||
|
||||
void btnSelectFontClick(object sender, EventArgs e) |
||||
{ |
||||
if (fdSelectFont.ShowDialog() == DialogResult.OK) { |
||||
lblOffsetPreview.Font = new Font(fdSelectFont.Font, FontStyle.Regular); |
||||
lblDataPreview.Font = new Font(fdSelectFont.Font, FontStyle.Regular); |
||||
|
||||
FontName = fdSelectFont.Font.Name; |
||||
FontSize = fdSelectFont.Font.Size; |
||||
|
||||
if (OffsetBold) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Bold); |
||||
if (OffsetItalic) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Italic); |
||||
if (OffsetUnderline) lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Underline); |
||||
|
||||
if (DataBold) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Bold); |
||||
if (DataItalic) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Italic); |
||||
if (DataUnderline) lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Underline); |
||||
} |
||||
} |
||||
|
||||
void cmbForeColorSelectedValueChanged(object sender, EventArgs e) |
||||
{ |
||||
if (lstElements.SelectedIndex != -1) { |
||||
if (cmbForeColor.SelectedIndex == 0) { |
||||
if (fcmanualchange) { |
||||
ColorDialog cdColor = new ColorDialog(); |
||||
if (cdColor.ShowDialog() == DialogResult.OK) { |
||||
customFore = cdColor.Color; |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetForeColor = customFore; |
||||
break; |
||||
case 1 : |
||||
DataForeColor = customFore; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
if (cmbForeColor.SelectedIndex == -1) cmbForeColor.SelectedIndex = 0; |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetForeColor = Color.FromName(cmbForeColor.Items[cmbForeColor.SelectedIndex].ToString()); |
||||
break; |
||||
case 1 : |
||||
DataForeColor = Color.FromName(cmbForeColor.Items[cmbForeColor.SelectedIndex].ToString()); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
lblOffsetPreview.ForeColor = OffsetForeColor; |
||||
lblOffsetPreview.BackColor = OffsetBackColor; |
||||
|
||||
lblDataPreview.ForeColor = DataForeColor; |
||||
lblDataPreview.BackColor = DataBackColor; |
||||
} else { |
||||
MessageService.ShowError("Please select an element first!"); |
||||
} |
||||
fcmanualchange = false; |
||||
} |
||||
|
||||
void cmbBackColorSelectedValueChanged(object sender, EventArgs e) |
||||
{ |
||||
if (lstElements.SelectedIndex != -1) { |
||||
if (cmbBackColor.SelectedIndex == 0) { |
||||
if (bcmanualchange) { |
||||
ColorDialog cdColor = new ColorDialog(); |
||||
if (cdColor.ShowDialog() == DialogResult.OK) { |
||||
customBack = cdColor.Color; |
||||
switch (lstElements.SelectedIndex) |
||||
{ |
||||
case 0 : |
||||
OffsetBackColor = customBack; |
||||
break; |
||||
case 1 : |
||||
DataBackColor = customBack; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
if (cmbBackColor.SelectedIndex == -1) cmbBackColor.SelectedIndex = 0; |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetBackColor = Color.FromName(cmbBackColor.Items[cmbBackColor.SelectedIndex].ToString()); |
||||
break; |
||||
case 1 : |
||||
DataBackColor = Color.FromName(cmbBackColor.Items[cmbBackColor.SelectedIndex].ToString()); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
lblOffsetPreview.ForeColor = OffsetForeColor; |
||||
lblOffsetPreview.BackColor = OffsetBackColor; |
||||
|
||||
lblDataPreview.ForeColor = DataForeColor; |
||||
lblDataPreview.BackColor = DataBackColor; |
||||
} else { |
||||
MessageService.ShowError("Please select an element first!"); |
||||
} |
||||
bcmanualchange = false; |
||||
} |
||||
|
||||
void cmbForeColorDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) |
||||
{ |
||||
Rectangle rc = new Rectangle(e.Bounds.X, e.Bounds.Y, |
||||
e.Bounds.Width, e.Bounds.Height); |
||||
Rectangle rc2 = new Rectangle(e.Bounds.X + 20, e.Bounds.Y, |
||||
e.Bounds.Width, e.Bounds.Height); |
||||
Rectangle rc3 = new Rectangle(e.Bounds.X + 5, e.Bounds.Y + 2, 10, 10); |
||||
|
||||
string str; |
||||
Color color; |
||||
if (e.Index != -1) { |
||||
str = (string)cmbForeColor.Items[e.Index]; |
||||
} else { |
||||
str = (string)cmbForeColor.Items[0]; |
||||
} |
||||
|
||||
if (str == "Custom") { |
||||
color = customFore; |
||||
} else { |
||||
color = Color.FromName(str); |
||||
} |
||||
|
||||
if ( e.State == (DrawItemState.Selected | DrawItemState.Focus | DrawItemState.NoAccelerator | DrawItemState.NoFocusRect)) { |
||||
e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight) , rc); |
||||
e.Graphics.DrawString( str , cmbForeColor.Font, new SolidBrush(Color.White), rc2); |
||||
e.Graphics.FillRectangle(new SolidBrush(color), rc3); |
||||
e.Graphics.DrawRectangle(Pens.White, rc3); |
||||
} else { |
||||
e.Graphics.FillRectangle(new SolidBrush(Color.White) , rc); |
||||
e.Graphics.DrawString( str , cmbForeColor.Font, new SolidBrush(Color.Black), rc2); |
||||
e.Graphics.FillRectangle(new SolidBrush(color), rc3); |
||||
e.Graphics.DrawRectangle(Pens.Black, rc3); |
||||
} |
||||
} |
||||
|
||||
void cmbBackColorDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) |
||||
{ |
||||
Rectangle rc = new Rectangle(e.Bounds.X, e.Bounds.Y, |
||||
e.Bounds.Width, e.Bounds.Height); |
||||
Rectangle rc2 = new Rectangle(e.Bounds.X + 20, e.Bounds.Y, |
||||
e.Bounds.Width, e.Bounds.Height); |
||||
Rectangle rc3 = new Rectangle(e.Bounds.X + 5, e.Bounds.Y + 2, 10, 10); |
||||
|
||||
string str; |
||||
Color color; |
||||
if (e.Index != -1) { |
||||
str = (string)cmbBackColor.Items[e.Index]; |
||||
} else { |
||||
str = (string)cmbBackColor.Items[0]; |
||||
} |
||||
|
||||
if (str == "Custom") { |
||||
color = customBack; |
||||
} else { |
||||
color = Color.FromName(str); |
||||
} |
||||
|
||||
if ( e.State == (DrawItemState.Selected | DrawItemState.Focus | DrawItemState.NoAccelerator | DrawItemState.NoFocusRect)) { |
||||
e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight) , rc); |
||||
e.Graphics.DrawString(str , cmbBackColor.Font, new SolidBrush(Color.White), rc2); |
||||
e.Graphics.FillRectangle(new SolidBrush(color), rc3); |
||||
e.Graphics.DrawRectangle(Pens.White, rc3); |
||||
} else { |
||||
e.Graphics.FillRectangle(new SolidBrush(Color.White), rc); |
||||
e.Graphics.DrawString(str , cmbBackColor.Font, new SolidBrush(Color.Black), rc2); |
||||
e.Graphics.FillRectangle(new SolidBrush(color), rc3); |
||||
e.Graphics.DrawRectangle(Pens.Black, rc3); |
||||
} |
||||
} |
||||
|
||||
void cbBoldCheckedChanged(object sender, EventArgs e) |
||||
{ |
||||
if (lstElements.SelectedIndex != -1) { |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetBold = cbBold.Checked; |
||||
if ((cbBold.Checked & !lblOffsetPreview.Font.Bold) ^ (!cbBold.Checked & lblOffsetPreview.Font.Bold)) |
||||
lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Bold); |
||||
break; |
||||
case 1 : |
||||
DataBold = cbBold.Checked; |
||||
if ((cbBold.Checked & !lblDataPreview.Font.Bold) ^ (!cbBold.Checked & lblDataPreview.Font.Bold)) |
||||
lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Bold); |
||||
break; |
||||
} |
||||
} else { |
||||
MessageService.ShowError("Please select an element first!"); |
||||
} |
||||
} |
||||
|
||||
void cbItalicCheckedChanged(object sender, EventArgs e) |
||||
{ |
||||
if (lstElements.SelectedIndex != -1) { |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetItalic = cbItalic.Checked; |
||||
if ((cbItalic.Checked & !lblOffsetPreview.Font.Italic) || (!cbItalic.Checked & lblOffsetPreview.Font.Italic)) |
||||
lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Italic); |
||||
break; |
||||
case 1 : |
||||
DataItalic = cbItalic.Checked; |
||||
if ((cbItalic.Checked & !lblDataPreview.Font.Italic) || (!cbItalic.Checked & lblDataPreview.Font.Italic)) |
||||
lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Italic); |
||||
break; |
||||
} |
||||
} else { |
||||
MessageService.ShowError("Please select an element first!"); |
||||
} |
||||
} |
||||
|
||||
void cbUnderlineCheckedChanged(object sender, EventArgs e) |
||||
{ |
||||
if (lstElements.SelectedIndex != -1) { |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
OffsetUnderline = cbUnderline.Checked; |
||||
if ((cbUnderline.Checked & !lblOffsetPreview.Font.Underline) || (!cbUnderline.Checked & lblOffsetPreview.Font.Underline)) |
||||
lblOffsetPreview.Font = new Font(lblOffsetPreview.Font, lblOffsetPreview.Font.Style ^ FontStyle.Underline); |
||||
break; |
||||
case 1 : |
||||
DataUnderline = cbUnderline.Checked; |
||||
if ((cbUnderline.Checked & !lblDataPreview.Font.Underline) || (!cbUnderline.Checked & lblDataPreview.Font.Underline)) |
||||
lblDataPreview.Font = new Font(lblDataPreview.Font, lblDataPreview.Font.Style ^ FontStyle.Underline); |
||||
break; |
||||
} |
||||
} else { |
||||
MessageService.ShowError("Please select an element first!"); |
||||
} |
||||
} |
||||
|
||||
void lstElementsSelectedValueChanged(object sender, EventArgs e) |
||||
{ |
||||
switch (lstElements.SelectedIndex) { |
||||
case 0 : |
||||
cbBold.Checked = OffsetBold; |
||||
cbItalic.Checked = OffsetItalic; |
||||
cbUnderline.Checked = OffsetUnderline; |
||||
|
||||
if (OffsetForeColor == customFore) { |
||||
cmbForeColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbForeColor.SelectedIndex = cmbForeColor.Items.IndexOf(OffsetForeColor.Name); |
||||
} |
||||
if (OffsetBackColor == customBack) { |
||||
cmbBackColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbBackColor.SelectedIndex = cmbBackColor.Items.IndexOf(OffsetBackColor.Name); |
||||
} |
||||
break; |
||||
case 1 : |
||||
cbBold.Checked = DataBold; |
||||
cbItalic.Checked = DataItalic; |
||||
cbUnderline.Checked = DataUnderline; |
||||
|
||||
if (DataForeColor == customFore) { |
||||
cmbForeColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbForeColor.SelectedIndex = cmbForeColor.Items.IndexOf(DataForeColor.Name); |
||||
} |
||||
if (DataBackColor == customBack) { |
||||
cmbBackColor.SelectedIndex = 0; |
||||
} else { |
||||
cmbBackColor.SelectedIndex = cmbBackColor.Items.IndexOf(DataBackColor.Name); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
void cmbForeColorDropDown(object sender, EventArgs e) |
||||
{ |
||||
fcmanualchange = true; |
||||
} |
||||
|
||||
void cmbBackColorDropDown(object sender, EventArgs e) |
||||
{ |
||||
bcmanualchange = true; |
||||
} |
||||
|
||||
bool IsNamedColor(Color color) |
||||
{ |
||||
foreach (Color c in Colors) { |
||||
if (c.A == color.A) { |
||||
if (c.R == color.R) { |
||||
if (c.G == color.G) { |
||||
if (c.B == color.B) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
string GetColorName(Color color) |
||||
{ |
||||
if (IsNamedColor(color)) { |
||||
foreach (Color c in Colors) { |
||||
if (c.A == color.A) { |
||||
if (c.R == color.R) { |
||||
if (c.G == color.G) { |
||||
if (c.B == color.B) { |
||||
return c.Name; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return String.Empty; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace HexEditor.View |
||||
{ |
||||
public class HexEditView : AbstractViewContent, IClipboardHandler, IUndoHandler |
||||
{ |
||||
HexEditContainer hexEditContainer; |
||||
|
||||
public HexEditView(OpenedFile file) |
||||
{ |
||||
hexEditContainer = new HexEditContainer(); |
||||
hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged); |
||||
|
||||
this.Files.Add(file); |
||||
|
||||
file.ForceInitializeView(this); |
||||
} |
||||
|
||||
public override System.Windows.Forms.Control Control { |
||||
get { return hexEditContainer; } |
||||
} |
||||
|
||||
public override void Save(OpenedFile file, Stream stream) |
||||
{ |
||||
this.hexEditContainer.SaveFile(file, stream); |
||||
this.TitleName = Path.GetFileName(file.FileName); |
||||
this.TabPageText = this.TitleName; |
||||
} |
||||
|
||||
public override void Load(OpenedFile file, Stream stream) |
||||
{ |
||||
this.hexEditContainer.LoadFile(file, stream); |
||||
} |
||||
|
||||
public override bool IsReadOnly { |
||||
get { return false; } |
||||
} |
||||
|
||||
#region IClipboardHandler
|
||||
public bool EnableCut { |
||||
get { return hexEditContainer.HasSelection & hexEditContainer.EditorFocused; } |
||||
} |
||||
|
||||
public bool EnableCopy { |
||||
get { return hexEditContainer.HasSelection & hexEditContainer.EditorFocused; } |
||||
} |
||||
|
||||
public bool EnablePaste { |
||||
get { return hexEditContainer.EditorFocused; } |
||||
} |
||||
|
||||
public bool EnableDelete { |
||||
get { return hexEditContainer.HasSelection & hexEditContainer.EditorFocused; } |
||||
} |
||||
|
||||
public bool EnableSelectAll { |
||||
get { return hexEditContainer.EditorFocused; } |
||||
} |
||||
|
||||
public void Cut() |
||||
{ |
||||
if (hexEditContainer.HasSelection) ClipboardWrapper.SetText(hexEditContainer.Cut()); |
||||
} |
||||
|
||||
public void Copy() |
||||
{ |
||||
if (hexEditContainer.HasSelection) ClipboardWrapper.SetText(hexEditContainer.Copy()); |
||||
} |
||||
|
||||
public void Paste() |
||||
{ |
||||
hexEditContainer.Paste(ClipboardWrapper.GetText()); |
||||
} |
||||
|
||||
public void Delete() |
||||
{ |
||||
if (hexEditContainer.HasSelection) hexEditContainer.Delete(); |
||||
} |
||||
|
||||
public void SelectAll() |
||||
{ |
||||
hexEditContainer.SelectAll(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region IUndoHandler
|
||||
public bool EnableUndo { |
||||
get { return hexEditContainer.CanUndo; } |
||||
} |
||||
|
||||
public bool EnableRedo { |
||||
get { return hexEditContainer.CanRedo; } |
||||
} |
||||
|
||||
public void Undo() |
||||
{ |
||||
if (hexEditContainer.CanUndo) hexEditContainer.Undo(); |
||||
} |
||||
|
||||
public void Redo() |
||||
{ |
||||
if (hexEditContainer.CanRedo) hexEditContainer.Redo(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
void DocumentChanged(object sender, EventArgs e) |
||||
{ |
||||
if (PrimaryFile != null) PrimaryFile.MakeDirty(); |
||||
} |
||||
|
||||
public override bool IsDirty { |
||||
get { return base.IsDirty; } |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
LIST OF CHANGES |
||||
|
||||
version: 0.0.1 |
||||
|
||||
24.03.2007: Start of the project |
||||
20.04.2007: release of alpha 1 |
||||
21.04.2007: bug fixing, display/scrolling improvements |
||||
28.04.2007: Selection functionality implemented partly |
||||
26.09.2007: Use of double buffering for painting and selection painting bugs fixed |
||||
27.09.2007: Several selection bugs fixed. |
||||
13.10.2007: Many bugs fixed and integration in SD. |
||||
28.10.2007: Many other bugfixes and finishing alpha 2. |
||||
|
||||
version: 0.0.2 |
||||
|
||||
18.02.2008: Final version for SD 3.0.0.2951 |
||||
20.02.2008: Implementation as DisplayBinding finished |
||||
22.02.2008: Clean up and commenting. |
||||
Loading…
Reference in new issue