Save current byaml text format to config to stay when reopened

This commit is contained in:
KillzXGaming 2020-02-16 12:24:31 -05:00
parent f3b1d0e706
commit d0b6d132c7
3 changed files with 40 additions and 1 deletions

View file

@ -59,7 +59,13 @@ namespace FirstPlugin
xmlOldToolstrip = new STToolStipMenuItem("XML (Toolbox/Editorcore)", null, OnFormatChanged);
xmlToolstrip = new STToolStipMenuItem("XML (YamlConv)", null, OnFormatChanged);
yamlToolstrip = new STToolStipMenuItem("YAML", null, OnFormatChanged);
yamlToolstrip.Checked = true;
if (Runtime.ByamlEditor.TextFormat == Runtime.ByamlTextFormat.YAML)
yamlToolstrip.Checked = true;
else if (Runtime.ByamlEditor.TextFormat == Runtime.ByamlTextFormat.XML_YamlConv)
xmlToolstrip.Checked = true;
else if (Runtime.ByamlEditor.TextFormat == Runtime.ByamlTextFormat.XML_EditorCore)
xmlOldToolstrip.Checked = true;
}
public ByamlEditor(System.Collections.IEnumerable by, bool _pathSupport, ushort _ver, ByteOrder defaultOrder = ByteOrder.LittleEndian, bool IsSaveDialog = false, BYAML byaml = null)
@ -135,6 +141,15 @@ namespace FirstPlugin
var menu = sender as STToolStipMenuItem;
menu.Checked = true;
if (yamlToolstrip.Checked)
Runtime.ByamlEditor.TextFormat = Runtime.ByamlTextFormat.YAML;
if (xmlToolstrip.Checked)
Runtime.ByamlEditor.TextFormat = Runtime.ByamlTextFormat.XML_YamlConv;
if (xmlOldToolstrip.Checked)
Runtime.ByamlEditor.TextFormat = Runtime.ByamlTextFormat.XML_EditorCore;
Toolbox.Library.Config.Save();
if (textEditor.GetText() != string.Empty) {
UpdateTextEditor();
}

View file

@ -298,6 +298,11 @@ namespace Toolbox.Library
case "DumpShadersDEBUG":
bool.TryParse(node.InnerText, out Runtime.DumpShadersDEBUG);
break;
case "BymlTextFormat":
Runtime.ByamlTextFormat textFormat;
Enum.TryParse(node.InnerText, out textFormat);
Runtime.ByamlEditor.TextFormat = textFormat;
break;
}
}
@ -406,6 +411,7 @@ namespace Toolbox.Library
AppendResourceTableSettings(doc, mainNode);
AppendDeveloperSettings(doc, mainNode);
AppendLayoutEditorSettings(doc, mainNode);
AppendByamlEditorSettings(doc, mainNode);
return doc;
}
@ -489,6 +495,13 @@ namespace Toolbox.Library
PathsNode.AppendChild(createNode(doc, "ProdKeys", Runtime.SwitchKeys.ProdKeys.ToString()));
}
private static void AppendByamlEditorSettings(XmlDocument doc, XmlNode parentNode)
{
XmlNode PathsNode = doc.CreateElement("ByamlEditor");
parentNode.AppendChild(PathsNode);
PathsNode.AppendChild(createNode(doc, "BymlTextFormat", Runtime.ByamlEditor.TextFormat.ToString()));
}
private static void AppenPBRSettings(XmlDocument doc, XmlNode parentNode)
{
XmlNode SettingsNode = doc.CreateElement("PBR");

View file

@ -70,6 +70,17 @@ namespace Toolbox.Library
public static int FontSize = 12;
}
public class ByamlEditor {
public static ByamlTextFormat TextFormat = ByamlTextFormat.YAML;
}
public enum ByamlTextFormat
{
XML_EditorCore,
XML_YamlConv,
YAML,
}
public class MuuntEditor
{
public static bool Enable3DViewport = false;