├── EngineClasses
├── obj
│ └── Debug
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── EngineClasses.dll
│ │ ├── EngineClasses.pdb
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── EngineClasses.csprojResolveAssemblyReference.cache
│ │ └── EngineClasses.csproj.FileListAbsolute.txt
├── bin
│ └── Debug
│ │ ├── EngineClasses.dll
│ │ ├── EngineClasses.pdb
│ │ └── ICSharpCode.SharpZipLib.dll
├── dll
│ └── ICSharpCode.SharpZipLib.dll
├── Properties
│ └── AssemblyInfo.cs
├── EngineClasses.csproj
├── Helpers.cs
└── UPKFile.cs
├── RLExplorerWV
├── obj
│ └── Debug
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── RLExplorerWV.exe
│ │ ├── RLExplorerWV.pdb
│ │ ├── RLExplorerWV.Form1.resources
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── RLExplorerWV.csproj.GenerateResource.Cache
│ │ ├── RLExplorerWV.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── RLExplorerWV.csprojResolveAssemblyReference.cache
│ │ └── RLExplorerWV.csproj.FileListAbsolute.txt
├── bin
│ └── Debug
│ │ ├── EngineClasses.dll
│ │ ├── EngineClasses.pdb
│ │ ├── RLExplorerWV.exe
│ │ ├── RLExplorerWV.pdb
│ │ ├── RLExplorerWV.vshost.exe
│ │ ├── Be.Windows.Forms.HexBox.dll
│ │ ├── Be.Windows.Forms.HexBox.pdb
│ │ ├── ICSharpCode.SharpZipLib.dll
│ │ ├── RLExplorerWV.exe.config
│ │ ├── RLExplorerWV.vshost.exe.config
│ │ └── RLExplorerWV.vshost.exe.manifest
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── RLExplorerWV.csproj
├── Form1.resx
├── Form1.cs
└── Form1.Designer.cs
├── RLExplorerWV.v11.suo
├── Be.Windows.Forms.HexBox
├── HexBox.cs
├── HexBox.bmp
├── HexBox.snk
├── IByteProvider.cs
├── bin
│ └── Debug
│ │ ├── Be.Windows.Forms.HexBox.dll
│ │ └── Be.Windows.Forms.HexBox.pdb
├── obj
│ └── Debug
│ │ ├── Be.Windows.Forms.HexBox.dll
│ │ ├── Be.Windows.Forms.HexBox.pdb
│ │ ├── Be.Windows.Forms.HexBox.resources
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── TempPE
│ │ └── Properties.Resources.Designer.cs.dll
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── Be.Windows.Forms.Properties.Resources.resources
│ │ ├── Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
│ │ ├── Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
│ │ └── Be.Windows.Forms.HexBox.csproj.FileListAbsolute.txt
├── HexCasing.cs
├── BytePositionInfo.cs
├── NativeMethods.cs
├── DataBlock.cs
├── Util.cs
├── MemoryDataBlock.cs
├── FileDataBlock.cs
├── FindOptions.cs
├── Properties
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── AssemblyInfo.cs
├── ByteCollection.cs
├── ByteCharConverters.cs
├── DynamicByteProvider.cs
├── HexBox.resx
├── FileByteProvider.cs
├── Be.Windows.Forms.HexBox.csproj
├── DataMap.cs
├── BuiltInContextMenu.cs
└── DynamicFileByteProvider.cs
├── README.md
├── .gitattributes
└── RLExplorerWV.sln
/EngineClasses/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RLExplorerWV.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV.v11.suo
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/HexBox.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/HexBox.cs
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/HexBox.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/HexBox.bmp
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/HexBox.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/HexBox.snk
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/IByteProvider.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/IByteProvider.cs
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/EngineClasses.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/EngineClasses.dll
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/EngineClasses.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/EngineClasses.pdb
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/RLExplorerWV.exe
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/RLExplorerWV.pdb
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.exe
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.pdb
--------------------------------------------------------------------------------
/EngineClasses/bin/Debug/EngineClasses.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/bin/Debug/EngineClasses.dll
--------------------------------------------------------------------------------
/EngineClasses/bin/Debug/EngineClasses.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/bin/Debug/EngineClasses.pdb
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/EngineClasses.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/obj/Debug/EngineClasses.dll
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/EngineClasses.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/obj/Debug/EngineClasses.pdb
--------------------------------------------------------------------------------
/EngineClasses/dll/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/dll/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/RLExplorerWV.vshost.exe
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/Be.Windows.Forms.HexBox.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/Be.Windows.Forms.HexBox.dll
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/Be.Windows.Forms.HexBox.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/Be.Windows.Forms.HexBox.pdb
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/bin/Debug/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/EngineClasses/bin/Debug/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/bin/Debug/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Rocket League Explorer by Warranty Voider
2 |
3 | tool to browse game files
4 |
5 | screenshot: http://fs5.directupload.net/images/151209/9ba34qlo.jpg
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.Form1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.Form1.resources
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/bin/Debug/Be.Windows.Forms.HexBox.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/bin/Debug/Be.Windows.Forms.HexBox.dll
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/bin/Debug/Be.Windows.Forms.HexBox.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/bin/Debug/Be.Windows.Forms.HexBox.pdb
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.dll
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.pdb
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.resources
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.Properties.Resources.resources
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/RLExplorerWV/obj/Debug/RLExplorerWV.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/EngineClasses.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/EngineClasses/obj/Debug/EngineClasses.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.Properties.Resources.resources
--------------------------------------------------------------------------------
/RLExplorerWV/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeroKilo/RLExplorerWV/HEAD/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RLExplorerWV/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/RLExplorerWV/bin/Debug/RLExplorerWV.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/HexCasing.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Specifies the case of hex characters in the HexBox control
9 | ///
10 | public enum HexCasing
11 | {
12 | ///
13 | /// Converts all characters to uppercase.
14 | ///
15 | Upper = 0,
16 | ///
17 | /// Converts all characters to lowercase.
18 | ///
19 | Lower = 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/RLExplorerWV/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace RLExplorerWV
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// Der Haupteinstiegspunkt für die Anwendung.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/BytePositionInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Represents a position in the HexBox control
9 | ///
10 | struct BytePositionInfo
11 | {
12 | public BytePositionInfo(long index, int characterPosition)
13 | {
14 | _index = index;
15 | _characterPosition = characterPosition;
16 | }
17 |
18 | public int CharacterPosition
19 | {
20 | get { return _characterPosition; }
21 | } int _characterPosition;
22 |
23 | public long Index
24 | {
25 | get { return _index; }
26 | } long _index;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | internal static class NativeMethods
8 | {
9 | // Caret definitions
10 | [DllImport("user32.dll", SetLastError=true)]
11 | public static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);
12 |
13 | [DllImport("user32.dll", SetLastError=true)]
14 | public static extern bool ShowCaret(IntPtr hWnd);
15 |
16 | [DllImport("user32.dll", SetLastError=true)]
17 | public static extern bool DestroyCaret();
18 |
19 | [DllImport("user32.dll", SetLastError=true)]
20 | public static extern bool SetCaretPos(int X, int Y);
21 |
22 | // Key definitions
23 | public const int WM_KEYDOWN = 0x100;
24 | public const int WM_KEYUP = 0x101;
25 | public const int WM_CHAR = 0x102;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/EngineClasses/obj/Debug/EngineClasses.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | D:\CODE\c#\RLExplorerWV\EngineClasses\bin\Debug\EngineClasses.dll
2 | D:\CODE\c#\RLExplorerWV\EngineClasses\bin\Debug\EngineClasses.pdb
3 | D:\CODE\c#\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.dll
4 | D:\CODE\c#\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.pdb
5 | D:\CODE\c#\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.csprojResolveAssemblyReference.cache
6 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\bin\Debug\EngineClasses.dll
7 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\bin\Debug\EngineClasses.pdb
8 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.csprojResolveAssemblyReference.cache
9 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.dll
10 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\obj\Debug\EngineClasses.pdb
11 | D:\CODE\GitHub\RLExplorerWV\EngineClasses\bin\Debug\ICSharpCode.SharpZipLib.dll
12 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/DataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal abstract class DataBlock
6 | {
7 | internal DataMap _map;
8 | internal DataBlock _nextBlock;
9 | internal DataBlock _previousBlock;
10 |
11 | public abstract long Length
12 | {
13 | get;
14 | }
15 |
16 | public DataMap Map
17 | {
18 | get
19 | {
20 | return _map;
21 | }
22 | }
23 |
24 | public DataBlock NextBlock
25 | {
26 | get
27 | {
28 | return _nextBlock;
29 | }
30 | }
31 |
32 | public DataBlock PreviousBlock
33 | {
34 | get
35 | {
36 | return _previousBlock;
37 | }
38 | }
39 |
40 | public abstract void RemoveBytes(long position, long count);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/RLExplorerWV/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34209
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RLExplorerWV.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | static class Util
8 | {
9 | ///
10 | /// Contains true, if we are in design mode of Visual Studio
11 | ///
12 | private static bool _designMode;
13 |
14 | ///
15 | /// Initializes an instance of Util class
16 | ///
17 | static Util()
18 | {
19 | _designMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower() == "devenv");
20 | }
21 |
22 | ///
23 | /// Gets true, if we are in design mode of Visual Studio
24 | ///
25 | ///
26 | /// In Visual Studio 2008 SP1 the designer is crashing sometimes on windows forms.
27 | /// The DesignMode property of Control class is buggy and cannot be used, so use our own implementation instead.
28 | ///
29 | public static bool DesignMode
30 | {
31 | get
32 | {
33 | return _designMode;
34 | }
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/EngineClasses/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("EngineClasses")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("EngineClasses")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("ee54656d-71be-4506-bdbd-230a16648314")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/RLExplorerWV/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("RLExplorerWV")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("RLExplorerWV")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("1e74dd5e-b43e-41b2-aa20-6c9b4f76bb60")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/RLExplorerWV.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RLExplorerWV", "RLExplorerWV\RLExplorerWV.csproj", "{9839EDA3-623E-4158-8AF8-077206115D0F}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Be.Windows.Forms.HexBox", "Be.Windows.Forms.HexBox\Be.Windows.Forms.HexBox.csproj", "{26C5F25F-B450-4CAF-AD8B-B8D11AE73457}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EngineClasses", "EngineClasses\EngineClasses.csproj", "{206FA450-D6A8-4241-9094-77705B201A5F}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {9839EDA3-623E-4158-8AF8-077206115D0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {9839EDA3-623E-4158-8AF8-077206115D0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {9839EDA3-623E-4158-8AF8-077206115D0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {9839EDA3-623E-4158-8AF8-077206115D0F}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {206FA450-D6A8-4241-9094-77705B201A5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {206FA450-D6A8-4241-9094-77705B201A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {206FA450-D6A8-4241-9094-77705B201A5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {206FA450-D6A8-4241-9094-77705B201A5F}.Release|Any CPU.Build.0 = Release|Any CPU
28 | EndGlobalSection
29 | GlobalSection(SolutionProperties) = preSolution
30 | HideSolutionNode = FALSE
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/RLExplorerWV/obj/Debug/RLExplorerWV.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.exe.config
2 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.exe
3 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.pdb
4 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.Form1.resources
5 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.Properties.Resources.resources
6 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.csproj.GenerateResource.Cache
7 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.exe
8 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.pdb
9 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.dll
10 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\EngineClasses.dll
11 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.pdb
12 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.xml
13 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\bin\Debug\EngineClasses.pdb
14 | D:\CODE\c#\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.csprojResolveAssemblyReference.cache
15 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.exe.config
16 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.exe
17 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.pdb
18 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.exe
19 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\RLExplorerWV.pdb
20 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.dll
21 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\EngineClasses.dll
22 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.pdb
23 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\Be.Windows.Forms.HexBox.xml
24 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\EngineClasses.pdb
25 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.csprojResolveAssemblyReference.cache
26 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.Form1.resources
27 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.Properties.Resources.resources
28 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\obj\Debug\RLExplorerWV.csproj.GenerateResource.Cache
29 | D:\CODE\GitHub\RLExplorerWV\RLExplorerWV\bin\Debug\ICSharpCode.SharpZipLib.dll
30 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/MemoryDataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal sealed class MemoryDataBlock : DataBlock
6 | {
7 | byte[] _data;
8 |
9 | public MemoryDataBlock(byte data)
10 | {
11 | _data = new byte[] { data };
12 | }
13 |
14 | public MemoryDataBlock(byte[] data)
15 | {
16 | if (data == null)
17 | {
18 | throw new ArgumentNullException("data");
19 | }
20 |
21 | _data = (byte[])data.Clone();
22 | }
23 |
24 | public override long Length
25 | {
26 | get
27 | {
28 | return _data.LongLength;
29 | }
30 | }
31 |
32 | public byte[] Data
33 | {
34 | get
35 | {
36 | return _data;
37 | }
38 | }
39 |
40 | public void AddByteToEnd(byte value)
41 | {
42 | byte[] newData = new byte[_data.LongLength + 1];
43 | _data.CopyTo(newData, 0);
44 | newData[newData.LongLength - 1] = value;
45 | _data = newData;
46 | }
47 |
48 | public void AddByteToStart(byte value)
49 | {
50 | byte[] newData = new byte[_data.LongLength + 1];
51 | newData[0] = value;
52 | _data.CopyTo(newData, 1);
53 | _data = newData;
54 | }
55 |
56 | public void InsertBytes(long position, byte[] data)
57 | {
58 | byte[] newData = new byte[_data.LongLength + data.LongLength];
59 | if (position > 0)
60 | {
61 | Array.Copy(_data, 0, newData, 0, position);
62 | }
63 | Array.Copy(data, 0, newData, position, data.LongLength);
64 | if (position < _data.LongLength)
65 | {
66 | Array.Copy(_data, position, newData, position + data.LongLength, _data.LongLength - position);
67 | }
68 | _data = newData;
69 | }
70 |
71 | public override void RemoveBytes(long position, long count)
72 | {
73 | byte[] newData = new byte[_data.LongLength - count];
74 |
75 | if (position > 0)
76 | {
77 | Array.Copy(_data, 0, newData, 0, position);
78 | }
79 | if (position + count < _data.LongLength)
80 | {
81 | Array.Copy(_data, position + count, newData, position, newData.LongLength - position);
82 | }
83 |
84 | _data = newData;
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/FileDataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal sealed class FileDataBlock : DataBlock
6 | {
7 | long _length;
8 | long _fileOffset;
9 |
10 | public FileDataBlock(long fileOffset, long length)
11 | {
12 | _fileOffset = fileOffset;
13 | _length = length;
14 | }
15 |
16 | public long FileOffset
17 | {
18 | get
19 | {
20 | return _fileOffset;
21 | }
22 | }
23 |
24 | public override long Length
25 | {
26 | get
27 | {
28 | return _length;
29 | }
30 | }
31 |
32 | public void SetFileOffset(long value)
33 | {
34 | _fileOffset = value;
35 | }
36 |
37 | public void RemoveBytesFromEnd(long count)
38 | {
39 | if (count > _length)
40 | {
41 | throw new ArgumentOutOfRangeException("count");
42 | }
43 |
44 | _length -= count;
45 | }
46 |
47 | public void RemoveBytesFromStart(long count)
48 | {
49 | if (count > _length)
50 | {
51 | throw new ArgumentOutOfRangeException("count");
52 | }
53 |
54 | _fileOffset += count;
55 | _length -= count;
56 | }
57 |
58 | public override void RemoveBytes(long position, long count)
59 | {
60 | if (position > _length)
61 | {
62 | throw new ArgumentOutOfRangeException("position");
63 | }
64 |
65 | if (position + count > _length)
66 | {
67 | throw new ArgumentOutOfRangeException("count");
68 | }
69 |
70 | long prefixLength = position;
71 | long prefixFileOffset = _fileOffset;
72 |
73 | long suffixLength = _length - count - prefixLength;
74 | long suffixFileOffset = _fileOffset + position + count;
75 |
76 | if (prefixLength > 0 && suffixLength > 0)
77 | {
78 | _fileOffset = prefixFileOffset;
79 | _length = prefixLength;
80 | _map.AddAfter(this, new FileDataBlock(suffixFileOffset, suffixLength));
81 | return;
82 | }
83 |
84 | if (prefixLength > 0)
85 | {
86 | _fileOffset = prefixFileOffset;
87 | _length = prefixLength;
88 | }
89 | else
90 | {
91 | _fileOffset = suffixFileOffset;
92 | _length = suffixLength;
93 | }
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/EngineClasses/EngineClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {206FA450-D6A8-4241-9094-77705B201A5F}
8 | Library
9 | Properties
10 | EngineClasses
11 | EngineClasses
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | dll\ICSharpCode.SharpZipLib.dll
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
57 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/FindOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Defines the type of the Find operation.
9 | ///
10 | public enum FindType
11 | {
12 | ///
13 | /// Used for Text Find operations
14 | ///
15 | Text,
16 | ///
17 | /// Used for Hex Find operations
18 | ///
19 | Hex
20 | }
21 |
22 | ///
23 | /// Defines all state information nee
24 | ///
25 | public class FindOptions
26 | {
27 | ///
28 | /// Gets or sets whether the Find options are valid
29 | ///
30 | public bool IsValid { get; set; }
31 | ///
32 | /// Gets the Find buffer used for case insensitive Find operations. This is the binary representation of Text.
33 | ///
34 | internal byte[] FindBuffer { get; private set; }
35 | ///
36 | /// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in lower case format.
37 | ///
38 | internal byte[] FindBufferLowerCase { get; private set; }
39 | ///
40 | /// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in upper case format.
41 | ///
42 | internal byte[] FindBufferUpperCase { get; private set; }
43 | ///
44 | /// Contains the MatchCase value
45 | ///
46 | bool _matchCase;
47 | ///
48 | /// Gets or sets the value, whether the Find operation is case sensitive or not.
49 | ///
50 | public bool MatchCase
51 | {
52 | get { return _matchCase; }
53 | set
54 | {
55 | _matchCase = value;
56 | UpdateFindBuffer();
57 | }
58 | }
59 | ///
60 | /// Contains the text that should be found.
61 | ///
62 | string _text;
63 | ///
64 | /// Gets or sets the text that should be found. Only used, when Type is FindType.Hex.
65 | ///
66 | public string Text
67 | {
68 | get { return _text; }
69 | set
70 | {
71 | _text = value;
72 | UpdateFindBuffer();
73 | }
74 | }
75 | ///
76 | /// Gets or sets the hex buffer that should be found. Only used, when Type is FindType.Hex.
77 | ///
78 | public byte[] Hex { get; set; }
79 | ///
80 | /// Gets or sets the type what should be searched.
81 | ///
82 | public FindType Type { get; set; }
83 | ///
84 | /// Updates the find buffer.
85 | ///
86 | void UpdateFindBuffer()
87 | {
88 | string text = this.Text != null ? this.Text : string.Empty;
89 | FindBuffer = ASCIIEncoding.ASCII.GetBytes(text);
90 | FindBufferLowerCase = ASCIIEncoding.ASCII.GetBytes(text.ToLower());
91 | FindBufferUpperCase = ASCIIEncoding.ASCII.GetBytes(text.ToUpper());
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Be.Windows.Forms.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Be.Windows.Forms.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Security.Permissions;
5 | using System.Runtime.InteropServices;
6 |
7 | //
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | //
12 | [assembly: AssemblyTitle("Be.Windows.Forms.HexBox")]
13 | [assembly: AssemblyDescription("hex edit control (C# DOTNET)")]
14 | [assembly: AssemblyConfiguration("")]
15 | [assembly: AssemblyCompany("Be")]
16 | [assembly: AssemblyProduct("Be.Windows.Forms.HexBox")]
17 | [assembly: AssemblyCopyright("")]
18 | [assembly: AssemblyTrademark("")]
19 | [assembly: AssemblyCulture("")]
20 |
21 | //
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Revision and Build Numbers
30 | // by using the '*' as shown below:
31 |
32 | [assembly: AssemblyVersion("1.4.7.*")]
33 |
34 | //
35 | // In order to sign your assembly you must specify a key to use. Refer to the
36 | // Microsoft .NET Framework documentation for more information on assembly signing.
37 | //
38 | // Use the attributes below to control which key is used for signing.
39 | //
40 | // Notes:
41 | // (*) If no key is specified, the assembly is not signed.
42 | // (*) KeyName refers to a key that has been installed in the Crypto Service
43 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
44 | // a key.
45 | // (*) If the KeyFile and the KeyName values are both specified, the
46 | // following processing occurs:
47 | // (1) If the KeyName can be found in the CSP, that key is used.
48 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
49 | // in the KeyFile is installed into the CSP and used.
50 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
51 | // When specifying the KeyFile, the location of the KeyFile should be
52 | // relative to the project output directory which is
53 | // %Project Directory%\obj\. For example, if your KeyFile is
54 | // located in the project directory, you would specify the AssemblyKeyFile
55 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
56 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
57 | // documentation for more information on this.
58 | //
59 | [assembly: AssemblyDelaySign(false)]
60 |
61 | //[assembly: AssemblyKeyFile("../../HexBox.snk")]
62 | //[assembly: AssemblyKeyName("")]
63 |
64 | //[assembly:IsolatedStorageFilePermission(SecurityAction.RequestRefuse, UserQuota=1048576)]
65 | //[assembly:SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode=true)]
66 | //[assembly:FileIOPermission(SecurityAction.RequestOptional, Unrestricted=true)]
67 |
68 | [assembly:CLSCompliant(true)]
69 |
70 | [assembly:ComVisible(false)]
--------------------------------------------------------------------------------
/RLExplorerWV/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.34209
5 | //
6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
7 | // der Code neu generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RLExplorerWV.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RLExplorerWV.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/ByteCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Collections;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Represents a collection of bytes.
9 | ///
10 | public class ByteCollection : CollectionBase
11 | {
12 | ///
13 | /// Initializes a new instance of ByteCollection class.
14 | ///
15 | public ByteCollection() { }
16 |
17 | ///
18 | /// Initializes a new instance of ByteCollection class.
19 | ///
20 | /// an array of bytes to add to collection
21 | public ByteCollection(byte[] bs)
22 | { AddRange(bs); }
23 |
24 | ///
25 | /// Gets or sets the value of a byte
26 | ///
27 | public byte this[int index]
28 | {
29 | get { return (byte)List[index]; }
30 | set { List[index] = value; }
31 | }
32 |
33 | ///
34 | /// Adds a byte into the collection.
35 | ///
36 | /// the byte to add
37 | public void Add(byte b)
38 | { List.Add(b); }
39 |
40 | ///
41 | /// Adds a range of bytes to the collection.
42 | ///
43 | /// the bytes to add
44 | public void AddRange(byte[] bs)
45 | { InnerList.AddRange(bs); }
46 |
47 | ///
48 | /// Removes a byte from the collection.
49 | ///
50 | /// the byte to remove
51 | public void Remove(byte b)
52 | { List.Remove(b); }
53 |
54 | ///
55 | /// Removes a range of bytes from the collection.
56 | ///
57 | /// the index of the start byte
58 | /// the count of the bytes to remove
59 | public void RemoveRange(int index, int count)
60 | { InnerList.RemoveRange(index, count); }
61 |
62 | ///
63 | /// Inserts a range of bytes to the collection.
64 | ///
65 | /// the index of start byte
66 | /// an array of bytes to insert
67 | public void InsertRange(int index, byte[] bs)
68 | { InnerList.InsertRange(index, bs); }
69 |
70 | ///
71 | /// Gets all bytes in the array
72 | ///
73 | /// an array of bytes.
74 | public byte[] GetBytes()
75 | {
76 | byte[] bytes = new byte[Count];
77 | InnerList.CopyTo(0, bytes, 0, bytes.Length);
78 | return bytes;
79 | }
80 |
81 | ///
82 | /// Inserts a byte to the collection.
83 | ///
84 | /// the index
85 | /// a byte to insert
86 | public void Insert(int index, byte b)
87 | {
88 | InnerList.Insert(index, b);
89 | }
90 |
91 | ///
92 | /// Returns the index of the given byte.
93 | ///
94 | public int IndexOf(byte b)
95 | {
96 | return InnerList.IndexOf(b);
97 | }
98 |
99 | ///
100 | /// Returns true, if the byte exists in the collection.
101 | ///
102 | public bool Contains(byte b)
103 | {
104 | return InnerList.Contains(b);
105 | }
106 |
107 | ///
108 | /// Copies the content of the collection into the given array.
109 | ///
110 | public void CopyTo(byte[] bs, int index)
111 | {
112 | InnerList.CopyTo(bs, index);
113 | }
114 |
115 | ///
116 | /// Copies the content of the collection into an array.
117 | ///
118 | /// the array containing all bytes.
119 | public byte[] ToArray()
120 | {
121 | byte[] data = new byte[this.Count];
122 | this.CopyTo(data, 0);
123 | return data;
124 | }
125 |
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/ByteCharConverters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// The interface for objects that can translate between characters and bytes.
9 | ///
10 | public interface IByteCharConverter
11 | {
12 | ///
13 | /// Returns the character to display for the byte passed across.
14 | ///
15 | ///
16 | ///
17 | char ToChar(byte b);
18 |
19 | ///
20 | /// Returns the byte to use when the character passed across is entered during editing.
21 | ///
22 | ///
23 | ///
24 | byte ToByte(char c);
25 | }
26 |
27 | ///
28 | /// The default implementation.
29 | ///
30 | public class DefaultByteCharConverter : IByteCharConverter
31 | {
32 | ///
33 | /// Returns the character to display for the byte passed across.
34 | ///
35 | ///
36 | ///
37 | public virtual char ToChar(byte b)
38 | {
39 | return b > 0x1F && !(b > 0x7E && b < 0xA0) ? (char)b : '.';
40 | }
41 |
42 | ///
43 | /// Returns the byte to use for the character passed across.
44 | ///
45 | ///
46 | ///
47 | public virtual byte ToByte(char c)
48 | {
49 | return (byte)c;
50 | }
51 |
52 | ///
53 | /// Returns a description of the byte char provider.
54 | ///
55 | ///
56 | public override string ToString()
57 | {
58 | return "Default";
59 | }
60 | }
61 |
62 | ///
63 | /// A byte char provider that can translate bytes encoded in codepage 500 EBCDIC
64 | ///
65 | public class EbcdicByteCharProvider : IByteCharConverter
66 | {
67 | ///
68 | /// The IBM EBCDIC code page 500 encoding. Note that this is not always supported by .NET,
69 | /// the underlying platform has to provide support for it.
70 | ///
71 | private Encoding _ebcdicEncoding = Encoding.GetEncoding(500);
72 |
73 | ///
74 | /// Returns the EBCDIC character corresponding to the byte passed across.
75 | ///
76 | ///
77 | ///
78 | public virtual char ToChar(byte b)
79 | {
80 | string encoded = _ebcdicEncoding.GetString(new byte[] { b });
81 | return encoded.Length > 0 ? encoded[0] : '.';
82 | }
83 |
84 | ///
85 | /// Returns the byte corresponding to the EBCDIC character passed across.
86 | ///
87 | ///
88 | ///
89 | public virtual byte ToByte(char c)
90 | {
91 | byte[] decoded = _ebcdicEncoding.GetBytes(new char[] { c });
92 | return decoded.Length > 0 ? decoded[0] : (byte)0;
93 | }
94 |
95 | ///
96 | /// Returns a description of the byte char provider.
97 | ///
98 | ///
99 | public override string ToString()
100 | {
101 | return "EBCDIC (Code Page 500)";
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/RLExplorerWV/RLExplorerWV.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9839EDA3-623E-4158-8AF8-077206115D0F}
8 | WinExe
9 | Properties
10 | RLExplorerWV
11 | RLExplorerWV
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Form1.cs
52 |
53 |
54 |
55 |
56 | Form1.cs
57 |
58 |
59 | ResXFileCodeGenerator
60 | Resources.Designer.cs
61 | Designer
62 |
63 |
64 | True
65 | Resources.resx
66 |
67 |
68 | SettingsSingleFileGenerator
69 | Settings.Designer.cs
70 |
71 |
72 | True
73 | Settings.settings
74 | True
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}
83 | Be.Windows.Forms.HexBox
84 |
85 |
86 | {206fa450-d6a8-4241-9094-77705b201a5f}
87 | EngineClasses
88 |
89 |
90 |
91 |
98 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/DynamicByteProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Be.Windows.Forms
5 | {
6 | ///
7 | /// Byte provider for a small amount of data.
8 | ///
9 | public class DynamicByteProvider : IByteProvider
10 | {
11 | ///
12 | /// Contains information about changes.
13 | ///
14 | bool _hasChanges;
15 | ///
16 | /// Contains a byte collection.
17 | ///
18 | List _bytes;
19 |
20 | ///
21 | /// Initializes a new instance of the DynamicByteProvider class.
22 | ///
23 | ///
24 | public DynamicByteProvider(byte[] data) : this(new List(data))
25 | {
26 | }
27 |
28 | ///
29 | /// Initializes a new instance of the DynamicByteProvider class.
30 | ///
31 | ///
32 | public DynamicByteProvider(List bytes)
33 | {
34 | _bytes = bytes;
35 | }
36 |
37 | ///
38 | /// Raises the Changed event.
39 | ///
40 | void OnChanged(EventArgs e)
41 | {
42 | _hasChanges = true;
43 |
44 | if(Changed != null)
45 | Changed(this, e);
46 | }
47 |
48 | ///
49 | /// Raises the LengthChanged event.
50 | ///
51 | void OnLengthChanged(EventArgs e)
52 | {
53 | if(LengthChanged != null)
54 | LengthChanged(this, e);
55 | }
56 |
57 | ///
58 | /// Gets the byte collection.
59 | ///
60 | public List Bytes
61 | {
62 | get { return _bytes; }
63 | }
64 |
65 | #region IByteProvider Members
66 | ///
67 | /// True, when changes are done.
68 | ///
69 | public bool HasChanges()
70 | {
71 | return _hasChanges;
72 | }
73 |
74 | ///
75 | /// Applies changes.
76 | ///
77 | public void ApplyChanges()
78 | {
79 | _hasChanges = false;
80 | }
81 |
82 | ///
83 | /// Occurs, when the write buffer contains new changes.
84 | ///
85 | public event EventHandler Changed;
86 |
87 | ///
88 | /// Occurs, when InsertBytes or DeleteBytes method is called.
89 | ///
90 | public event EventHandler LengthChanged;
91 |
92 |
93 | ///
94 | /// Reads a byte from the byte collection.
95 | ///
96 | /// the index of the byte to read
97 | /// the byte
98 | public byte ReadByte(long index)
99 | { return _bytes[(int)index]; }
100 |
101 | ///
102 | /// Write a byte into the byte collection.
103 | ///
104 | /// the index of the byte to write.
105 | /// the byte
106 | public void WriteByte(long index, byte value)
107 | {
108 | _bytes[(int)index] = value;
109 | OnChanged(EventArgs.Empty);
110 | }
111 |
112 | ///
113 | /// Deletes bytes from the byte collection.
114 | ///
115 | /// the start index of the bytes to delete.
116 | /// the length of bytes to delete.
117 | public void DeleteBytes(long index, long length)
118 | {
119 | int internal_index = (int)Math.Max(0, index);
120 | int internal_length = (int)Math.Min((int)Length, length);
121 | _bytes.RemoveRange(internal_index, internal_length);
122 |
123 | OnLengthChanged(EventArgs.Empty);
124 | OnChanged(EventArgs.Empty);
125 | }
126 |
127 | ///
128 | /// Inserts byte into the byte collection.
129 | ///
130 | /// the start index of the bytes in the byte collection
131 | /// the byte array to insert
132 | public void InsertBytes(long index, byte[] bs)
133 | {
134 | _bytes.InsertRange((int)index, bs);
135 |
136 | OnLengthChanged(EventArgs.Empty);
137 | OnChanged(EventArgs.Empty);
138 | }
139 |
140 | ///
141 | /// Gets the length of the bytes in the byte collection.
142 | ///
143 | public long Length
144 | {
145 | get
146 | {
147 | return _bytes.Count;
148 | }
149 | }
150 |
151 | ///
152 | /// Returns true
153 | ///
154 | public bool SupportsWriteByte()
155 | {
156 | return true;
157 | }
158 |
159 | ///
160 | /// Returns true
161 | ///
162 | public bool SupportsInsertBytes()
163 | {
164 | return true;
165 | }
166 |
167 | ///
168 | /// Returns true
169 | ///
170 | public bool SupportsDeleteBytes()
171 | {
172 | return true;
173 | }
174 | #endregion
175 |
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/RLExplorerWV/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/HexBox.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | False
125 |
126 |
--------------------------------------------------------------------------------
/RLExplorerWV/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | 126, 17
125 |
126 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/FileByteProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Byte provider for (big) files.
9 | ///
10 | public class FileByteProvider : IByteProvider, IDisposable
11 | {
12 | #region WriteCollection class
13 | ///
14 | /// Represents the write buffer class
15 | ///
16 | class WriteCollection : DictionaryBase
17 | {
18 | ///
19 | /// Gets or sets a byte in the collection
20 | ///
21 | public byte this[long index]
22 | {
23 | get { return (byte)this.Dictionary[index]; }
24 | set { Dictionary[index] = value; }
25 | }
26 |
27 | ///
28 | /// Adds a byte into the collection
29 | ///
30 | /// the index of the byte
31 | /// the value of the byte
32 | public void Add(long index, byte value)
33 | { Dictionary.Add(index, value); }
34 |
35 | ///
36 | /// Determines if a byte with the given index exists.
37 | ///
38 | /// the index of the byte
39 | /// true, if the is in the collection
40 | public bool Contains(long index)
41 | { return Dictionary.Contains(index); }
42 |
43 | }
44 | #endregion
45 |
46 | ///
47 | /// Occurs, when the write buffer contains new changes.
48 | ///
49 | public event EventHandler Changed;
50 |
51 | ///
52 | /// Contains all changes
53 | ///
54 | WriteCollection _writes = new WriteCollection();
55 |
56 | ///
57 | /// Contains the file name.
58 | ///
59 | string _fileName;
60 | ///
61 | /// Contains the file stream.
62 | ///
63 | FileStream _fileStream;
64 | ///
65 | /// Read-only access.
66 | ///
67 | bool _readOnly;
68 |
69 | ///
70 | /// Initializes a new instance of the FileByteProvider class.
71 | ///
72 | ///
73 | public FileByteProvider(string fileName)
74 | {
75 | _fileName = fileName;
76 |
77 | try
78 | {
79 | // try to open in write mode
80 | _fileStream = File.Open(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
81 | }
82 | catch
83 | {
84 | // write mode failed, try to open in read-only and fileshare friendly mode.
85 | try
86 | {
87 | _fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
88 | _readOnly = true;
89 | }
90 | catch
91 | {
92 | throw;
93 | }
94 | }
95 | }
96 |
97 | ///
98 | /// Terminates the instance of the FileByteProvider class.
99 | ///
100 | ~FileByteProvider()
101 | {
102 | Dispose();
103 | }
104 |
105 | ///
106 | /// Raises the Changed event.
107 | ///
108 | /// Never used.
109 | void OnChanged(EventArgs e)
110 | {
111 | if(Changed != null)
112 | Changed(this, e);
113 | }
114 |
115 | ///
116 | /// Gets the name of the file the byte provider is using.
117 | ///
118 | public string FileName
119 | {
120 | get { return _fileName; }
121 | }
122 |
123 | ///
124 | /// Returns a value if there are some changes.
125 | ///
126 | /// true, if there are some changes
127 | public bool HasChanges()
128 | {
129 | return (_writes.Count > 0);
130 | }
131 |
132 | ///
133 | /// Updates the file with all changes the write buffer contains.
134 | ///
135 | public void ApplyChanges()
136 | {
137 | if (this._readOnly)
138 | {
139 | throw new Exception("File is in read-only mode.");
140 | }
141 |
142 | if(!HasChanges())
143 | return;
144 |
145 | IDictionaryEnumerator en = _writes.GetEnumerator();
146 | while(en.MoveNext())
147 | {
148 | long index = (long)en.Key;
149 | byte value = (byte)en.Value;
150 | if(_fileStream.Position != index)
151 | _fileStream.Position = index;
152 | _fileStream.Write(new byte[] { value }, 0, 1);
153 | }
154 | _writes.Clear();
155 | }
156 |
157 | ///
158 | /// Clears the write buffer and reject all changes made.
159 | ///
160 | public void RejectChanges()
161 | {
162 | _writes.Clear();
163 | }
164 |
165 | #region IByteProvider Members
166 | ///
167 | /// Never used.
168 | ///
169 | public event EventHandler LengthChanged;
170 |
171 | ///
172 | /// Reads a byte from the file.
173 | ///
174 | /// the index of the byte to read
175 | /// the byte
176 | public byte ReadByte(long index)
177 | {
178 | if(_writes.Contains(index))
179 | return _writes[index];
180 |
181 | if(_fileStream.Position != index)
182 | _fileStream.Position = index;
183 |
184 | byte res = (byte)_fileStream.ReadByte();
185 | return res;
186 | }
187 |
188 | ///
189 | /// Gets the length of the file.
190 | ///
191 | public long Length
192 | {
193 | get
194 | {
195 | return _fileStream.Length;
196 | }
197 | }
198 |
199 | ///
200 | /// Writes a byte into write buffer
201 | ///
202 | public void WriteByte(long index, byte value)
203 | {
204 | if(_writes.Contains(index))
205 | _writes[index] = value;
206 | else
207 | _writes.Add(index, value);
208 |
209 | OnChanged(EventArgs.Empty);
210 | }
211 |
212 | ///
213 | /// Not supported
214 | ///
215 | public void DeleteBytes(long index, long length)
216 | {
217 | throw new NotSupportedException("FileByteProvider.DeleteBytes");
218 | }
219 |
220 | ///
221 | /// Not supported
222 | ///
223 | public void InsertBytes(long index, byte[] bs)
224 | {
225 | throw new NotSupportedException("FileByteProvider.InsertBytes");
226 | }
227 |
228 | ///
229 | /// Returns true
230 | ///
231 | public bool SupportsWriteByte()
232 | {
233 | return !_readOnly;
234 | }
235 |
236 | ///
237 | /// Returns false
238 | ///
239 | public bool SupportsInsertBytes()
240 | {
241 | return false;
242 | }
243 |
244 | ///
245 | /// Returns false
246 | ///
247 | public bool SupportsDeleteBytes()
248 | {
249 | return false;
250 | }
251 | #endregion
252 |
253 | #region IDisposable Members
254 | ///
255 | /// Releases the file handle used by the FileByteProvider.
256 | ///
257 | public void Dispose()
258 | {
259 | if(_fileStream != null)
260 | {
261 | _fileName = null;
262 |
263 | _fileStream.Close();
264 | _fileStream = null;
265 | }
266 |
267 | GC.SuppressFinalize(this);
268 | }
269 | #endregion
270 | }
271 | }
272 |
--------------------------------------------------------------------------------
/RLExplorerWV/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 | using Be.Windows.Forms;
12 | using EngineClasses;
13 |
14 | namespace RLExplorerWV
15 | {
16 | public partial class Form1 : Form
17 | {
18 | UPKFile upk;
19 |
20 | public Form1()
21 | {
22 | InitializeComponent();
23 | }
24 |
25 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
26 | {
27 | OpenFileDialog d = new OpenFileDialog();
28 | d.Filter = "*.upk|*.upk";
29 | if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
30 | {
31 | LoadFile(d.FileName);
32 | }
33 | }
34 |
35 | private void LoadFile(string s)
36 | {
37 | upk = new UPKFile(s);
38 | hb1.ByteProvider = new DynamicByteProvider(upk.decrypted.ToArray());
39 | listBox1.Items.Clear();
40 | int count = 0;
41 | foreach (UPKFile.NameListEntry e in upk.NameList)
42 | listBox1.Items.Add((count++).ToString("d5") + " : (0x" + e.unk1.ToString("X8") + " - 0x" + e.unk2.ToString("X8") + ") " + e);
43 | listBox2.Items.Clear();
44 | count = 0;
45 | foreach (UPKFile.ImportListEntry e in upk.ImportList)
46 | {
47 | listBox2.Items.Add(count.ToString("d5") + " : " + upk.GetObjectNamePath(-count - 1));
48 | count++;
49 | }
50 | listBox3.Items.Clear();
51 | count = 0;
52 | foreach (UPKFile.ExportListEntry e in upk.ExportList)
53 | {
54 | listBox3.Items.Add(count.ToString("d5") + " : " + upk.GetObjectNamePath(count + 1));
55 | count++;
56 | }
57 | Status.Text = "Loaded File : " + s;
58 | }
59 |
60 | private void saveRawDecryptedToolStripMenuItem_Click(object sender, EventArgs e)
61 | {
62 | if (upk == null)
63 | return;
64 | SaveFileDialog d = new SaveFileDialog();
65 | d.Filter = "*.upk_dec|*.upk_dec";
66 | if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
67 | {
68 | File.WriteAllBytes(d.FileName, upk.decrypted.ToArray());
69 | MessageBox.Show("Done.");
70 | }
71 | }
72 |
73 | private void saveExportEntryDataToolStripMenuItem_Click(object sender, EventArgs e)
74 | {
75 | int n = listBox3.SelectedIndex;
76 | if (n == -1)
77 | return;
78 | upk.decrypted.Seek(upk.ExportList[n].Dataoffset, 0);
79 | int size = (int)upk.ExportList[n].Datasize;
80 | byte[] buff = new byte[size];
81 | upk.decrypted.Read(buff, 0, size);
82 | SaveFileDialog d = new SaveFileDialog();
83 | d.Filter = "*.bin|*.bin";
84 | if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
85 | {
86 | File.WriteAllBytes(d.FileName, buff);
87 | MessageBox.Show("Done.");
88 | }
89 | }
90 |
91 | private void listBox3_SelectedIndexChanged_1(object sender, EventArgs e)
92 | {
93 | int n = listBox3.SelectedIndex;
94 | if (n == -1)
95 | return;
96 | upk.decrypted.Seek(upk.ExportList[n].Dataoffset, 0);
97 | int size = (int)upk.ExportList[n].Datasize;
98 | byte[] buff = new byte[size];
99 | upk.decrypted.Read(buff, 0, size);
100 | hb2.ByteProvider = new DynamicByteProvider(buff);
101 | hb3.ByteProvider = new DynamicByteProvider(upk.ExportList[n].ToRaw());
102 | rtb1.Text = TryReadProps(new MemoryStream(buff));
103 | }
104 |
105 | public string TryReadProps(MemoryStream m, int tab = 0, int start = 4)
106 | {
107 | StringBuilder sb = new StringBuilder();
108 | m.Seek(start, 0);
109 | string t = "";
110 | for (int i = 0; i < tab; i++)
111 | t += "\t";
112 | while (true)
113 | {
114 | string offset = m.Position.ToString("X");
115 | if (m.Position >= m.Length)
116 | break;
117 | int name = Helpers.ReadInt(m);
118 | int tmp = Helpers.ReadInt(m);
119 | if (!upk.IsNameIndex(name) || upk.GetName(name) == "None")
120 | break;
121 | int type = Helpers.ReadInt(m);
122 | tmp = Helpers.ReadInt(m);
123 | if (!upk.IsNameIndex(type))
124 | break;
125 | int size = Helpers.ReadInt(m);
126 | tmp = Helpers.ReadInt(m);
127 | if (m.Position + size >= m.Length || size < 0)
128 | break;
129 | byte[] buff;
130 | int clazz, value;
131 | switch(upk.GetName(type))
132 | {
133 | case "StructProperty":
134 | clazz = Helpers.ReadInt(m);
135 | tmp = Helpers.ReadInt(m);
136 | if (!upk.IsNameIndex(clazz))
137 | return sb.ToString();
138 | buff = new byte[size];
139 | m.Read(buff, 0, size);
140 | sb.AppendFormat("{0}\n", t, offset, upk.GetName(name), upk.GetName(type), size, upk.GetName(clazz));
141 | sb.Append(TryReadProps(new MemoryStream(buff), tab + 1, 0));
142 | sb.AppendFormat("{0}\n", t, upk.GetName(name), upk.GetName(type), size);
143 | break;
144 | case "BoolProperty":
145 | size = 1;
146 | buff = new byte[size];
147 | m.Read(buff, 0, size);
148 | sb.AppendFormat("{0}\n", t, offset, upk.GetName(name), upk.GetName(type), size, Helpers.ByteArrayToHexString(buff));
149 | break;
150 | case "ByteProperty":
151 | clazz = Helpers.ReadInt(m);
152 | if (!upk.IsNameIndex(clazz))
153 | return sb.ToString();
154 | tmp = Helpers.ReadInt(m);
155 | value = Helpers.ReadInt(m);
156 | if (!upk.IsNameIndex(value))
157 | return sb.ToString();
158 | tmp = Helpers.ReadInt(m);
159 | sb.AppendFormat("{0}\n", t, offset, upk.GetName(name), upk.GetName(type), size, upk.GetName(clazz), upk.GetName(value));
160 | break;
161 | default:
162 | buff = new byte[size];
163 | m.Read(buff, 0, size);
164 | sb.AppendFormat("{0}\n", t, offset, upk.GetName(name), upk.GetName(type), size, Helpers.ByteArrayToHexString(buff));
165 | break;
166 | }
167 | }
168 | return sb.ToString();
169 | }
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/Be.Windows.Forms.HexBox.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Local
5 | 9.0.30729
6 | 2.0
7 | {26C5F25F-B450-4CAF-AD8B-B8D11AE73457}
8 | Debug
9 | AnyCPU
10 |
11 |
12 |
13 |
14 | Be.Windows.Forms.HexBox
15 | HexBox.snk
16 | JScript
17 | Grid
18 | IE50
19 | false
20 | Library
21 | Be.Windows.Forms
22 | OnBuildSuccess
23 |
24 |
25 |
26 |
27 |
28 |
29 | 3.5
30 | false
31 | false
32 | v4.0
33 | publish\
34 | true
35 | Disk
36 | false
37 | Foreground
38 | 7
39 | Days
40 | false
41 | false
42 | true
43 | 0
44 | 1.0.0.%2a
45 | false
46 | true
47 |
48 |
49 |
50 | bin\Debug\
51 | false
52 | 285212672
53 | false
54 |
55 |
56 | DEBUG;TRACE
57 | Be.Windows.Forms.HexBox.xml
58 | true
59 | 4096
60 | false
61 |
62 |
63 | false
64 | false
65 | false
66 | false
67 | 4
68 | full
69 | prompt
70 | AllRules.ruleset
71 |
72 |
73 | bin\Release\
74 | false
75 | 285212672
76 | false
77 |
78 |
79 | TRACE
80 |
81 |
82 | false
83 | 4096
84 | false
85 |
86 |
87 | true
88 | false
89 | false
90 | false
91 | 4
92 | none
93 | prompt
94 | BasicCorrectnessRules.ruleset
95 |
96 |
97 |
98 | System
99 |
100 |
101 | System.Data
102 |
103 |
104 | False
105 |
106 |
107 |
108 | System.Windows.Forms
109 |
110 |
111 | System.XML
112 |
113 |
114 |
115 |
116 | Code
117 |
118 |
119 | Component
120 |
121 |
122 | Code
123 |
124 |
125 |
126 | Code
127 |
128 |
129 | Code
130 |
131 |
132 | Code
133 |
134 |
135 | Code
136 |
137 |
138 | Code
139 |
140 |
141 | Code
142 |
143 |
144 | Component
145 |
146 |
147 |
148 |
149 | Code
150 |
151 |
152 | Code
153 |
154 |
155 | Code
156 |
157 |
158 | True
159 | True
160 | Resources.resx
161 |
162 |
163 |
164 |
165 | HexBox.cs
166 | Designer
167 |
168 |
169 | ResXFileCodeGenerator
170 | Resources.Designer.cs
171 |
172 |
173 |
174 |
175 |
176 | False
177 | .NET Framework 3.5 SP1 Client Profile
178 | false
179 |
180 |
181 | False
182 | .NET Framework 2.0 %28x86%29
183 | true
184 |
185 |
186 | False
187 | .NET Framework 3.0 %28x86%29
188 | false
189 |
190 |
191 | False
192 | .NET Framework 3.5
193 | false
194 |
195 |
196 | False
197 | .NET Framework 3.5 SP1
198 | false
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
--------------------------------------------------------------------------------
/EngineClasses/Helpers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Security.Cryptography;
8 |
9 | namespace EngineClasses
10 | {
11 | public static class Helpers
12 | {
13 | public static bool ByteArrayCompare(byte[] b1, byte[] b2)
14 | {
15 | if (b1 == null || b2 == null || b1.Length != b2.Length)
16 | return false;
17 | for (int i = 0; i < b1.Length; i++)
18 | if (b1[i] != b2[i])
19 | return false;
20 | return true;
21 | }
22 |
23 | public static void WriteInt(Stream s, int i)
24 | {
25 | s.Write(BitConverter.GetBytes(i), 0, 4);
26 | }
27 |
28 | public static void WriteLEInt(Stream s, int i)
29 | {
30 | List t = new List(BitConverter.GetBytes(i));
31 | t.Reverse();
32 | s.Write(t.ToArray(), 0, 4);
33 | }
34 |
35 | public static void WriteUInt(Stream s, uint i)
36 | {
37 | s.Write(BitConverter.GetBytes(i), 0, 4);
38 | }
39 |
40 | public static void WriteLEUInt(Stream s, uint i)
41 | {
42 | List t = new List(BitConverter.GetBytes(i));
43 | t.Reverse();
44 | s.Write(t.ToArray(), 0, 4);
45 | }
46 |
47 | public static void WriteLEUShort(Stream s, ushort u)
48 | {
49 | byte[] buff = BitConverter.GetBytes(u);
50 | buff = buff.Reverse().ToArray();
51 | s.Write(buff, 0, 2);
52 | }
53 |
54 | public static int ReadInt(Stream s)
55 | {
56 | byte[] buff = new byte[4];
57 | s.Read(buff, 0, 4);
58 | return BitConverter.ToInt32(buff, 0);
59 | }
60 |
61 | public static uint ReadUInt(Stream s)
62 | {
63 | byte[] buff = new byte[4];
64 | s.Read(buff, 0, 4);
65 | return BitConverter.ToUInt32(buff, 0);
66 | }
67 |
68 | public static short ReadShort(Stream s)
69 | {
70 | byte[] buff = new byte[2];
71 | s.Read(buff, 0, 2);
72 | return BitConverter.ToInt16(buff, 0);
73 | }
74 |
75 | public static ushort ReadUShort(Stream s)
76 | {
77 | byte[] buff = new byte[2];
78 | s.Read(buff, 0, 2);
79 | return BitConverter.ToUInt16(buff, 0);
80 | }
81 |
82 | public static long ReadLong(Stream s)
83 | {
84 | byte[] buff = new byte[8];
85 | s.Read(buff, 0, 8);
86 | return BitConverter.ToInt64(buff, 0);
87 | }
88 |
89 | public static ulong ReadULong(Stream s)
90 | {
91 | byte[] buff = new byte[8];
92 | s.Read(buff, 0, 8);
93 | return BitConverter.ToUInt64(buff, 0);
94 | }
95 |
96 | public static float ReadFloat(Stream s)
97 | {
98 | byte[] buff = new byte[4];
99 | s.Read(buff, 0, 4);
100 | return BitConverter.ToSingle(buff, 0);
101 | }
102 |
103 | public static int ReadLEInt(Stream s)
104 | {
105 | byte[] buff = new byte[4];
106 | s.Read(buff, 0, 4);
107 | buff = buff.Reverse().ToArray();
108 | return BitConverter.ToInt32(buff, 0);
109 | }
110 |
111 | public static uint ReadLEUInt(Stream s)
112 | {
113 | byte[] buff = new byte[4];
114 | s.Read(buff, 0, 4);
115 | buff = buff.Reverse().ToArray();
116 | return BitConverter.ToUInt32(buff, 0);
117 | }
118 |
119 | public static short ReadLEShort(Stream s)
120 | {
121 | byte[] buff = new byte[2];
122 | s.Read(buff, 0, 2);
123 | buff = buff.Reverse().ToArray();
124 | return BitConverter.ToInt16(buff, 0);
125 | }
126 |
127 | public static ushort ReadLEUShort(Stream s)
128 | {
129 | byte[] buff = new byte[2];
130 | s.Read(buff, 0, 2);
131 | buff = buff.Reverse().ToArray();
132 | return BitConverter.ToUInt16(buff, 0);
133 | }
134 |
135 | public static byte[] ReadFull(Stream s, uint size)
136 | {
137 | byte[] buff = new byte[size];
138 | int totalread = 0;
139 | while ((totalread += s.Read(buff, totalread, (int)(size - totalread))) < size) ;
140 | return buff;
141 | }
142 |
143 | public static string ReadNullString(Stream s)
144 | {
145 | string res = "";
146 | byte b;
147 | while ((b = (byte)s.ReadByte()) > 0 && s.Position < s.Length) res += (char)b;
148 | return res;
149 | }
150 |
151 | public static void WriteNullString(Stream s, string t)
152 | {
153 | foreach (char c in t)
154 | s.WriteByte((byte)c);
155 | s.WriteByte(0);
156 | }
157 |
158 | public static ulong ReadLEB128(Stream s)
159 | {
160 | ulong result = 0;
161 | byte shift = 0;
162 | while (true)
163 | {
164 | int i = s.ReadByte();
165 | if (i == -1) return result;
166 | byte b = (byte)i;
167 | result |= (ulong)((b & 0x7f) << shift);
168 | if ((b >> 7) == 0)
169 | return result;
170 | shift += 7;
171 | }
172 | }
173 |
174 | public static void WriteLEB128(Stream s, int value)
175 | {
176 | int temp = value;
177 | while (temp != 0)
178 | {
179 | int val = (temp & 0x7f);
180 | temp >>= 7;
181 |
182 | if (temp > 0)
183 | val |= 0x80;
184 |
185 | s.WriteByte((byte)val);
186 | }
187 | }
188 |
189 | public static bool MatchByteArray(byte[] a1, byte[] a2)
190 | {
191 | if (a1.Length != a2.Length)
192 | return false;
193 | for (int i = 0; i < a1.Length; i++)
194 | if (a1[i] != a2[i])
195 | return false;
196 | return true;
197 | }
198 |
199 | public static byte[] HexStringToByteArray(string hex)
200 | {
201 | return Enumerable.Range(0, hex.Length)
202 | .Where(x => x % 2 == 0)
203 | .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
204 | .ToArray();
205 | }
206 |
207 | public static byte[] StringAsByteArray(string str)
208 | {
209 | MemoryStream m = new MemoryStream();
210 | foreach (char c in str)
211 | m.WriteByte((byte)c);
212 | return m.ToArray();
213 | }
214 |
215 | public static string ByteArrayToHexString(byte[] data, int start = 0, int len = 0)
216 | {
217 | if (data == null)
218 | data = new byte[0];
219 | StringBuilder sb = new StringBuilder();
220 | if (start == 0)
221 | foreach (byte b in data)
222 | sb.Append(b.ToString("X2"));
223 | else
224 | if (start > 0 && start + len <= data.Length)
225 | for (int i = start; i < start + len; i++)
226 | sb.Append(data[i].ToString("X2"));
227 | else
228 | return "";
229 | return sb.ToString();
230 | }
231 |
232 | public static string ByteArrayAsString(byte[] data)
233 | {
234 | if (data == null)
235 | data = new byte[0];
236 | StringBuilder sb = new StringBuilder();
237 | foreach (byte b in data)
238 | sb.Append((char)b);
239 | return sb.ToString();
240 | }
241 |
242 | public static string ReadUnrealString(Stream s)
243 | {
244 | StringBuilder sb = new StringBuilder();
245 | int len = ReadInt(s);
246 | for (int i = 0; i < len - 1; i++)
247 | sb.Append((char)s.ReadByte());
248 | s.ReadByte();
249 | return sb.ToString();
250 | }
251 |
252 | public static byte[] AESDecrypt(byte[] buff, byte[] key)
253 | {
254 | RijndaelManaged rDel = new RijndaelManaged();
255 | rDel.KeySize = 0x100;
256 | rDel.Key = key;
257 | rDel.Mode = CipherMode.ECB;
258 | rDel.Padding = PaddingMode.None;
259 | ICryptoTransform cTransform = rDel.CreateDecryptor();
260 | return cTransform.TransformFinalBlock(buff, 0, buff.Length);
261 | }
262 | }
263 | }
264 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/DataMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | internal class DataMap : ICollection, IEnumerable
8 | {
9 | readonly object _syncRoot = new object();
10 | internal int _count;
11 | internal DataBlock _firstBlock;
12 | internal int _version;
13 |
14 | public DataMap()
15 | {
16 | }
17 |
18 | public DataMap(IEnumerable collection)
19 | {
20 | if (collection == null)
21 | {
22 | throw new ArgumentNullException("collection");
23 | }
24 |
25 | foreach (DataBlock item in collection)
26 | {
27 | AddLast(item);
28 | }
29 | }
30 |
31 | public DataBlock FirstBlock
32 | {
33 | get
34 | {
35 | return _firstBlock;
36 | }
37 | }
38 |
39 | public void AddAfter(DataBlock block, DataBlock newBlock)
40 | {
41 | AddAfterInternal(block, newBlock);
42 | }
43 |
44 | public void AddBefore(DataBlock block, DataBlock newBlock)
45 | {
46 | AddBeforeInternal(block, newBlock);
47 | }
48 |
49 | public void AddFirst(DataBlock block)
50 | {
51 | if (_firstBlock == null)
52 | {
53 | AddBlockToEmptyMap(block);
54 | }
55 | else
56 | {
57 | AddBeforeInternal(_firstBlock, block);
58 | }
59 | }
60 |
61 | public void AddLast(DataBlock block)
62 | {
63 | if (_firstBlock == null)
64 | {
65 | AddBlockToEmptyMap(block);
66 | }
67 | else
68 | {
69 | AddAfterInternal(GetLastBlock(), block);
70 | }
71 | }
72 |
73 | public void Remove(DataBlock block)
74 | {
75 | RemoveInternal(block);
76 | }
77 |
78 | public void RemoveFirst()
79 | {
80 | if (_firstBlock == null)
81 | {
82 | throw new InvalidOperationException("The collection is empty.");
83 | }
84 | RemoveInternal(_firstBlock);
85 | }
86 |
87 | public void RemoveLast()
88 | {
89 | if (_firstBlock == null)
90 | {
91 | throw new InvalidOperationException("The collection is empty.");
92 | }
93 | RemoveInternal(GetLastBlock());
94 | }
95 |
96 | public DataBlock Replace(DataBlock block, DataBlock newBlock)
97 | {
98 | AddAfterInternal(block, newBlock);
99 | RemoveInternal(block);
100 | return newBlock;
101 | }
102 |
103 | public void Clear()
104 | {
105 | DataBlock block = FirstBlock;
106 | while (block != null)
107 | {
108 | DataBlock nextBlock = block.NextBlock;
109 | InvalidateBlock(block);
110 | block = nextBlock;
111 | }
112 | _firstBlock = null;
113 | _count = 0;
114 | _version++;
115 | }
116 |
117 | void AddAfterInternal(DataBlock block, DataBlock newBlock)
118 | {
119 | newBlock._previousBlock = block;
120 | newBlock._nextBlock = block._nextBlock;
121 | newBlock._map = this;
122 |
123 | if (block._nextBlock != null)
124 | {
125 | block._nextBlock._previousBlock = newBlock;
126 | }
127 | block._nextBlock = newBlock;
128 |
129 | this._version++;
130 | this._count++;
131 | }
132 |
133 | void AddBeforeInternal(DataBlock block, DataBlock newBlock)
134 | {
135 | newBlock._nextBlock = block;
136 | newBlock._previousBlock = block._previousBlock;
137 | newBlock._map = this;
138 |
139 | if (block._previousBlock != null)
140 | {
141 | block._previousBlock._nextBlock = newBlock;
142 | }
143 | block._previousBlock = newBlock;
144 |
145 | if (_firstBlock == block)
146 | {
147 | _firstBlock = newBlock;
148 | }
149 | this._version++;
150 | this._count++;
151 | }
152 |
153 | void RemoveInternal(DataBlock block)
154 | {
155 | DataBlock previousBlock = block._previousBlock;
156 | DataBlock nextBlock = block._nextBlock;
157 |
158 | if (previousBlock != null)
159 | {
160 | previousBlock._nextBlock = nextBlock;
161 | }
162 |
163 | if (nextBlock != null)
164 | {
165 | nextBlock._previousBlock = previousBlock;
166 | }
167 |
168 | if (_firstBlock == block)
169 | {
170 | _firstBlock = nextBlock;
171 | }
172 |
173 | InvalidateBlock(block);
174 |
175 | _count--;
176 | _version++;
177 | }
178 |
179 | DataBlock GetLastBlock()
180 | {
181 | DataBlock lastBlock = null;
182 | for (DataBlock block = FirstBlock; block != null; block = block.NextBlock)
183 | {
184 | lastBlock = block;
185 | }
186 | return lastBlock;
187 | }
188 |
189 | void InvalidateBlock(DataBlock block)
190 | {
191 | block._map = null;
192 | block._nextBlock = null;
193 | block._previousBlock = null;
194 | }
195 |
196 | void AddBlockToEmptyMap(DataBlock block)
197 | {
198 | block._map = this;
199 | block._nextBlock = null;
200 | block._previousBlock = null;
201 |
202 | _firstBlock = block;
203 | _version++;
204 | _count++;
205 | }
206 |
207 | #region ICollection Members
208 | public void CopyTo(Array array, int index)
209 | {
210 | DataBlock[] blockArray = array as DataBlock[];
211 | for (DataBlock block = FirstBlock; block != null; block = block.NextBlock)
212 | {
213 | blockArray[index++] = block;
214 | }
215 | }
216 |
217 | public int Count
218 | {
219 | get
220 | {
221 | return _count;
222 | }
223 | }
224 |
225 | public bool IsSynchronized
226 | {
227 | get
228 | {
229 | return false;
230 | }
231 | }
232 |
233 | public object SyncRoot
234 | {
235 | get
236 | {
237 | return _syncRoot;
238 | }
239 | }
240 | #endregion
241 |
242 | #region IEnumerable Members
243 | public IEnumerator GetEnumerator()
244 | {
245 | return new Enumerator(this);
246 | }
247 | #endregion
248 |
249 | #region Enumerator Nested Type
250 | internal class Enumerator : IEnumerator, IDisposable
251 | {
252 | DataMap _map;
253 | DataBlock _current;
254 | int _index;
255 | int _version;
256 |
257 | internal Enumerator(DataMap map)
258 | {
259 | _map = map;
260 | _version = map._version;
261 | _current = null;
262 | _index = -1;
263 | }
264 |
265 | object IEnumerator.Current
266 | {
267 | get
268 | {
269 | if (_index < 0 || _index > _map.Count)
270 | {
271 | throw new InvalidOperationException("Enumerator is positioned before the first element or after the last element of the collection.");
272 | }
273 | return _current;
274 | }
275 | }
276 |
277 | public bool MoveNext()
278 | {
279 | if (this._version != _map._version)
280 | {
281 | throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
282 | }
283 |
284 | if (_index >= _map.Count)
285 | {
286 | return false;
287 | }
288 |
289 | if (++_index == 0)
290 | {
291 | _current = _map.FirstBlock;
292 | }
293 | else
294 | {
295 | _current = _current.NextBlock;
296 | }
297 |
298 | return (_index < _map.Count);
299 | }
300 |
301 | void IEnumerator.Reset()
302 | {
303 | if (this._version != this._map._version)
304 | {
305 | throw new InvalidOperationException("Collection was modified after the enumerator was instantiated.");
306 | }
307 |
308 | this._index = -1;
309 | this._current = null;
310 | }
311 |
312 | public void Dispose()
313 | {
314 | }
315 | }
316 | #endregion
317 | }
318 | }
319 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/BuiltInContextMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Drawing;
5 | using System.ComponentModel;
6 | using System.Windows.Forms;
7 |
8 | namespace Be.Windows.Forms
9 | {
10 | ///
11 | /// Defines a build-in ContextMenuStrip manager for HexBox control to show Copy, Cut, Paste menu in contextmenu of the control.
12 | ///
13 | [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
14 | public sealed class BuiltInContextMenu : Component
15 | {
16 | ///
17 | /// Contains the HexBox control.
18 | ///
19 | HexBox _hexBox;
20 | ///
21 | /// Contains the ContextMenuStrip control.
22 | ///
23 | ContextMenuStrip _contextMenuStrip;
24 | ///
25 | /// Contains the "Cut"-ToolStripMenuItem object.
26 | ///
27 | ToolStripMenuItem _cutToolStripMenuItem;
28 | ///
29 | /// Contains the "Copy"-ToolStripMenuItem object.
30 | ///
31 | ToolStripMenuItem _copyToolStripMenuItem;
32 | ///
33 | /// Contains the "Paste"-ToolStripMenuItem object.
34 | ///
35 | ToolStripMenuItem _pasteToolStripMenuItem;
36 | ///
37 | /// Contains the "Select All"-ToolStripMenuItem object.
38 | ///
39 | ToolStripMenuItem _selectAllToolStripMenuItem;
40 | ///
41 | /// Initializes a new instance of BuildInContextMenu class.
42 | ///
43 | /// the HexBox control
44 | internal BuiltInContextMenu(HexBox hexBox)
45 | {
46 | _hexBox = hexBox;
47 | _hexBox.ByteProviderChanged += new EventHandler(HexBox_ByteProviderChanged);
48 | }
49 | ///
50 | /// If ByteProvider
51 | ///
52 | /// the sender object
53 | /// the event data
54 | void HexBox_ByteProviderChanged(object sender, EventArgs e)
55 | {
56 | CheckBuiltInContextMenu();
57 | }
58 | ///
59 | /// Assigns the ContextMenuStrip control to the HexBox control.
60 | ///
61 | void CheckBuiltInContextMenu()
62 | {
63 | if (Util.DesignMode)
64 | return;
65 |
66 | if (this._contextMenuStrip == null)
67 | {
68 | ContextMenuStrip cms = new ContextMenuStrip();
69 | _cutToolStripMenuItem = new ToolStripMenuItem(CutMenuItemTextInternal, CutMenuItemImage, new EventHandler(CutMenuItem_Click));
70 | cms.Items.Add(_cutToolStripMenuItem);
71 | _copyToolStripMenuItem = new ToolStripMenuItem(CopyMenuItemTextInternal, CopyMenuItemImage, new EventHandler(CopyMenuItem_Click));
72 | cms.Items.Add(_copyToolStripMenuItem);
73 | _pasteToolStripMenuItem = new ToolStripMenuItem(PasteMenuItemTextInternal, PasteMenuItemImage, new EventHandler(PasteMenuItem_Click));
74 | cms.Items.Add(_pasteToolStripMenuItem);
75 |
76 | cms.Items.Add(new ToolStripSeparator());
77 |
78 | _selectAllToolStripMenuItem = new ToolStripMenuItem(SelectAllMenuItemTextInternal, SelectAllMenuItemImage, new EventHandler(SelectAllMenuItem_Click));
79 | cms.Items.Add(_selectAllToolStripMenuItem);
80 | cms.Opening += new CancelEventHandler(BuildInContextMenuStrip_Opening);
81 |
82 | _contextMenuStrip = cms;
83 | }
84 |
85 | if (this._hexBox.ByteProvider == null && this._hexBox.ContextMenuStrip != null)
86 | this._hexBox.ContextMenuStrip = null;
87 | else if (this._hexBox.ByteProvider != null && this._hexBox.ContextMenuStrip == null)
88 | this._hexBox.ContextMenuStrip = _contextMenuStrip;
89 | }
90 | ///
91 | /// Before opening the ContextMenuStrip, we manage the availability of the items.
92 | ///
93 | /// the sender object
94 | /// the event data
95 | void BuildInContextMenuStrip_Opening(object sender, CancelEventArgs e)
96 | {
97 | _cutToolStripMenuItem.Enabled = this._hexBox.CanCut();
98 | _copyToolStripMenuItem.Enabled = this._hexBox.CanCopy();
99 | _pasteToolStripMenuItem.Enabled = this._hexBox.CanPaste();
100 | _selectAllToolStripMenuItem.Enabled = this._hexBox.CanSelectAll();
101 | }
102 | ///
103 | /// The handler for the "Cut"-Click event
104 | ///
105 | /// the sender object
106 | /// the event data
107 | void CutMenuItem_Click(object sender, EventArgs e) { this._hexBox.Cut(); }
108 | ///
109 | /// The handler for the "Copy"-Click event
110 | ///
111 | /// the sender object
112 | /// the event data
113 | void CopyMenuItem_Click(object sender, EventArgs e) { this._hexBox.Copy(); }
114 | ///
115 | /// The handler for the "Paste"-Click event
116 | ///
117 | /// the sender object
118 | /// the event data
119 | void PasteMenuItem_Click(object sender, EventArgs e) { this._hexBox.Paste(); }
120 | ///
121 | /// The handler for the "Select All"-Click event
122 | ///
123 | /// the sender object
124 | /// the event data
125 | void SelectAllMenuItem_Click(object sender, EventArgs e) { this._hexBox.SelectAll(); }
126 | ///
127 | /// Gets or sets the custom text of the "Copy" ContextMenuStrip item.
128 | ///
129 | [Category("BuiltIn-ContextMenu"), DefaultValue(null), Localizable(true)]
130 | public string CopyMenuItemText
131 | {
132 | get { return _copyMenuItemText; }
133 | set { _copyMenuItemText = value; }
134 | } string _copyMenuItemText;
135 |
136 | ///
137 | /// Gets or sets the custom text of the "Cut" ContextMenuStrip item.
138 | ///
139 | [Category("BuiltIn-ContextMenu"), DefaultValue(null), Localizable(true)]
140 | public string CutMenuItemText
141 | {
142 | get { return _cutMenuItemText; }
143 | set { _cutMenuItemText = value; }
144 | } string _cutMenuItemText;
145 |
146 | ///
147 | /// Gets or sets the custom text of the "Paste" ContextMenuStrip item.
148 | ///
149 | [Category("BuiltIn-ContextMenu"), DefaultValue(null), Localizable(true)]
150 | public string PasteMenuItemText
151 | {
152 | get { return _pasteMenuItemText; }
153 | set { _pasteMenuItemText = value; }
154 | } string _pasteMenuItemText;
155 |
156 | ///
157 | /// Gets or sets the custom text of the "Select All" ContextMenuStrip item.
158 | ///
159 | [Category("BuiltIn-ContextMenu"), DefaultValue(null), Localizable(true)]
160 | public string SelectAllMenuItemText
161 | {
162 | get { return _selectAllMenuItemText; }
163 | set { _selectAllMenuItemText = value; }
164 | } string _selectAllMenuItemText = null;
165 |
166 | ///
167 | /// Gets the text of the "Cut" ContextMenuStrip item.
168 | ///
169 | internal string CutMenuItemTextInternal { get { return !string.IsNullOrEmpty(CutMenuItemText) ? CutMenuItemText : "Cut"; } }
170 | ///
171 | /// Gets the text of the "Copy" ContextMenuStrip item.
172 | ///
173 | internal string CopyMenuItemTextInternal { get { return !string.IsNullOrEmpty(CopyMenuItemText) ? CopyMenuItemText : "Copy"; } }
174 | ///
175 | /// Gets the text of the "Paste" ContextMenuStrip item.
176 | ///
177 | internal string PasteMenuItemTextInternal { get { return !string.IsNullOrEmpty(PasteMenuItemText) ? PasteMenuItemText : "Paste"; } }
178 | ///
179 | /// Gets the text of the "Select All" ContextMenuStrip item.
180 | ///
181 | internal string SelectAllMenuItemTextInternal { get { return !string.IsNullOrEmpty(SelectAllMenuItemText) ? SelectAllMenuItemText : "SelectAll"; } }
182 |
183 | ///
184 | /// Gets or sets the image of the "Cut" ContextMenuStrip item.
185 | ///
186 | [Category("BuiltIn-ContextMenu"), DefaultValue(null)]
187 | public Image CutMenuItemImage
188 | {
189 | get { return _cutMenuItemImage; }
190 | set { _cutMenuItemImage = value; }
191 | } Image _cutMenuItemImage = null;
192 | ///
193 | /// Gets or sets the image of the "Copy" ContextMenuStrip item.
194 | ///
195 | [Category("BuiltIn-ContextMenu"), DefaultValue(null)]
196 | public Image CopyMenuItemImage
197 | {
198 | get { return _copyMenuItemImage; }
199 | set { _copyMenuItemImage = value; }
200 | } Image _copyMenuItemImage = null;
201 | ///
202 | /// Gets or sets the image of the "Paste" ContextMenuStrip item.
203 | ///
204 | [Category("BuiltIn-ContextMenu"), DefaultValue(null)]
205 | public Image PasteMenuItemImage
206 | {
207 | get { return _pasteMenuItemImage; }
208 | set { _pasteMenuItemImage = value; }
209 | } Image _pasteMenuItemImage = null;
210 | ///
211 | /// Gets or sets the image of the "Select All" ContextMenuStrip item.
212 | ///
213 | [Category("BuiltIn-ContextMenu"), DefaultValue(null)]
214 | public Image SelectAllMenuItemImage
215 | {
216 | get { return _selectAllMenuItemImage; }
217 | set { _selectAllMenuItemImage = value; }
218 | } Image _selectAllMenuItemImage = null;
219 | }
220 | }
221 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/obj/Debug/Be.Windows.Forms.HexBox.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
2 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
3 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
4 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
5 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
6 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
7 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
8 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
9 | D:\CODE\SVN\ME3Ex\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
10 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
11 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
12 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
13 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
14 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
15 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
16 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
17 | D:\CODE\C#\ME3CreatorPS3\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
18 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
19 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
20 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
21 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
22 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
23 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
24 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
25 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
26 | D:\CODE\C#\DA_Tool\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
27 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
28 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
29 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
30 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
31 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
32 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
33 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
34 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
35 | D:\CODE\SVN\DAI_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
36 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
37 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
38 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
39 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
40 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
41 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
42 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
43 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
44 | D:\Development\C#\DA_Tools\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
45 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
46 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
47 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
48 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
49 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
50 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
51 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
52 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
53 | D:\CODE\SVN\DAI_Tools\DA_Tool_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
54 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
55 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
56 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
57 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
58 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
59 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
60 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
61 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
62 | D:\CODE\SVN\DAI_Tools\DA_Tools_old\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
63 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
64 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
65 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
66 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
67 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
68 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
69 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
70 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
71 | D:\CODE\c#\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
72 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
73 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
74 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
75 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
76 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
77 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
78 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
79 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
80 | D:\CODE\SVN\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
81 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
82 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
83 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
84 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
85 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
86 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
87 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
88 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
89 | D:\CODE\GitHub\DAIToolsWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
90 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
91 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
92 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
93 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
94 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
95 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
96 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
97 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
98 | D:\CODE\c#\XORer\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
99 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
100 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
101 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
102 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
103 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
104 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
105 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
106 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
107 | D:\CODE\c#\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
108 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.dll
109 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.pdb
110 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\bin\Debug\Be.Windows.Forms.HexBox.xml
111 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csprojResolveAssemblyReference.cache
112 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.resources
113 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.Properties.Resources.resources
114 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.csproj.GenerateResource.Cache
115 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.dll
116 | D:\CODE\GitHub\RLExplorerWV\Be.Windows.Forms.HexBox\obj\Debug\Be.Windows.Forms.HexBox.pdb
117 |
--------------------------------------------------------------------------------
/EngineClasses/UPKFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
8 |
9 | namespace EngineClasses
10 | {
11 | public class UPKFile
12 | {
13 | public class Header
14 | {
15 | public uint magic;
16 | public uint unk1;
17 | public uint headerSize;
18 | public string NoneString;
19 | public uint unk3;
20 | public uint NameOffset;
21 | public uint NameCount;
22 | public uint ExportOffset;
23 | public uint ExportCount;
24 | public uint ImportOffset;
25 | public uint ImportCount;
26 | }
27 |
28 | public class NameListEntry
29 | {
30 | public string Text;
31 | public uint unk1;
32 | public uint unk2;
33 |
34 | public void ReadFromStream(Stream s)
35 | {
36 | Text = Helpers.ReadUnrealString(s);
37 | unk1 = Helpers.ReadUInt(s);
38 | unk2 = Helpers.ReadUInt(s);
39 | }
40 |
41 | public override string ToString()
42 | {
43 | return Text;
44 | }
45 | }
46 |
47 | public class ExportListEntry
48 | {
49 | public uint idxClass;
50 | public uint idxParent;
51 | public uint idxLink;
52 | public uint idxName;
53 | public uint unk5;
54 | public uint unk6;
55 | public uint unk7;
56 | public uint unk8;
57 | public uint Datasize;
58 | public uint Dataoffset;
59 | public uint unk11;
60 | public uint unk12;
61 | public uint unk13;
62 | public uint unk14;
63 | public uint unk15;
64 | public uint unk16;
65 | public uint unk17;
66 |
67 | public void ReadFromStream(Stream s)
68 | {
69 | idxClass = Helpers.ReadUInt(s);
70 | idxParent = Helpers.ReadUInt(s);
71 | idxLink = Helpers.ReadUInt(s);
72 | idxName = Helpers.ReadUInt(s);
73 | unk5 = Helpers.ReadUInt(s);
74 | unk6 = Helpers.ReadUInt(s);
75 | unk7 = Helpers.ReadUInt(s);
76 | unk8 = Helpers.ReadUInt(s);
77 | Datasize = Helpers.ReadUInt(s);
78 | Dataoffset = Helpers.ReadUInt(s);
79 | unk11 = Helpers.ReadUInt(s);
80 | unk12 = Helpers.ReadUInt(s);
81 | unk13 = Helpers.ReadUInt(s);
82 | unk14 = Helpers.ReadUInt(s);
83 | unk15 = Helpers.ReadUInt(s);
84 | unk16 = Helpers.ReadUInt(s);
85 | unk17 = Helpers.ReadUInt(s);
86 | }
87 |
88 | public byte[] ToRaw()
89 | {
90 | MemoryStream m = new MemoryStream();
91 | Helpers.WriteUInt(m, idxClass);
92 | Helpers.WriteUInt(m, idxParent);
93 | Helpers.WriteUInt(m, idxLink);
94 | Helpers.WriteUInt(m, idxName);
95 | Helpers.WriteUInt(m, unk5);
96 | Helpers.WriteUInt(m, unk6);
97 | Helpers.WriteUInt(m, unk7);
98 | Helpers.WriteUInt(m, unk8);
99 | Helpers.WriteUInt(m, Datasize);
100 | Helpers.WriteUInt(m, Dataoffset);
101 | Helpers.WriteUInt(m, unk11);
102 | Helpers.WriteUInt(m, unk12);
103 | Helpers.WriteUInt(m, unk13);
104 | Helpers.WriteUInt(m, unk14);
105 | Helpers.WriteUInt(m, unk15);
106 | Helpers.WriteUInt(m, unk16);
107 | Helpers.WriteUInt(m, unk17);
108 | return m.ToArray();
109 | }
110 | }
111 |
112 | public class ImportListEntry
113 | {
114 | public uint idxPackage;
115 | public uint Unk1;
116 | public uint idxClass;
117 | public uint Unk2;
118 | public uint idxLink;
119 | public uint idxName;
120 | public uint Unk3;
121 |
122 | public void ReadFromStream(Stream s)
123 | {
124 | idxPackage = Helpers.ReadUInt(s);
125 | Unk1 = Helpers.ReadUInt(s);
126 | idxClass = Helpers.ReadUInt(s);
127 | Unk2 = Helpers.ReadUInt(s);
128 | idxLink = Helpers.ReadUInt(s);
129 | idxName = Helpers.ReadUInt(s);
130 | Unk3 = Helpers.ReadUInt(s);
131 | }
132 | }
133 |
134 | public class ChunkHeader
135 | {
136 | public int magic;
137 | public int bSize;
138 | public int cSize;
139 | public int ucSize;
140 | public List blocks;
141 | public ChunkHeader(MemoryStream m)
142 | {
143 | magic = Helpers.ReadInt(m);
144 | bSize = Helpers.ReadInt(m);
145 | cSize = Helpers.ReadInt(m);
146 | ucSize = Helpers.ReadInt(m);
147 | blocks = new List();
148 | int readbytes = 0;
149 | while (readbytes < ucSize)
150 | {
151 | Blockheader b = new Blockheader(m);
152 | blocks.Add(b);
153 | readbytes += b.ucSize;
154 | }
155 | }
156 | }
157 |
158 | public class Blockheader
159 | {
160 | public int cSize;
161 | public int ucSize;
162 | public Blockheader(MemoryStream m)
163 | {
164 | cSize = Helpers.ReadInt(m);
165 | ucSize = Helpers.ReadInt(m);
166 | }
167 | }
168 |
169 | public string MyPath;
170 | public Header header;
171 | public List NameList;
172 | public List ExportList;
173 | public List ImportList;
174 | public MemoryStream raw;
175 | public MemoryStream decrypted;
176 | public byte[] key = { 0xC7, 0xDF, 0x6B, 0x13, 0x25, 0x2A, 0xCC, 0x71,
177 | 0x47, 0xBB, 0x51, 0xC9, 0x8A, 0xD7, 0xE3, 0x4B,
178 | 0x7F, 0xE5, 0x00, 0xB7, 0x7F, 0xA5, 0xFA, 0xB2,
179 | 0x93, 0xE2, 0xF2, 0x4E, 0x6B, 0x17, 0xE7, 0x79 };
180 |
181 | public UPKFile(string path)
182 | {
183 | MyPath = path;
184 | raw = new MemoryStream(File.ReadAllBytes(path));
185 | ReadHeader(raw);
186 | decrypted = new MemoryStream(DecryptAndUnpack());
187 | ReadNameList();
188 | ReadExportList();
189 | ReadImportList();
190 | }
191 |
192 | private void ReadHeader(Stream s)
193 | {
194 | header = new Header();
195 | header.magic = Helpers.ReadUInt(s);
196 | header.unk1 = Helpers.ReadUInt(s);
197 | header.headerSize = Helpers.ReadUInt(s);
198 | header.NoneString = Helpers.ReadUnrealString(s);
199 | header.unk3 = Helpers.ReadUInt(s);
200 | header.NameCount = Helpers.ReadUInt(s);
201 | header.NameOffset = Helpers.ReadUInt(s);
202 | header.ExportCount = Helpers.ReadUInt(s);
203 | header.ExportOffset = Helpers.ReadUInt(s);
204 | header.ImportCount = Helpers.ReadUInt(s);
205 | header.ImportOffset = Helpers.ReadUInt(s);
206 | }
207 |
208 | private void ReadNameList()
209 | {
210 | decrypted.Seek(header.NameOffset, 0);
211 | NameList = new List();
212 | for (int i = 0; i < header.NameCount; i++)
213 | {
214 | NameListEntry e = new NameListEntry();
215 | e.ReadFromStream(decrypted);
216 | NameList.Add(e);
217 | }
218 | }
219 |
220 | private void ReadExportList()
221 | {
222 | decrypted.Seek(header.ExportOffset, 0);
223 | ExportList = new List();
224 | for (int i = 0; i < header.ExportCount; i++)
225 | {
226 | ExportListEntry e = new ExportListEntry();
227 | e.ReadFromStream(decrypted);
228 | ExportList.Add(e);
229 | }
230 | }
231 |
232 | private void ReadImportList()
233 | {
234 | decrypted.Seek(header.ImportOffset, 0);
235 | ImportList = new List();
236 | for (int i = 0; i < header.ImportCount; i++)
237 | {
238 | ImportListEntry e = new ImportListEntry();
239 | e.ReadFromStream(decrypted);
240 | ImportList.Add(e);
241 | }
242 | }
243 |
244 | public byte[] DecryptAndUnpack()
245 | {
246 | MemoryStream m = new MemoryStream();
247 | int pos = (int)header.NameOffset;
248 | int end = (int)header.headerSize;
249 | int size = (int)(end - pos);
250 | int size2 = size + (0x100 - size % 0x20);
251 | int size3 = (int)raw.Length - end;
252 | byte[] h = new byte[pos];
253 | raw.Seek(0, 0);
254 | raw.Read(h, 0, pos);
255 | m.Write(h, 0, pos);
256 | byte[] buff = new byte[size2];
257 | raw.Read(buff, 0, size);
258 | buff = Helpers.AESDecrypt(buff, key);
259 | m.Write(buff, 0, size);
260 | buff = new byte[size3];
261 | raw.Read(buff, 0, size3);
262 | buff = DecompressData(new MemoryStream(buff));
263 | m.Write(buff, 0, buff.Length);
264 | return m.ToArray();
265 | }
266 |
267 | public byte[] DecompressData(MemoryStream data)
268 | {
269 | MemoryStream m = new MemoryStream();
270 | data.Seek(0, 0);
271 | while (data.Position < data.Length)
272 | {
273 | ChunkHeader h = new ChunkHeader(data);
274 | foreach (Blockheader b in h.blocks)
275 | {
276 | byte[] buff = new byte[b.cSize];
277 | data.Read(buff, 0, b.cSize);
278 | m.Write(DecompressZlib(new MemoryStream(buff)), 0, b.ucSize);
279 | }
280 | }
281 | return m.ToArray();
282 | }
283 |
284 | public static byte[] DecompressZlib(Stream source)
285 | {
286 | byte[] result = null;
287 | using (MemoryStream outStream = new MemoryStream())
288 | {
289 | using (InflaterInputStream inf = new InflaterInputStream(source))
290 | {
291 | inf.CopyTo(outStream);
292 | }
293 | result = outStream.ToArray();
294 | }
295 | return result;
296 | }
297 |
298 |
299 | public string GetName(int index)
300 | {
301 | string s = "";
302 | if (index >= 0 && index < header.NameCount)
303 | s = NameList[index].ToString();
304 | return s;
305 | }
306 |
307 | public bool IsNameIndex(int index)
308 | {
309 | return (index >= 0 && index < NameList.Count);
310 | }
311 |
312 | public string GetObjectName(int uindex)
313 | {
314 | if (uindex == 0)
315 | return "Class";
316 | if (uindex > 0)
317 | return GetName((int)ExportList[uindex - 1].idxName);
318 | else
319 | return GetName((int)ImportList[-uindex - 1].idxName);
320 | }
321 | public string GetObjectNamePath(int uindex)
322 | {
323 | string s = GetObjectName(uindex);
324 | if (uindex == 0)
325 | return s;
326 | if (uindex > 0)
327 | uindex = (int)ExportList[uindex - 1].idxLink;
328 | else
329 | uindex = (int)ImportList[-uindex - 1].idxLink;
330 | while (uindex != 0)
331 | {
332 | s = GetObjectName(uindex) + "." + s;
333 | if (uindex > 0)
334 | uindex = (int)ExportList[uindex - 1].idxLink;
335 | else
336 | uindex = (int)ImportList[-uindex - 1].idxLink;
337 | }
338 | return s;
339 | }
340 | }
341 | }
342 |
--------------------------------------------------------------------------------
/RLExplorerWV/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RLExplorerWV
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Windows Form-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.menuStrip1 = new System.Windows.Forms.MenuStrip();
32 | this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
33 | this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
34 | this.saveRawDecryptedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
35 | this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
36 | this.saveExportEntryDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
37 | this.statusStrip1 = new System.Windows.Forms.StatusStrip();
38 | this.Status = new System.Windows.Forms.ToolStripStatusLabel();
39 | this.tabControl1 = new System.Windows.Forms.TabControl();
40 | this.tabPage1 = new System.Windows.Forms.TabPage();
41 | this.hb1 = new Be.Windows.Forms.HexBox();
42 | this.tabPage2 = new System.Windows.Forms.TabPage();
43 | this.listBox1 = new System.Windows.Forms.ListBox();
44 | this.tabPage3 = new System.Windows.Forms.TabPage();
45 | this.listBox2 = new System.Windows.Forms.ListBox();
46 | this.tabPage4 = new System.Windows.Forms.TabPage();
47 | this.splitContainer1 = new System.Windows.Forms.SplitContainer();
48 | this.listBox3 = new System.Windows.Forms.ListBox();
49 | this.splitContainer2 = new System.Windows.Forms.SplitContainer();
50 | this.splitContainer3 = new System.Windows.Forms.SplitContainer();
51 | this.hb3 = new Be.Windows.Forms.HexBox();
52 | this.hb2 = new Be.Windows.Forms.HexBox();
53 | this.rtb1 = new System.Windows.Forms.RichTextBox();
54 | this.menuStrip1.SuspendLayout();
55 | this.statusStrip1.SuspendLayout();
56 | this.tabControl1.SuspendLayout();
57 | this.tabPage1.SuspendLayout();
58 | this.tabPage2.SuspendLayout();
59 | this.tabPage3.SuspendLayout();
60 | this.tabPage4.SuspendLayout();
61 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
62 | this.splitContainer1.Panel1.SuspendLayout();
63 | this.splitContainer1.Panel2.SuspendLayout();
64 | this.splitContainer1.SuspendLayout();
65 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
66 | this.splitContainer2.Panel1.SuspendLayout();
67 | this.splitContainer2.Panel2.SuspendLayout();
68 | this.splitContainer2.SuspendLayout();
69 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
70 | this.splitContainer3.Panel1.SuspendLayout();
71 | this.splitContainer3.Panel2.SuspendLayout();
72 | this.splitContainer3.SuspendLayout();
73 | this.SuspendLayout();
74 | //
75 | // menuStrip1
76 | //
77 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
78 | this.fileToolStripMenuItem,
79 | this.editToolStripMenuItem});
80 | this.menuStrip1.Location = new System.Drawing.Point(0, 0);
81 | this.menuStrip1.Name = "menuStrip1";
82 | this.menuStrip1.Size = new System.Drawing.Size(695, 24);
83 | this.menuStrip1.TabIndex = 0;
84 | this.menuStrip1.Text = "menuStrip1";
85 | //
86 | // fileToolStripMenuItem
87 | //
88 | this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
89 | this.openToolStripMenuItem,
90 | this.saveRawDecryptedToolStripMenuItem});
91 | this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
92 | this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
93 | this.fileToolStripMenuItem.Text = "File";
94 | //
95 | // openToolStripMenuItem
96 | //
97 | this.openToolStripMenuItem.Name = "openToolStripMenuItem";
98 | this.openToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
99 | this.openToolStripMenuItem.Text = "Open";
100 | this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
101 | //
102 | // saveRawDecryptedToolStripMenuItem
103 | //
104 | this.saveRawDecryptedToolStripMenuItem.Name = "saveRawDecryptedToolStripMenuItem";
105 | this.saveRawDecryptedToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
106 | this.saveRawDecryptedToolStripMenuItem.Text = "Save Raw Decrypted";
107 | this.saveRawDecryptedToolStripMenuItem.Click += new System.EventHandler(this.saveRawDecryptedToolStripMenuItem_Click);
108 | //
109 | // editToolStripMenuItem
110 | //
111 | this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
112 | this.saveExportEntryDataToolStripMenuItem});
113 | this.editToolStripMenuItem.Name = "editToolStripMenuItem";
114 | this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
115 | this.editToolStripMenuItem.Text = "Edit";
116 | //
117 | // saveExportEntryDataToolStripMenuItem
118 | //
119 | this.saveExportEntryDataToolStripMenuItem.Name = "saveExportEntryDataToolStripMenuItem";
120 | this.saveExportEntryDataToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
121 | this.saveExportEntryDataToolStripMenuItem.Text = "Save Export Entry data...";
122 | this.saveExportEntryDataToolStripMenuItem.Click += new System.EventHandler(this.saveExportEntryDataToolStripMenuItem_Click);
123 | //
124 | // statusStrip1
125 | //
126 | this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
127 | this.Status});
128 | this.statusStrip1.Location = new System.Drawing.Point(0, 490);
129 | this.statusStrip1.Name = "statusStrip1";
130 | this.statusStrip1.Size = new System.Drawing.Size(695, 22);
131 | this.statusStrip1.TabIndex = 1;
132 | this.statusStrip1.Text = "statusStrip1";
133 | //
134 | // Status
135 | //
136 | this.Status.Name = "Status";
137 | this.Status.Size = new System.Drawing.Size(0, 17);
138 | //
139 | // tabControl1
140 | //
141 | this.tabControl1.Controls.Add(this.tabPage1);
142 | this.tabControl1.Controls.Add(this.tabPage2);
143 | this.tabControl1.Controls.Add(this.tabPage3);
144 | this.tabControl1.Controls.Add(this.tabPage4);
145 | this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
146 | this.tabControl1.Location = new System.Drawing.Point(0, 24);
147 | this.tabControl1.Name = "tabControl1";
148 | this.tabControl1.SelectedIndex = 0;
149 | this.tabControl1.Size = new System.Drawing.Size(695, 466);
150 | this.tabControl1.TabIndex = 2;
151 | //
152 | // tabPage1
153 | //
154 | this.tabPage1.Controls.Add(this.hb1);
155 | this.tabPage1.Location = new System.Drawing.Point(4, 22);
156 | this.tabPage1.Name = "tabPage1";
157 | this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
158 | this.tabPage1.Size = new System.Drawing.Size(687, 440);
159 | this.tabPage1.TabIndex = 0;
160 | this.tabPage1.Text = "Hex";
161 | this.tabPage1.UseVisualStyleBackColor = true;
162 | //
163 | // hb1
164 | //
165 | this.hb1.BoldFont = null;
166 | this.hb1.Dock = System.Windows.Forms.DockStyle.Fill;
167 | this.hb1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
168 | this.hb1.LineInfoForeColor = System.Drawing.Color.Empty;
169 | this.hb1.LineInfoVisible = true;
170 | this.hb1.Location = new System.Drawing.Point(3, 3);
171 | this.hb1.Name = "hb1";
172 | this.hb1.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
173 | this.hb1.Size = new System.Drawing.Size(681, 434);
174 | this.hb1.StringViewVisible = true;
175 | this.hb1.TabIndex = 0;
176 | this.hb1.UseFixedBytesPerLine = true;
177 | this.hb1.VScrollBarVisible = true;
178 | //
179 | // tabPage2
180 | //
181 | this.tabPage2.Controls.Add(this.listBox1);
182 | this.tabPage2.Location = new System.Drawing.Point(4, 22);
183 | this.tabPage2.Name = "tabPage2";
184 | this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
185 | this.tabPage2.Size = new System.Drawing.Size(687, 440);
186 | this.tabPage2.TabIndex = 1;
187 | this.tabPage2.Text = "Name List";
188 | this.tabPage2.UseVisualStyleBackColor = true;
189 | //
190 | // listBox1
191 | //
192 | this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
193 | this.listBox1.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
194 | this.listBox1.FormattingEnabled = true;
195 | this.listBox1.IntegralHeight = false;
196 | this.listBox1.ItemHeight = 14;
197 | this.listBox1.Location = new System.Drawing.Point(3, 3);
198 | this.listBox1.Name = "listBox1";
199 | this.listBox1.Size = new System.Drawing.Size(681, 434);
200 | this.listBox1.TabIndex = 0;
201 | //
202 | // tabPage3
203 | //
204 | this.tabPage3.Controls.Add(this.listBox2);
205 | this.tabPage3.Location = new System.Drawing.Point(4, 22);
206 | this.tabPage3.Name = "tabPage3";
207 | this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
208 | this.tabPage3.Size = new System.Drawing.Size(687, 440);
209 | this.tabPage3.TabIndex = 2;
210 | this.tabPage3.Text = "Import List";
211 | this.tabPage3.UseVisualStyleBackColor = true;
212 | //
213 | // listBox2
214 | //
215 | this.listBox2.Dock = System.Windows.Forms.DockStyle.Fill;
216 | this.listBox2.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
217 | this.listBox2.FormattingEnabled = true;
218 | this.listBox2.IntegralHeight = false;
219 | this.listBox2.ItemHeight = 14;
220 | this.listBox2.Location = new System.Drawing.Point(3, 3);
221 | this.listBox2.Name = "listBox2";
222 | this.listBox2.Size = new System.Drawing.Size(681, 434);
223 | this.listBox2.TabIndex = 1;
224 | //
225 | // tabPage4
226 | //
227 | this.tabPage4.Controls.Add(this.splitContainer1);
228 | this.tabPage4.Location = new System.Drawing.Point(4, 22);
229 | this.tabPage4.Name = "tabPage4";
230 | this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
231 | this.tabPage4.Size = new System.Drawing.Size(687, 440);
232 | this.tabPage4.TabIndex = 3;
233 | this.tabPage4.Text = "Exports";
234 | this.tabPage4.UseVisualStyleBackColor = true;
235 | //
236 | // splitContainer1
237 | //
238 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
239 | this.splitContainer1.Location = new System.Drawing.Point(3, 3);
240 | this.splitContainer1.Name = "splitContainer1";
241 | //
242 | // splitContainer1.Panel1
243 | //
244 | this.splitContainer1.Panel1.Controls.Add(this.listBox3);
245 | //
246 | // splitContainer1.Panel2
247 | //
248 | this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
249 | this.splitContainer1.Size = new System.Drawing.Size(681, 434);
250 | this.splitContainer1.SplitterDistance = 341;
251 | this.splitContainer1.TabIndex = 0;
252 | //
253 | // listBox3
254 | //
255 | this.listBox3.Dock = System.Windows.Forms.DockStyle.Fill;
256 | this.listBox3.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
257 | this.listBox3.FormattingEnabled = true;
258 | this.listBox3.IntegralHeight = false;
259 | this.listBox3.ItemHeight = 14;
260 | this.listBox3.Location = new System.Drawing.Point(0, 0);
261 | this.listBox3.Name = "listBox3";
262 | this.listBox3.Size = new System.Drawing.Size(341, 434);
263 | this.listBox3.TabIndex = 2;
264 | this.listBox3.SelectedIndexChanged += new System.EventHandler(this.listBox3_SelectedIndexChanged_1);
265 | //
266 | // splitContainer2
267 | //
268 | this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
269 | this.splitContainer2.Location = new System.Drawing.Point(0, 0);
270 | this.splitContainer2.Name = "splitContainer2";
271 | this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
272 | //
273 | // splitContainer2.Panel1
274 | //
275 | this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
276 | //
277 | // splitContainer2.Panel2
278 | //
279 | this.splitContainer2.Panel2.Controls.Add(this.rtb1);
280 | this.splitContainer2.Size = new System.Drawing.Size(336, 434);
281 | this.splitContainer2.SplitterDistance = 180;
282 | this.splitContainer2.TabIndex = 0;
283 | //
284 | // splitContainer3
285 | //
286 | this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
287 | this.splitContainer3.Location = new System.Drawing.Point(0, 0);
288 | this.splitContainer3.Name = "splitContainer3";
289 | this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
290 | //
291 | // splitContainer3.Panel1
292 | //
293 | this.splitContainer3.Panel1.Controls.Add(this.hb3);
294 | //
295 | // splitContainer3.Panel2
296 | //
297 | this.splitContainer3.Panel2.Controls.Add(this.hb2);
298 | this.splitContainer3.Size = new System.Drawing.Size(336, 180);
299 | this.splitContainer3.SplitterDistance = 67;
300 | this.splitContainer3.TabIndex = 1;
301 | //
302 | // hb3
303 | //
304 | this.hb3.BoldFont = null;
305 | this.hb3.Dock = System.Windows.Forms.DockStyle.Fill;
306 | this.hb3.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
307 | this.hb3.LineInfoForeColor = System.Drawing.Color.Empty;
308 | this.hb3.LineInfoVisible = true;
309 | this.hb3.Location = new System.Drawing.Point(0, 0);
310 | this.hb3.Name = "hb3";
311 | this.hb3.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
312 | this.hb3.Size = new System.Drawing.Size(336, 67);
313 | this.hb3.StringViewVisible = true;
314 | this.hb3.TabIndex = 2;
315 | this.hb3.UseFixedBytesPerLine = true;
316 | this.hb3.VScrollBarVisible = true;
317 | //
318 | // hb2
319 | //
320 | this.hb2.BoldFont = null;
321 | this.hb2.Dock = System.Windows.Forms.DockStyle.Fill;
322 | this.hb2.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
323 | this.hb2.LineInfoForeColor = System.Drawing.Color.Empty;
324 | this.hb2.LineInfoVisible = true;
325 | this.hb2.Location = new System.Drawing.Point(0, 0);
326 | this.hb2.Name = "hb2";
327 | this.hb2.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
328 | this.hb2.Size = new System.Drawing.Size(336, 109);
329 | this.hb2.StringViewVisible = true;
330 | this.hb2.TabIndex = 2;
331 | this.hb2.UseFixedBytesPerLine = true;
332 | this.hb2.VScrollBarVisible = true;
333 | //
334 | // rtb1
335 | //
336 | this.rtb1.DetectUrls = false;
337 | this.rtb1.Dock = System.Windows.Forms.DockStyle.Fill;
338 | this.rtb1.Font = new System.Drawing.Font("Courier New", 10F);
339 | this.rtb1.Location = new System.Drawing.Point(0, 0);
340 | this.rtb1.Name = "rtb1";
341 | this.rtb1.Size = new System.Drawing.Size(336, 250);
342 | this.rtb1.TabIndex = 0;
343 | this.rtb1.Text = "";
344 | this.rtb1.WordWrap = false;
345 | //
346 | // Form1
347 | //
348 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
349 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
350 | this.ClientSize = new System.Drawing.Size(695, 512);
351 | this.Controls.Add(this.tabControl1);
352 | this.Controls.Add(this.statusStrip1);
353 | this.Controls.Add(this.menuStrip1);
354 | this.MainMenuStrip = this.menuStrip1;
355 | this.Name = "Form1";
356 | this.Text = "Rocket League Explorer by Warranty Voider";
357 | this.menuStrip1.ResumeLayout(false);
358 | this.menuStrip1.PerformLayout();
359 | this.statusStrip1.ResumeLayout(false);
360 | this.statusStrip1.PerformLayout();
361 | this.tabControl1.ResumeLayout(false);
362 | this.tabPage1.ResumeLayout(false);
363 | this.tabPage2.ResumeLayout(false);
364 | this.tabPage3.ResumeLayout(false);
365 | this.tabPage4.ResumeLayout(false);
366 | this.splitContainer1.Panel1.ResumeLayout(false);
367 | this.splitContainer1.Panel2.ResumeLayout(false);
368 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
369 | this.splitContainer1.ResumeLayout(false);
370 | this.splitContainer2.Panel1.ResumeLayout(false);
371 | this.splitContainer2.Panel2.ResumeLayout(false);
372 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
373 | this.splitContainer2.ResumeLayout(false);
374 | this.splitContainer3.Panel1.ResumeLayout(false);
375 | this.splitContainer3.Panel2.ResumeLayout(false);
376 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
377 | this.splitContainer3.ResumeLayout(false);
378 | this.ResumeLayout(false);
379 | this.PerformLayout();
380 |
381 | }
382 |
383 | #endregion
384 |
385 | private System.Windows.Forms.MenuStrip menuStrip1;
386 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
387 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
388 | private System.Windows.Forms.ToolStripMenuItem saveRawDecryptedToolStripMenuItem;
389 | private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
390 | private System.Windows.Forms.ToolStripMenuItem saveExportEntryDataToolStripMenuItem;
391 | private System.Windows.Forms.StatusStrip statusStrip1;
392 | private System.Windows.Forms.TabControl tabControl1;
393 | private System.Windows.Forms.TabPage tabPage1;
394 | private Be.Windows.Forms.HexBox hb1;
395 | private System.Windows.Forms.TabPage tabPage2;
396 | private System.Windows.Forms.ListBox listBox1;
397 | private System.Windows.Forms.TabPage tabPage3;
398 | private System.Windows.Forms.ListBox listBox2;
399 | private System.Windows.Forms.TabPage tabPage4;
400 | private System.Windows.Forms.SplitContainer splitContainer1;
401 | private System.Windows.Forms.ListBox listBox3;
402 | private System.Windows.Forms.ToolStripStatusLabel Status;
403 | private System.Windows.Forms.SplitContainer splitContainer2;
404 | private System.Windows.Forms.SplitContainer splitContainer3;
405 | private Be.Windows.Forms.HexBox hb3;
406 | private Be.Windows.Forms.HexBox hb2;
407 | private System.Windows.Forms.RichTextBox rtb1;
408 | }
409 | }
410 |
411 |
--------------------------------------------------------------------------------
/Be.Windows.Forms.HexBox/DynamicFileByteProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.IO;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Implements a fully editable byte provider for file data of any size.
9 | ///
10 | ///
11 | /// Only changes to the file are stored in memory with reads from the
12 | /// original data occurring as required.
13 | ///
14 | public sealed class DynamicFileByteProvider : IByteProvider, IDisposable
15 | {
16 | const int COPY_BLOCK_SIZE = 4096;
17 |
18 | string _fileName;
19 | Stream _stream;
20 | DataMap _dataMap;
21 | long _totalLength;
22 | bool _readOnly;
23 |
24 | ///
25 | /// Constructs a new instance.
26 | ///
27 | /// The name of the file from which bytes should be provided.
28 | public DynamicFileByteProvider(string fileName) : this(fileName, false) { }
29 |
30 | ///
31 | /// Constructs a new instance.
32 | ///
33 | /// The name of the file from which bytes should be provided.
34 | /// True, opens the file in read-only mode.
35 | public DynamicFileByteProvider(string fileName, bool readOnly)
36 | {
37 | _fileName = fileName;
38 |
39 | if (!readOnly)
40 | {
41 | _stream = File.Open(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
42 | }
43 | else
44 | {
45 | _stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
46 | }
47 |
48 | _readOnly = readOnly;
49 |
50 | ReInitialize();
51 | }
52 |
53 | ///
54 | /// Constructs a new instance.
55 | ///
56 | /// the stream containing the data.
57 | ///
58 | /// The stream must supported seek operations.
59 | ///
60 | public DynamicFileByteProvider(Stream stream)
61 | {
62 | if (stream == null)
63 | throw new ArgumentNullException("stream");
64 | if (!stream.CanSeek)
65 | throw new ArgumentException("stream must supported seek operations(CanSeek)");
66 |
67 | _stream = stream;
68 | _readOnly = !stream.CanWrite;
69 | ReInitialize();
70 | }
71 |
72 | #region IByteProvider Members
73 | ///
74 | /// See for more information.
75 | ///
76 | public event EventHandler LengthChanged;
77 |
78 | ///
79 | /// See for more information.
80 | ///
81 | public event EventHandler Changed;
82 |
83 | ///
84 | /// See for more information.
85 | ///
86 | public byte ReadByte(long index)
87 | {
88 | long blockOffset;
89 | DataBlock block = GetDataBlock(index, out blockOffset);
90 | FileDataBlock fileBlock = block as FileDataBlock;
91 | if (fileBlock != null)
92 | {
93 | return ReadByteFromFile(fileBlock.FileOffset + index - blockOffset);
94 | }
95 | else
96 | {
97 | MemoryDataBlock memoryBlock = (MemoryDataBlock)block;
98 | return memoryBlock.Data[index - blockOffset];
99 | }
100 | }
101 |
102 | ///
103 | /// See for more information.
104 | ///
105 | public void WriteByte(long index, byte value)
106 | {
107 | try
108 | {
109 | // Find the block affected.
110 | long blockOffset;
111 | DataBlock block = GetDataBlock(index, out blockOffset);
112 |
113 | // If the byte is already in a memory block, modify it.
114 | MemoryDataBlock memoryBlock = block as MemoryDataBlock;
115 | if (memoryBlock != null)
116 | {
117 | memoryBlock.Data[index - blockOffset] = value;
118 | return;
119 | }
120 |
121 | FileDataBlock fileBlock = (FileDataBlock)block;
122 |
123 | // If the byte changing is the first byte in the block and the previous block is a memory block, extend that.
124 | if (blockOffset == index && block.PreviousBlock != null)
125 | {
126 | MemoryDataBlock previousMemoryBlock = block.PreviousBlock as MemoryDataBlock;
127 | if (previousMemoryBlock != null)
128 | {
129 | previousMemoryBlock.AddByteToEnd(value);
130 | fileBlock.RemoveBytesFromStart(1);
131 | if (fileBlock.Length == 0)
132 | {
133 | _dataMap.Remove(fileBlock);
134 | }
135 | return;
136 | }
137 | }
138 |
139 | // If the byte changing is the last byte in the block and the next block is a memory block, extend that.
140 | if (blockOffset + fileBlock.Length - 1 == index && block.NextBlock != null)
141 | {
142 | MemoryDataBlock nextMemoryBlock = block.NextBlock as MemoryDataBlock;
143 | if (nextMemoryBlock != null)
144 | {
145 | nextMemoryBlock.AddByteToStart(value);
146 | fileBlock.RemoveBytesFromEnd(1);
147 | if (fileBlock.Length == 0)
148 | {
149 | _dataMap.Remove(fileBlock);
150 | }
151 | return;
152 | }
153 | }
154 |
155 | // Split the block into a prefix and a suffix and place a memory block in-between.
156 | FileDataBlock prefixBlock = null;
157 | if (index > blockOffset)
158 | {
159 | prefixBlock = new FileDataBlock(fileBlock.FileOffset, index - blockOffset);
160 | }
161 |
162 | FileDataBlock suffixBlock = null;
163 | if (index < blockOffset + fileBlock.Length - 1)
164 | {
165 | suffixBlock = new FileDataBlock(
166 | fileBlock.FileOffset + index - blockOffset + 1,
167 | fileBlock.Length - (index - blockOffset + 1));
168 | }
169 |
170 | block = _dataMap.Replace(block, new MemoryDataBlock(value));
171 |
172 | if (prefixBlock != null)
173 | {
174 | _dataMap.AddBefore(block, prefixBlock);
175 | }
176 |
177 | if (suffixBlock != null)
178 | {
179 | _dataMap.AddAfter(block, suffixBlock);
180 | }
181 | }
182 | finally
183 | {
184 | OnChanged(EventArgs.Empty);
185 | }
186 | }
187 |
188 | ///
189 | /// See for more information.
190 | ///
191 | public void InsertBytes(long index, byte[] bs)
192 | {
193 | try
194 | {
195 | // Find the block affected.
196 | long blockOffset;
197 | DataBlock block = GetDataBlock(index, out blockOffset);
198 |
199 | // If the insertion point is in a memory block, just insert it.
200 | MemoryDataBlock memoryBlock = block as MemoryDataBlock;
201 | if (memoryBlock != null)
202 | {
203 | memoryBlock.InsertBytes(index - blockOffset, bs);
204 | return;
205 | }
206 |
207 | FileDataBlock fileBlock = (FileDataBlock)block;
208 |
209 | // If the insertion point is at the start of a file block, and the previous block is a memory block, append it to that block.
210 | if (blockOffset == index && block.PreviousBlock != null)
211 | {
212 | MemoryDataBlock previousMemoryBlock = block.PreviousBlock as MemoryDataBlock;
213 | if (previousMemoryBlock != null)
214 | {
215 | previousMemoryBlock.InsertBytes(previousMemoryBlock.Length, bs);
216 | return;
217 | }
218 | }
219 |
220 | // Split the block into a prefix and a suffix and place a memory block in-between.
221 | FileDataBlock prefixBlock = null;
222 | if (index > blockOffset)
223 | {
224 | prefixBlock = new FileDataBlock(fileBlock.FileOffset, index - blockOffset);
225 | }
226 |
227 | FileDataBlock suffixBlock = null;
228 | if (index < blockOffset + fileBlock.Length)
229 | {
230 | suffixBlock = new FileDataBlock(
231 | fileBlock.FileOffset + index - blockOffset,
232 | fileBlock.Length - (index - blockOffset));
233 | }
234 |
235 | block = _dataMap.Replace(block, new MemoryDataBlock(bs));
236 |
237 | if (prefixBlock != null)
238 | {
239 | _dataMap.AddBefore(block, prefixBlock);
240 | }
241 |
242 | if (suffixBlock != null)
243 | {
244 | _dataMap.AddAfter(block, suffixBlock);
245 | }
246 | }
247 | finally
248 | {
249 | _totalLength += bs.Length;
250 | OnLengthChanged(EventArgs.Empty);
251 | OnChanged(EventArgs.Empty);
252 | }
253 | }
254 |
255 | ///
256 | /// See for more information.
257 | ///
258 | public void DeleteBytes(long index, long length)
259 | {
260 | try
261 | {
262 | long bytesToDelete = length;
263 |
264 | // Find the first block affected.
265 | long blockOffset;
266 | DataBlock block = GetDataBlock(index, out blockOffset);
267 |
268 | // Truncate or remove each block as necessary.
269 | while ((bytesToDelete > 0) && (block != null))
270 | {
271 | long blockLength = block.Length;
272 | DataBlock nextBlock = block.NextBlock;
273 |
274 | // Delete the appropriate section from the block (this may result in two blocks or a zero length block).
275 | long count = Math.Min(bytesToDelete, blockLength - (index - blockOffset));
276 | block.RemoveBytes(index - blockOffset, count);
277 |
278 | if (block.Length == 0)
279 | {
280 | _dataMap.Remove(block);
281 | if (_dataMap.FirstBlock == null)
282 | {
283 | _dataMap.AddFirst(new MemoryDataBlock(new byte[0]));
284 | }
285 | }
286 |
287 | bytesToDelete -= count;
288 | blockOffset += block.Length;
289 | block = (bytesToDelete > 0) ? nextBlock : null;
290 | }
291 | }
292 | finally
293 | {
294 | _totalLength -= length;
295 | OnLengthChanged(EventArgs.Empty);
296 | OnChanged(EventArgs.Empty);
297 | }
298 | }
299 |
300 | ///
301 | /// See for more information.
302 | ///
303 | public long Length
304 | {
305 | get
306 | {
307 | return _totalLength;
308 | }
309 | }
310 |
311 | ///
312 | /// See for more information.
313 | ///
314 | public bool HasChanges()
315 | {
316 | if (_readOnly)
317 | return false;
318 |
319 | if (_totalLength != _stream.Length)
320 | {
321 | return true;
322 | }
323 |
324 | long offset = 0;
325 | for (DataBlock block = _dataMap.FirstBlock; block != null; block = block.NextBlock)
326 | {
327 | FileDataBlock fileBlock = block as FileDataBlock;
328 | if (fileBlock == null)
329 | {
330 | return true;
331 | }
332 |
333 | if (fileBlock.FileOffset != offset)
334 | {
335 | return true;
336 | }
337 |
338 | offset += fileBlock.Length;
339 | }
340 | return (offset != _stream.Length);
341 | }
342 |
343 | ///
344 | /// See for more information.
345 | ///
346 | public void ApplyChanges()
347 | {
348 | if (_readOnly)
349 | throw new OperationCanceledException("File is in read-only mode");
350 |
351 | // This method is implemented to efficiently save the changes to the same file stream opened for reading.
352 | // Saving to a separate file would be a much simpler implementation.
353 |
354 | // Firstly, extend the file length (if necessary) to ensure that there is enough disk space.
355 | if (_totalLength > _stream.Length)
356 | {
357 | _stream.SetLength(_totalLength);
358 | }
359 |
360 | // Secondly, shift around any file sections that have moved.
361 | long dataOffset = 0;
362 | for (DataBlock block = _dataMap.FirstBlock; block != null; block = block.NextBlock)
363 | {
364 | FileDataBlock fileBlock = block as FileDataBlock;
365 | if (fileBlock != null && fileBlock.FileOffset != dataOffset)
366 | {
367 | MoveFileBlock(fileBlock, dataOffset);
368 | }
369 | dataOffset += block.Length;
370 | }
371 |
372 | // Next, write in-memory changes.
373 | dataOffset = 0;
374 | for (DataBlock block = _dataMap.FirstBlock; block != null; block = block.NextBlock)
375 | {
376 | MemoryDataBlock memoryBlock = block as MemoryDataBlock;
377 | if (memoryBlock != null)
378 | {
379 | _stream.Position = dataOffset;
380 | for (int memoryOffset = 0; memoryOffset < memoryBlock.Length; memoryOffset += COPY_BLOCK_SIZE)
381 | {
382 | _stream.Write(memoryBlock.Data, memoryOffset, (int)Math.Min(COPY_BLOCK_SIZE, memoryBlock.Length - memoryOffset));
383 | }
384 | }
385 | dataOffset += block.Length;
386 | }
387 |
388 | // Finally, if the file has shortened, truncate the stream.
389 | _stream.SetLength(_totalLength);
390 | ReInitialize();
391 | }
392 |
393 | ///
394 | /// See for more information.
395 | ///
396 | public bool SupportsWriteByte()
397 | {
398 | return !_readOnly;
399 | }
400 |
401 | ///
402 | /// See for more information.
403 | ///
404 | public bool SupportsInsertBytes()
405 | {
406 | return !_readOnly;
407 | }
408 |
409 | ///
410 | /// See for more information.
411 | ///
412 | public bool SupportsDeleteBytes()
413 | {
414 | return !_readOnly;
415 | }
416 | #endregion
417 |
418 | #region IDisposable Members
419 | ///
420 | /// See for more information.
421 | ///
422 | ~DynamicFileByteProvider()
423 | {
424 | Dispose();
425 | }
426 |
427 | ///
428 | /// See for more information.
429 | ///
430 | public void Dispose()
431 | {
432 | if (_stream != null)
433 | {
434 | _stream.Close();
435 | _stream = null;
436 | }
437 | _fileName = null;
438 | _dataMap = null;
439 | GC.SuppressFinalize(this);
440 | }
441 | #endregion
442 |
443 | ///
444 | /// Gets a value, if the file is opened in read-only mode.
445 | ///
446 | public bool ReadOnly
447 | {
448 | get { return _readOnly; }
449 | }
450 |
451 | void OnLengthChanged(EventArgs e)
452 | {
453 | if (LengthChanged != null)
454 | LengthChanged(this, e);
455 | }
456 |
457 | void OnChanged(EventArgs e)
458 | {
459 | if (Changed != null)
460 | {
461 | Changed(this, e);
462 | }
463 | }
464 |
465 | DataBlock GetDataBlock(long findOffset, out long blockOffset)
466 | {
467 | if (findOffset < 0 || findOffset > _totalLength)
468 | {
469 | throw new ArgumentOutOfRangeException("findOffset");
470 | }
471 |
472 | // Iterate over the blocks until the block containing the required offset is encountered.
473 | blockOffset = 0;
474 | for (DataBlock block = _dataMap.FirstBlock; block != null; block = block.NextBlock)
475 | {
476 | if ((blockOffset <= findOffset && blockOffset + block.Length > findOffset) || block.NextBlock == null)
477 | {
478 | return block;
479 | }
480 | blockOffset += block.Length;
481 | }
482 | return null;
483 | }
484 |
485 | FileDataBlock GetNextFileDataBlock(DataBlock block, long dataOffset, out long nextDataOffset)
486 | {
487 | // Iterate over the remaining blocks until a file block is encountered.
488 | nextDataOffset = dataOffset + block.Length;
489 | block = block.NextBlock;
490 | while (block != null)
491 | {
492 | FileDataBlock fileBlock = block as FileDataBlock;
493 | if (fileBlock != null)
494 | {
495 | return fileBlock;
496 | }
497 | nextDataOffset += block.Length;
498 | block = block.NextBlock;
499 | }
500 | return null;
501 | }
502 |
503 | byte ReadByteFromFile(long fileOffset)
504 | {
505 | // Move to the correct position and read the byte.
506 | if (_stream.Position != fileOffset)
507 | {
508 | _stream.Position = fileOffset;
509 | }
510 | return (byte)_stream.ReadByte();
511 | }
512 |
513 | void MoveFileBlock(FileDataBlock fileBlock, long dataOffset)
514 | {
515 | // First, determine whether the next file block needs to move before this one.
516 | long nextDataOffset;
517 | FileDataBlock nextFileBlock = GetNextFileDataBlock(fileBlock, dataOffset, out nextDataOffset);
518 | if (nextFileBlock != null && dataOffset + fileBlock.Length > nextFileBlock.FileOffset)
519 | {
520 | // The next block needs to move first, so do that now.
521 | MoveFileBlock(nextFileBlock, nextDataOffset);
522 | }
523 |
524 | // Now, move the block.
525 | if (fileBlock.FileOffset > dataOffset)
526 | {
527 | // Move the section to earlier in the file stream (done in chunks starting at the beginning of the section).
528 | byte[] buffer = new byte[COPY_BLOCK_SIZE];
529 | for (long relativeOffset = 0; relativeOffset < fileBlock.Length; relativeOffset += buffer.Length)
530 | {
531 | long readOffset = fileBlock.FileOffset + relativeOffset;
532 | int bytesToRead = (int)Math.Min(buffer.Length, fileBlock.Length - relativeOffset);
533 | _stream.Position = readOffset;
534 | _stream.Read(buffer, 0, bytesToRead);
535 |
536 | long writeOffset = dataOffset + relativeOffset;
537 | _stream.Position = writeOffset;
538 | _stream.Write(buffer, 0, bytesToRead);
539 | }
540 | }
541 | else
542 | {
543 | // Move the section to later in the file stream (done in chunks starting at the end of the section).
544 | byte[] buffer = new byte[COPY_BLOCK_SIZE];
545 | for (long relativeOffset = 0; relativeOffset < fileBlock.Length; relativeOffset += buffer.Length)
546 | {
547 | int bytesToRead = (int)Math.Min(buffer.Length, fileBlock.Length - relativeOffset);
548 | long readOffset = fileBlock.FileOffset + fileBlock.Length - relativeOffset - bytesToRead;
549 | _stream.Position = readOffset;
550 | _stream.Read(buffer, 0, bytesToRead);
551 |
552 | long writeOffset = dataOffset + fileBlock.Length - relativeOffset - bytesToRead;
553 | _stream.Position = writeOffset;
554 | _stream.Write(buffer, 0, bytesToRead);
555 | }
556 | }
557 |
558 | // This block now points to a different position in the file.
559 | fileBlock.SetFileOffset(dataOffset);
560 | }
561 |
562 | void ReInitialize()
563 | {
564 | _dataMap = new DataMap();
565 | _dataMap.AddFirst(new FileDataBlock(0, _stream.Length));
566 | _totalLength = _stream.Length;
567 | }
568 | }
569 | }
570 |
--------------------------------------------------------------------------------