2019-04-22 02:00:38 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2019-07-16 21:35:21 +00:00
|
|
|
|
using Toolbox.Library.Forms;
|
|
|
|
|
using Toolbox.Library;
|
2019-04-22 02:00:38 +00:00
|
|
|
|
|
|
|
|
|
namespace FirstPlugin.Forms
|
|
|
|
|
{
|
2019-06-13 22:40:29 +00:00
|
|
|
|
public partial class MSBTEditor : UserControl, IFIleEditor
|
2019-04-22 02:00:38 +00:00
|
|
|
|
{
|
2019-04-22 21:52:21 +00:00
|
|
|
|
public bool ShowPreviewText = true;
|
|
|
|
|
|
2019-04-22 02:00:38 +00:00
|
|
|
|
public List<IFileFormat> GetFileFormats()
|
|
|
|
|
{
|
|
|
|
|
return new List<IFileFormat>() { activeMessageFile };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MSBTEditor()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
listViewCustom1.HeaderStyle = ColumnHeaderStyle.None;
|
2019-04-22 21:52:21 +00:00
|
|
|
|
listViewCustom1.FullRowSelect = true;
|
|
|
|
|
listViewCustom1.CanResizeList = false;
|
2019-04-30 19:25:42 +00:00
|
|
|
|
|
|
|
|
|
hexEditor1.EnableMenuBar = false;
|
2019-04-22 02:00:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MSBT activeMessageFile;
|
|
|
|
|
|
|
|
|
|
public void LoadMSBT(MSBT msbt)
|
|
|
|
|
{
|
|
|
|
|
activeMessageFile = msbt;
|
2019-04-22 21:52:21 +00:00
|
|
|
|
|
|
|
|
|
if (msbt.header.Text2 != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var text in msbt.header.Text2.TextData)
|
|
|
|
|
{
|
2019-04-30 19:25:42 +00:00
|
|
|
|
string listText = text.GetTextLabel(ShowPreviewText, msbt.header.StringEncoding);
|
2019-04-22 21:52:21 +00:00
|
|
|
|
|
|
|
|
|
if (listText.Length > 25)
|
|
|
|
|
listText = $"{listText.Substring(0, 25)}......";
|
|
|
|
|
|
|
|
|
|
listViewCustom1.Items.Add(listText);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (activeMessageFile == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (listViewCustom1.SelectedItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
int index = listViewCustom1.SelectedIndices[0];
|
|
|
|
|
|
|
|
|
|
var textSection = activeMessageFile.header.Text2;
|
|
|
|
|
if (textSection != null)
|
|
|
|
|
{
|
2019-04-30 19:25:42 +00:00
|
|
|
|
editTextTB.Text = textSection.TextData[index].GetText(activeMessageFile.header.StringEncoding);
|
|
|
|
|
originalTextTB.Text = textSection.OriginalTextData[index].GetText(activeMessageFile.header.StringEncoding);
|
|
|
|
|
hexEditor1.LoadData(textSection.TextData[index].Data);
|
2019-04-22 21:52:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-22 02:00:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|