quick import of file structure
This commit is contained in:
parent
adc2a7d169
commit
e208ff0664
BIN
plugins/BinLogReader/App.ico
Normal file
BIN
plugins/BinLogReader/App.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
58
plugins/BinLogReader/AssemblyInfo.cs
Normal file
58
plugins/BinLogReader/AssemblyInfo.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
40
plugins/BinLogReader/BinLog.cs
Normal file
40
plugins/BinLogReader/BinLog.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace BinLogReader
|
||||
{
|
||||
/// <summary>
|
||||
/// binary log stuff yah
|
||||
/// </summary>
|
||||
public class BinLog
|
||||
{
|
||||
private static uint BINLOG_MAGIC = 0x414D424C
|
||||
private static short BINLOG_VERSION = 0x0100;
|
||||
|
||||
public static BinLog FromFile(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
return null;
|
||||
|
||||
System.IO.FileStream stream = File.Open(filename, System.IO.FileMode.Open);
|
||||
if (stream == null)
|
||||
return null;
|
||||
BinaryReader br = new BinaryReader(stream);
|
||||
if (br == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
br.Close();
|
||||
stream.Close();
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
plugins/BinLogReader/BinLogReader.csproj
Normal file
133
plugins/BinLogReader/BinLogReader.csproj
Normal file
@ -0,0 +1,133 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = "App.ico"
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "BinLogReader"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "WinExe"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "BinLogReader"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.XML"
|
||||
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "App.ico"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "BinLog.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Form1.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Form1.resx"
|
||||
DependentUpon = "Form1.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Plugin.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "PluginDb.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
21
plugins/BinLogReader/BinLogReader.sln
Normal file
21
plugins/BinLogReader/BinLogReader.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BinLogReader", "BinLogReader.csproj", "{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}.Debug.ActiveCfg = Debug|.NET
|
||||
{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}.Debug.Build.0 = Debug|.NET
|
||||
{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}.Release.ActiveCfg = Release|.NET
|
||||
{5EB15D49-0E00-424F-A8E2-14A17FE78DD1}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
143
plugins/BinLogReader/Form1.cs
Normal file
143
plugins/BinLogReader/Form1.cs
Normal file
@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using System.Data;
|
||||
|
||||
namespace BinLogReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Form1.
|
||||
/// </summary>
|
||||
public class Form1 : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.MainMenu mainMenu1;
|
||||
private System.Windows.Forms.MenuItem menuItem1;
|
||||
private System.Windows.Forms.MenuItem menuItem2;
|
||||
private System.Windows.Forms.MenuItem menuItem3;
|
||||
private System.Windows.Forms.MenuItem menuItem4;
|
||||
private System.Windows.Forms.MenuItem menuItem5;
|
||||
private System.Windows.Forms.MenuItem menuItem6;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
//
|
||||
// Required for Windows Form Designer support
|
||||
//
|
||||
InitializeComponent();
|
||||
|
||||
//
|
||||
// TODO: Add any constructor code after InitializeComponent call
|
||||
//
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if (components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.mainMenu1 = new System.Windows.Forms.MainMenu();
|
||||
this.menuItem1 = new System.Windows.Forms.MenuItem();
|
||||
this.menuItem2 = new System.Windows.Forms.MenuItem();
|
||||
this.menuItem3 = new System.Windows.Forms.MenuItem();
|
||||
this.menuItem4 = new System.Windows.Forms.MenuItem();
|
||||
this.menuItem5 = new System.Windows.Forms.MenuItem();
|
||||
this.menuItem6 = new System.Windows.Forms.MenuItem();
|
||||
//
|
||||
// mainMenu1
|
||||
//
|
||||
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||
this.menuItem1,
|
||||
this.menuItem5});
|
||||
//
|
||||
// menuItem1
|
||||
//
|
||||
this.menuItem1.Index = 0;
|
||||
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||
this.menuItem2,
|
||||
this.menuItem3,
|
||||
this.menuItem4});
|
||||
this.menuItem1.Text = "&File";
|
||||
//
|
||||
// menuItem2
|
||||
//
|
||||
this.menuItem2.Index = 0;
|
||||
this.menuItem2.Text = "&Open";
|
||||
//
|
||||
// menuItem3
|
||||
//
|
||||
this.menuItem3.Index = 1;
|
||||
this.menuItem3.Text = "-";
|
||||
//
|
||||
// menuItem4
|
||||
//
|
||||
this.menuItem4.Index = 2;
|
||||
this.menuItem4.Text = "E&xit";
|
||||
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
|
||||
//
|
||||
// menuItem5
|
||||
//
|
||||
this.menuItem5.Index = 1;
|
||||
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||
this.menuItem6});
|
||||
this.menuItem5.Text = "&Help";
|
||||
//
|
||||
// menuItem6
|
||||
//
|
||||
this.menuItem6.Index = 0;
|
||||
this.menuItem6.Text = "&About";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(772, 437);
|
||||
this.Menu = this.mainMenu1;
|
||||
this.Name = "Form1";
|
||||
this.Text = "AMX Mod X BinLogReader";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
PluginDb db = PluginDb.FromFile("c:\\hlserver\\cstrike\\addons\\amxmodx\\data\\binlogs\\bindb0001.bdb");
|
||||
}
|
||||
|
||||
private void menuItem4_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
175
plugins/BinLogReader/Form1.resx
Normal file
175
plugins/BinLogReader/Form1.resx
Normal file
@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="mainMenu1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mainMenu1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</data>
|
||||
<data name="mainMenu1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem4.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem5.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem5.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem6.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="menuItem6.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>4, 4</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>Form1</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
</root>
|
60
plugins/BinLogReader/Plugin.cs
Normal file
60
plugins/BinLogReader/Plugin.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace BinLogReader
|
||||
{
|
||||
/// <summary>
|
||||
/// plugin data
|
||||
/// </summary>
|
||||
public class Plugin
|
||||
{
|
||||
private byte status;
|
||||
private string Filename;
|
||||
private ArrayList Natives;
|
||||
private ArrayList Publics;
|
||||
|
||||
public Plugin(string name, int natives, int publics, byte _status)
|
||||
{
|
||||
Filename = name;
|
||||
Natives = new ArrayList(natives);
|
||||
Publics = new ArrayList(publics);
|
||||
status = _status;
|
||||
}
|
||||
|
||||
public void AddNative(string name)
|
||||
{
|
||||
Natives.Add(name);
|
||||
}
|
||||
|
||||
public void AddPublic(string pubname)
|
||||
{
|
||||
Publics.Add(pubname);
|
||||
}
|
||||
|
||||
public string FindNative(int id)
|
||||
{
|
||||
if (id < 0 || id >= Natives.Count)
|
||||
return null;
|
||||
|
||||
return (string)Natives[id];
|
||||
}
|
||||
|
||||
public string FindPublic(int id)
|
||||
{
|
||||
if (id < 0 || id >= Publics.Count)
|
||||
return null;
|
||||
|
||||
return (string)Publics[id];
|
||||
}
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return status != 0;
|
||||
}
|
||||
|
||||
public bool IsDebug()
|
||||
{
|
||||
return status == 2;
|
||||
}
|
||||
}
|
||||
}
|
110
plugins/BinLogReader/PluginDb.cs
Normal file
110
plugins/BinLogReader/PluginDb.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BinLogReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggregates plugin information
|
||||
/// </summary>
|
||||
public class PluginDb
|
||||
{
|
||||
private static uint BINDB_MAGIC = 0x414D4244;
|
||||
private static short BINDB_VERSION = 0x0100;
|
||||
private ArrayList PluginList;
|
||||
|
||||
public PluginDb(uint plugins)
|
||||
{
|
||||
PluginList = new ArrayList((int)plugins);
|
||||
}
|
||||
|
||||
public Plugin GetPluginById(ushort id)
|
||||
{
|
||||
return GetPluginById((int)id);
|
||||
}
|
||||
|
||||
public Plugin GetPluginById(int id)
|
||||
{
|
||||
if (id < 0 || id >= PluginList.Count)
|
||||
return null;
|
||||
|
||||
return (Plugin)PluginList[id];
|
||||
}
|
||||
|
||||
public static PluginDb FromFile(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
return null;
|
||||
|
||||
System.IO.FileStream stream = File.Open(filename, System.IO.FileMode.Open);
|
||||
if (stream == null)
|
||||
return null;
|
||||
BinaryReader br = new BinaryReader(stream);
|
||||
if (br == null)
|
||||
return null;
|
||||
|
||||
PluginDb db;
|
||||
|
||||
try
|
||||
{
|
||||
//check header
|
||||
uint magic = br.ReadUInt32();
|
||||
if (magic != BINDB_MAGIC)
|
||||
throw new Exception("Invalid magic number");
|
||||
//check version
|
||||
ushort vers = br.ReadUInt16();
|
||||
if (vers > BINDB_VERSION)
|
||||
throw new Exception("Unknown version");
|
||||
//read plugins
|
||||
uint plugins = br.ReadUInt32();
|
||||
db = new PluginDb(plugins);
|
||||
for (uint i=0; i<plugins; i++)
|
||||
{
|
||||
byte status = br.ReadByte();
|
||||
byte length = br.ReadByte();
|
||||
byte [] name = br.ReadBytes(length + 1);
|
||||
uint natives = br.ReadUInt32();
|
||||
uint publics = br.ReadUInt32();
|
||||
int id = db.CreatePlugin(
|
||||
Encoding.ASCII.GetString(name, 0, length),
|
||||
(int)natives,
|
||||
(int)publics,
|
||||
status);
|
||||
Plugin pl = db.GetPluginById(id);
|
||||
for (uint j=0; j<natives; j++)
|
||||
{
|
||||
length = br.ReadByte();
|
||||
name = br.ReadBytes(length + 1);
|
||||
pl.AddNative(Encoding.ASCII.GetString(name, 0, length));
|
||||
}
|
||||
for (uint j=0; j<publics; j++)
|
||||
{
|
||||
length = br.ReadByte();
|
||||
name = br.ReadBytes(length + 1);
|
||||
pl.AddPublic(Encoding.ASCII.GetString(name, 0, length));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new Exception("File is corrupt");
|
||||
}
|
||||
finally
|
||||
{
|
||||
br.Close();
|
||||
stream.Close();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
private int CreatePlugin(string file, int natives, int publics, byte status)
|
||||
{
|
||||
Plugin pl = new Plugin(file, natives, publics, status);
|
||||
PluginList.Add(pl);
|
||||
return PluginList.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user