1
0
mirror of synced 2024-11-14 11:07:39 +01:00

Add support for previous XML layout (editorcore version)

This commit is contained in:
KillzXGaming 2020-02-16 12:09:19 -05:00
parent 9e0f3e0516
commit e9677ccb2f

View File

@ -44,9 +44,11 @@ namespace FirstPlugin
bool useMuunt = true; bool useMuunt = true;
bool IsXML => xmlToolstrip.Checked; bool IsXML => xmlToolstrip.Checked;
bool IsOldXML => xmlToolstrip.Checked;
private TextEditor textEditor; private TextEditor textEditor;
private STToolStipMenuItem xmlToolstrip; private STToolStipMenuItem xmlToolstrip;
private STToolStipMenuItem xmlOldToolstrip;
private STToolStipMenuItem yamlToolstrip; private STToolStipMenuItem yamlToolstrip;
public ByamlEditor() public ByamlEditor()
@ -54,7 +56,8 @@ namespace FirstPlugin
InitializeComponent(); InitializeComponent();
Reload(); Reload();
xmlToolstrip = new STToolStipMenuItem("XML", null, OnFormatChanged); xmlOldToolstrip = new STToolStipMenuItem("XML (Toolbox/Editorcore)", null, OnFormatChanged);
xmlToolstrip = new STToolStipMenuItem("XML (YamlConv)", null, OnFormatChanged);
yamlToolstrip = new STToolStipMenuItem("YAML", null, OnFormatChanged); yamlToolstrip = new STToolStipMenuItem("YAML", null, OnFormatChanged);
yamlToolstrip.Checked = true; yamlToolstrip.Checked = true;
} }
@ -114,6 +117,7 @@ namespace FirstPlugin
textEditor.AddContextMenu("Compile", TextEditorFromYaml); textEditor.AddContextMenu("Compile", TextEditorFromYaml);
var formatMenu = new STToolStripItem("Change Formatting"); var formatMenu = new STToolStripItem("Change Formatting");
formatMenu.DropDownItems.Add(xmlOldToolstrip);
formatMenu.DropDownItems.Add(xmlToolstrip); formatMenu.DropDownItems.Add(xmlToolstrip);
formatMenu.DropDownItems.Add(yamlToolstrip); formatMenu.DropDownItems.Add(yamlToolstrip);
@ -126,6 +130,7 @@ namespace FirstPlugin
{ {
yamlToolstrip.Checked = false; yamlToolstrip.Checked = false;
xmlToolstrip.Checked = false; xmlToolstrip.Checked = false;
xmlOldToolstrip.Checked = false;
var menu = sender as STToolStipMenuItem; var menu = sender as STToolStipMenuItem;
menu.Checked = true; menu.Checked = true;
@ -760,6 +765,11 @@ namespace FirstPlugin
textEditor.FillEditor(XmlByamlConverter.ToXML(FileFormat.BymlData)); textEditor.FillEditor(XmlByamlConverter.ToXML(FileFormat.BymlData));
textEditor.IsXML = true; textEditor.IsXML = true;
} }
else if (IsOldXML)
{
textEditor.FillEditor(XmlConverter.ToXml(FileFormat.BymlData));
textEditor.IsXML = true;
}
else else
{ {
textEditor.FillEditor(YamlByamlConverter.ToYaml(FileFormat.BymlData)); textEditor.FillEditor(YamlByamlConverter.ToYaml(FileFormat.BymlData));
@ -778,6 +788,8 @@ namespace FirstPlugin
if (FileFormat != null) { if (FileFormat != null) {
if (IsXML) if (IsXML)
FileFormat.BymlData = XmlByamlConverter.FromXML(textEditor.GetText()); FileFormat.BymlData = XmlByamlConverter.FromXML(textEditor.GetText());
else if (IsOldXML)
FileFormat.BymlData = XmlConverter.ToByml(textEditor.GetText());
else else
FileFormat.BymlData = YamlByamlConverter.FromYaml(textEditor.GetText()); FileFormat.BymlData = YamlByamlConverter.FromYaml(textEditor.GetText());
} }