1
0
mirror of synced 2024-09-23 19:18:21 +02:00

KCL and MSBT fixes

This commit is contained in:
KillzXGaming 2019-09-20 21:37:55 -04:00
parent c47d9bc2bc
commit 7502dc9326
13 changed files with 198 additions and 56 deletions

View File

@ -234,6 +234,11 @@ namespace FirstPlugin
Data = data;
}
public StringEntry(string text, Encoding encoding)
{
Data = encoding.GetBytes(text);
}
public uint Index
{
get { return _index; }
@ -272,32 +277,20 @@ namespace FirstPlugin
for (int i = 0; i < EntryCount; i++)
{
reader.SeekBegin(Offsets[i] + Position);
ReadMessageString(reader, (uint)i);
ReadMessageString(reader, header, (uint)i);
}
}
private void ReadMessageString(FileReader reader, uint index)
private void ReadMessageString(FileReader reader, Header header, uint index)
{
List<byte> chars = new List<byte>();
string text = "";
if (header.StringEncoding == Encoding.BigEndianUnicode)
text = reader.ReadUTF16String();
else
text = reader.ReadZeroTerminatedString(header.StringEncoding);
byte charCheck = reader.ReadByte();
byte charCheck2 = reader.ReadByte();
while (charCheck != 0 && charCheck2 != 0)
{
chars.Add(charCheck);
chars.Add(charCheck2);
if (reader.Position < reader.BaseStream.Length - 2)
{
charCheck = reader.ReadByte();
charCheck2 = reader.ReadByte();
}
else
break;
}
TextData.Add(new StringEntry(chars.ToArray()) { Index = index, });
OriginalTextData.Add(new StringEntry(chars.ToArray()) { Index = index, });
TextData.Add(new StringEntry(text, header.StringEncoding) { Index = index, });
OriginalTextData.Add(new StringEntry(text, header.StringEncoding) { Index = index, });
}
private char[] GetControlCode(FileReader reader)

View File

@ -87,7 +87,8 @@
<HintPath>..\Toolbox\Gl_EditorFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="KCLExt">
<Reference Include="KCLExt, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Toolbox\Lib\KCLExt.dll</HintPath>
</Reference>
<Reference Include="LibHac">

View File

@ -29,11 +29,16 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MSBTEditor));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.listViewCustom1 = new Toolbox.Library.Forms.ListViewCustom();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.fontSizeCB = new Toolbox.Library.Forms.STComboBox();
this.fontFamiltyCB = new Toolbox.Library.Forms.STComboBox();
this.stToolStrip1 = new Toolbox.Library.Forms.STToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.listViewCustom1 = new Toolbox.Library.Forms.ListViewCustom();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.editTextTB = new Toolbox.Library.Forms.STTextBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.originalTextTB = new Toolbox.Library.Forms.STTextBox();
@ -56,6 +61,7 @@
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
this.stToolStrip1.SuspendLayout();
this.stMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -64,7 +70,8 @@
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(0, 27);
this.splitContainer1.Location = new System.Drawing.Point(0, 52);
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@ -74,29 +81,10 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(916, 493);
this.splitContainer1.Size = new System.Drawing.Size(916, 468);
this.splitContainer1.SplitterDistance = 305;
this.splitContainer1.TabIndex = 11;
//
// listViewCustom1
//
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(305, 493);
this.listViewCustom1.TabIndex = 0;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
this.listViewCustom1.View = System.Windows.Forms.View.Details;
this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Width = 305;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
@ -112,8 +100,8 @@
//
this.splitContainer2.Panel2.Controls.Add(this.hexEditor1);
this.splitContainer2.Panel2.Controls.Add(this.stLabel3);
this.splitContainer2.Size = new System.Drawing.Size(607, 493);
this.splitContainer2.SplitterDistance = 303;
this.splitContainer2.Size = new System.Drawing.Size(607, 468);
this.splitContainer2.SplitterDistance = 287;
this.splitContainer2.TabIndex = 6;
//
// splitContainer3
@ -131,10 +119,74 @@
//
this.splitContainer3.Panel2.Controls.Add(this.originalTextTB);
this.splitContainer3.Panel2.Controls.Add(this.stLabel2);
this.splitContainer3.Size = new System.Drawing.Size(607, 303);
this.splitContainer3.Size = new System.Drawing.Size(607, 287);
this.splitContainer3.SplitterDistance = 202;
this.splitContainer3.TabIndex = 0;
//
// fontSizeCB
//
this.fontSizeCB.BorderColor = System.Drawing.Color.Empty;
this.fontSizeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.fontSizeCB.ButtonColor = System.Drawing.Color.Empty;
this.fontSizeCB.FormattingEnabled = true;
this.fontSizeCB.IsReadOnly = false;
this.fontSizeCB.Location = new System.Drawing.Point(493, 24);
this.fontSizeCB.Name = "fontSizeCB";
this.fontSizeCB.Size = new System.Drawing.Size(81, 21);
this.fontSizeCB.TabIndex = 15;
this.fontSizeCB.SelectedIndexChanged += new System.EventHandler(this.fontSizeCB_SelectedIndexChanged);
//
// fontFamiltyCB
//
this.fontFamiltyCB.BorderColor = System.Drawing.Color.Empty;
this.fontFamiltyCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.fontFamiltyCB.ButtonColor = System.Drawing.Color.Empty;
this.fontFamiltyCB.FormattingEnabled = true;
this.fontFamiltyCB.IsReadOnly = false;
this.fontFamiltyCB.Location = new System.Drawing.Point(310, 24);
this.fontFamiltyCB.Name = "fontFamiltyCB";
this.fontFamiltyCB.Size = new System.Drawing.Size(176, 21);
this.fontFamiltyCB.TabIndex = 14;
this.fontFamiltyCB.SelectedIndexChanged += new System.EventHandler(this.fontFamiltyCB_SelectedIndexChanged);
//
// stToolStrip1
//
this.stToolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1});
this.stToolStrip1.Location = new System.Drawing.Point(0, 24);
this.stToolStrip1.Name = "stToolStrip1";
this.stToolStrip1.Size = new System.Drawing.Size(922, 25);
this.stToolStrip1.TabIndex = 13;
this.stToolStrip1.Text = "stToolStrip1";
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1";
//
// listViewCustom1
//
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(305, 468);
this.listViewCustom1.TabIndex = 0;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
this.listViewCustom1.View = System.Windows.Forms.View.Details;
this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Width = 305;
//
// editTextTB
//
this.editTextTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -144,7 +196,7 @@
this.editTextTB.Location = new System.Drawing.Point(3, 16);
this.editTextTB.Multiline = true;
this.editTextTB.Name = "editTextTB";
this.editTextTB.Size = new System.Drawing.Size(200, 284);
this.editTextTB.Size = new System.Drawing.Size(200, 268);
this.editTextTB.TabIndex = 0;
//
// stLabel1
@ -166,7 +218,7 @@
this.originalTextTB.Multiline = true;
this.originalTextTB.Name = "originalTextTB";
this.originalTextTB.ReadOnly = true;
this.originalTextTB.Size = new System.Drawing.Size(385, 284);
this.originalTextTB.Size = new System.Drawing.Size(382, 268);
this.originalTextTB.TabIndex = 3;
//
// stLabel2
@ -186,7 +238,7 @@
this.hexEditor1.EnableMenuBar = true;
this.hexEditor1.Location = new System.Drawing.Point(13, 29);
this.hexEditor1.Name = "hexEditor1";
this.hexEditor1.Size = new System.Drawing.Size(591, 154);
this.hexEditor1.Size = new System.Drawing.Size(588, 145);
this.hexEditor1.TabIndex = 5;
//
// stLabel3
@ -231,6 +283,9 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.fontSizeCB);
this.Controls.Add(this.fontFamiltyCB);
this.Controls.Add(this.stToolStrip1);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.stMenuStrip1);
this.Name = "MSBTEditor";
@ -250,6 +305,8 @@
this.splitContainer3.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
this.stToolStrip1.ResumeLayout(false);
this.stToolStrip1.PerformLayout();
this.stMenuStrip1.ResumeLayout(false);
this.stMenuStrip1.PerformLayout();
this.ResumeLayout(false);
@ -274,5 +331,9 @@
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadFontToolStripMenuItem;
private Toolbox.Library.Forms.STContextMenuStrip stContextMenuStrip1;
private Toolbox.Library.Forms.STToolStrip stToolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private Toolbox.Library.Forms.STComboBox fontFamiltyCB;
private Toolbox.Library.Forms.STComboBox fontSizeCB;
}
}

View File

@ -32,6 +32,23 @@ namespace FirstPlugin.Forms
listViewCustom1.CanResizeList = false;
hexEditor1.EnableMenuBar = false;
Reload();
}
private void Reload()
{
string[] fontSizes = { "8", "9", "10", "11", "12", "14", "16", "18",
"20", "22", "24", "26", "28", "30", "36", "48", "72" };
FontFamily[] fontFamilies = new InstalledFontCollection().Families;
fontFamiltyCB.Items.Clear();
fontFamiltyCB.Items.AddRange(fontFamilies.Select(o => o.Name).ToArray());
fontFamiltyCB.SelectedText = Runtime.MessageEditor.FontFamily.Name;
fontSizeCB.Items.Clear();
fontSizeCB.Items.AddRange(fontSizes);
fontSizeCB.SelectedText = Runtime.MessageEditor.FontSize.ToString();
}
MSBT activeMessageFile;
@ -130,5 +147,26 @@ namespace FirstPlugin.Forms
}
}
}
private void fontFamiltyCB_SelectedIndexChanged(object sender, EventArgs e)
{
ReloadFont();
}
private void fontSizeCB_SelectedIndexChanged(object sender, EventArgs e)
{
ReloadFont();
}
private void ReloadFont()
{
float fontSize = 12;
float.TryParse(fontSizeCB.Text, out fontSize);
originalTextTB.Font = new Font(fontFamiltyCB.Text, fontSize);
editTextTB.Font = new Font(fontFamiltyCB.Text, fontSize);
// Runtime.MessageEditor.FontFamily = fontFamiltyCB.SelectedText;
// Runtime.MessageEditor.FontSize = fontSize;
}
}
}

View File

@ -117,6 +117,25 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="stToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>308, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="stMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>

View File

@ -34,9 +34,11 @@
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.encodingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findAllResultsPanel1 = new ScintillaNET_FindReplaceDialog.FindAllResults.FindAllResultsPanel();
this.splitter1 = new System.Windows.Forms.Splitter();
this.encodingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.wordWrapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -60,6 +62,7 @@
//
this.stContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.viewToolStripMenuItem,
this.searchToolStripMenuItem,
this.encodingToolStripMenuItem});
this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0);
@ -98,6 +101,12 @@
this.findToolStripMenuItem.Text = "Find";
this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click);
//
// encodingToolStripMenuItem
//
this.encodingToolStripMenuItem.Name = "encodingToolStripMenuItem";
this.encodingToolStripMenuItem.Size = new System.Drawing.Size(69, 20);
this.encodingToolStripMenuItem.Text = "Encoding";
//
// findAllResultsPanel1
//
this.findAllResultsPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
@ -117,11 +126,21 @@
this.splitter1.TabIndex = 5;
this.splitter1.TabStop = false;
//
// encodingToolStripMenuItem
// viewToolStripMenuItem
//
this.encodingToolStripMenuItem.Name = "encodingToolStripMenuItem";
this.encodingToolStripMenuItem.Size = new System.Drawing.Size(69, 20);
this.encodingToolStripMenuItem.Text = "Encoding";
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.wordWrapToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
//
// wordWrapToolStripMenuItem
//
this.wordWrapToolStripMenuItem.CheckOnClick = true;
this.wordWrapToolStripMenuItem.Name = "wordWrapToolStripMenuItem";
this.wordWrapToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.wordWrapToolStripMenuItem.Text = "Word Wrap";
this.wordWrapToolStripMenuItem.Click += new System.EventHandler(this.wordWrapToolStripMenuItem_Click);
//
// TextEditor
//
@ -151,5 +170,7 @@
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem encodingToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem wordWrapToolStripMenuItem;
}
}

View File

@ -133,6 +133,7 @@ namespace Toolbox.Library.Forms
{
InitializeComponent();
findReplaceDialog = new FindReplace();
findReplaceDialog.Scintilla = scintilla1;
findReplaceDialog.FindAllResults += MyFindReplace_FindAllResults;
@ -342,5 +343,13 @@ namespace Toolbox.Library.Forms
System.IO.File.WriteAllText(sfd.FileName, scintilla1.Text);
}
}
private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)
{
if (wordWrapToolStripMenuItem.Checked)
scintilla1.WrapMode = WrapMode.Word;
else
scintilla1.WrapMode = WrapMode.None;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.