Msbt editor fixes

This commit is contained in:
KillzXGaming 2019-08-11 10:16:32 -04:00
parent a49315e029
commit 9a70890924
5 changed files with 28 additions and 14 deletions

Binary file not shown.

View file

@ -45,10 +45,12 @@ namespace FirstPlugin.Forms
{
if (ShowLabels)
{
foreach (var text in msbt.header.Label1.Labels)
foreach (var lbl in msbt.header.Label1.Labels)
{
string listText = text.Name;
listViewCustom1.Items.Add(listText);
ListViewItem item = new ListViewItem();
item.Text = lbl.Name;
item.Tag = msbt.header.Text2.TextData[(int)lbl.Index];
listViewCustom1.Items.Add(item);
}
listViewCustom1.Sorting = SortOrder.Ascending;
listViewCustom1.Sort();
@ -57,12 +59,15 @@ namespace FirstPlugin.Forms
{
foreach (var text in msbt.header.Text2.TextData)
{
ListViewItem item = new ListViewItem();
string listText = text.GetTextLabel(ShowPreviewText, msbt.header.StringEncoding);
if (listText.Length > 25)
listText = $"{listText.Substring(0, 25)}......";
listViewCustom1.Items.Add(listText);
item.Text = listText;
item.Tag = text;
listViewCustom1.Items.Add(item);
}
}
}
@ -75,17 +80,14 @@ namespace FirstPlugin.Forms
if (listViewCustom1.SelectedItems.Count > 0)
{
int index = listViewCustom1.SelectedIndices[0];
if (ShowLabels)
var item = listViewCustom1.SelectedItems[0];
if (item.Tag is MSBT.StringEntry)
{
index = (int)activeMessageFile.header.Label1.Labels[index].Index;
}
var textSection = activeMessageFile.header.Text2;
if (textSection != null)
{
editTextTB.Text = textSection.TextData[index].GetText(activeMessageFile.header.StringEncoding);
originalTextTB.Text = textSection.OriginalTextData[index].GetText(activeMessageFile.header.StringEncoding);
hexEditor1.LoadData(textSection.TextData[index].Data);
var msbtString = (MSBT.StringEntry)item.Tag;
editTextTB.Text = msbtString.GetText(activeMessageFile.header.StringEncoding);
originalTextTB.Text = msbtString.GetText(activeMessageFile.header.StringEncoding);
hexEditor1.LoadData(msbtString.Data);
}
}
}

View file

@ -161,6 +161,18 @@ namespace Toolbox.Library
}
}
public Bitmap CaptureScreenshot(int width, int height, bool enableAlpha)
{
GLControl control = null;
if (GL_ControlModern != null)
control = GL_ControlModern;
else
control = GL_ControlLegacy;
Bitmap bitmap = new Bitmap(width, height);
return bitmap;
}
public void LoadCustomMenuItem(ToolStripMenuItem menu)
{
foreach (ToolStripMenuItem item in stContextMenuStrip1.Items)