Start to add multiple editor switching for archive files
This commit is contained in:
parent
7176063af3
commit
bb691dcd0b
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -11,7 +11,7 @@ using FirstPlugin.Forms;
|
|||||||
|
|
||||||
namespace FirstPlugin
|
namespace FirstPlugin
|
||||||
{
|
{
|
||||||
public class AAMP : IEditor<AampEditorBase>, IFileFormat
|
public class AAMP : IEditor<AampEditorBase>, IFileFormat, IConvertableTextFormat
|
||||||
{
|
{
|
||||||
public FileType FileType { get; set; } = FileType.Parameter;
|
public FileType FileType { get; set; } = FileType.Parameter;
|
||||||
|
|
||||||
@ -51,6 +51,27 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Text Converter Interface
|
||||||
|
public TextFileType TextFileType => TextFileType.Yaml;
|
||||||
|
public bool CanConvertBack => false;
|
||||||
|
|
||||||
|
public string ConvertToString()
|
||||||
|
{
|
||||||
|
if (aampFileV1 != null)
|
||||||
|
return AampYamlConverter.ToYaml(aampFileV1);
|
||||||
|
else
|
||||||
|
return AampYamlConverter.ToYaml(aampFileV2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConvertFromString(string text)
|
||||||
|
{
|
||||||
|
if (aampFileV1 != null)
|
||||||
|
AampYamlConverter.ToAamp(aampFileV1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
bool IsSaveDialog = false;
|
bool IsSaveDialog = false;
|
||||||
|
|
||||||
public static void GenerateProbeBoundings()
|
public static void GenerateProbeBoundings()
|
||||||
|
Binary file not shown.
Binary file not shown.
101
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.Designer.cs
generated
Normal file
101
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.Designer.cs
generated
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
namespace Switch_Toolbox.Library.Forms
|
||||||
|
{
|
||||||
|
partial class ArchiveFilePanel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
|
||||||
|
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
|
||||||
|
this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel();
|
||||||
|
this.stComboBox1 = new Switch_Toolbox.Library.Forms.STComboBox();
|
||||||
|
this.stPanel2.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// stPanel1
|
||||||
|
//
|
||||||
|
this.stPanel1.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.stPanel1.Location = new System.Drawing.Point(0, 29);
|
||||||
|
this.stPanel1.Name = "stPanel1";
|
||||||
|
this.stPanel1.Size = new System.Drawing.Size(369, 280);
|
||||||
|
this.stPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// stPanel2
|
||||||
|
//
|
||||||
|
this.stPanel2.Controls.Add(this.stLabel1);
|
||||||
|
this.stPanel2.Controls.Add(this.stComboBox1);
|
||||||
|
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.stPanel2.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.stPanel2.Name = "stPanel2";
|
||||||
|
this.stPanel2.Size = new System.Drawing.Size(369, 27);
|
||||||
|
this.stPanel2.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// stLabel1
|
||||||
|
//
|
||||||
|
this.stLabel1.AutoSize = true;
|
||||||
|
this.stLabel1.Location = new System.Drawing.Point(3, 5);
|
||||||
|
this.stLabel1.Name = "stLabel1";
|
||||||
|
this.stLabel1.Size = new System.Drawing.Size(44, 13);
|
||||||
|
this.stLabel1.TabIndex = 1;
|
||||||
|
this.stLabel1.Text = "Display:";
|
||||||
|
//
|
||||||
|
// stComboBox1
|
||||||
|
//
|
||||||
|
this.stComboBox1.BorderColor = System.Drawing.Color.Empty;
|
||||||
|
this.stComboBox1.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||||
|
this.stComboBox1.ButtonColor = System.Drawing.Color.Empty;
|
||||||
|
this.stComboBox1.FormattingEnabled = true;
|
||||||
|
this.stComboBox1.Location = new System.Drawing.Point(53, 2);
|
||||||
|
this.stComboBox1.Name = "stComboBox1";
|
||||||
|
this.stComboBox1.ReadOnly = true;
|
||||||
|
this.stComboBox1.Size = new System.Drawing.Size(190, 21);
|
||||||
|
this.stComboBox1.TabIndex = 0;
|
||||||
|
this.stComboBox1.SelectedIndexChanged += new System.EventHandler(this.stComboBox1_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// ArchiveFilePanel
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.stPanel2);
|
||||||
|
this.Controls.Add(this.stPanel1);
|
||||||
|
this.Name = "ArchiveFilePanel";
|
||||||
|
this.Size = new System.Drawing.Size(369, 309);
|
||||||
|
this.stPanel2.ResumeLayout(false);
|
||||||
|
this.stPanel2.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private STPanel stPanel1;
|
||||||
|
private STPanel stPanel2;
|
||||||
|
private STLabel stLabel1;
|
||||||
|
private STComboBox stComboBox1;
|
||||||
|
}
|
||||||
|
}
|
129
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs
Normal file
129
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Switch_Toolbox.Library.Forms
|
||||||
|
{
|
||||||
|
//The panel when a file in an archive is clicked on
|
||||||
|
//Configures the editor view, ie Hex, Editor, Text Edtior, etc
|
||||||
|
public partial class ArchiveFilePanel : UserControl
|
||||||
|
{
|
||||||
|
ArchiveFileInfo ArchiveFileInfo;
|
||||||
|
|
||||||
|
private bool _IsLoaded = false;
|
||||||
|
|
||||||
|
public ArchiveFilePanel(ArchiveFileInfo archiveFileInfo)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
ArchiveFileInfo = archiveFileInfo;
|
||||||
|
|
||||||
|
ReloadEditors();
|
||||||
|
|
||||||
|
_IsLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadEditors()
|
||||||
|
{
|
||||||
|
stComboBox1.Items.Clear();
|
||||||
|
stComboBox1.Items.Add("Hex Editor");
|
||||||
|
stComboBox1.Items.Add("File Editor");
|
||||||
|
stComboBox1.Items.Add("Text Editor");
|
||||||
|
stComboBox1.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEditor(int Index) { stComboBox1.SelectedIndex = Index; }
|
||||||
|
public int GetEditor() { return stComboBox1.SelectedIndex; }
|
||||||
|
|
||||||
|
public UserControl GetActiveEditor(Type type)
|
||||||
|
{
|
||||||
|
foreach (var control in stPanel1.Controls)
|
||||||
|
{
|
||||||
|
if (control.GetType() == type)
|
||||||
|
return (UserControl)control;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void UpdateEditor()
|
||||||
|
{
|
||||||
|
if (GetEditor() == 0)
|
||||||
|
UpdateHexView();
|
||||||
|
|
||||||
|
if (GetEditor() == 2)
|
||||||
|
UpdateTextView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateTextView()
|
||||||
|
{
|
||||||
|
TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor));
|
||||||
|
if (editor == null)
|
||||||
|
{
|
||||||
|
editor = new TextEditor();
|
||||||
|
editor.Dock = DockStyle.Fill;
|
||||||
|
AddControl(editor);
|
||||||
|
}
|
||||||
|
editor.Text = Text;
|
||||||
|
|
||||||
|
var File = ArchiveFileInfo.FileFormat;
|
||||||
|
if (File == null)
|
||||||
|
File = ArchiveFileInfo.OpenFile();
|
||||||
|
|
||||||
|
if (File != null && IsConvertableText(File.GetType()))
|
||||||
|
{
|
||||||
|
editor.FillEditor(((IConvertableTextFormat)File).ConvertToString());
|
||||||
|
|
||||||
|
if (((IConvertableTextFormat)File).TextFileType == TextFileType.Yaml)
|
||||||
|
editor.IsYAML = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
editor.FillEditor(ArchiveFileInfo.FileData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsConvertableText(Type type)
|
||||||
|
{
|
||||||
|
foreach (var inter in type.GetInterfaces())
|
||||||
|
{
|
||||||
|
if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHexView()
|
||||||
|
{
|
||||||
|
HexEditor editor = (HexEditor)GetActiveEditor(typeof(HexEditor));
|
||||||
|
if (editor == null)
|
||||||
|
{
|
||||||
|
editor = new HexEditor();
|
||||||
|
editor.Dock = DockStyle.Fill;
|
||||||
|
AddControl(editor);
|
||||||
|
}
|
||||||
|
editor.Text = Text;
|
||||||
|
editor.LoadData(ArchiveFileInfo.FileData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AddControl(Control control)
|
||||||
|
{
|
||||||
|
stPanel1.Controls.Clear();
|
||||||
|
stPanel1.Controls.Add(control);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stComboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_IsLoaded)
|
||||||
|
UpdateEditor();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.resx
Normal file
120
Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -92,10 +92,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
ObjectTree = new ObjectEditorTree(this);
|
ObjectTree = new ObjectEditorTree(this);
|
||||||
ObjectTree.Dock = DockStyle.Fill;
|
ObjectTree.Dock = DockStyle.Fill;
|
||||||
stPanel1.Controls.Add(ObjectTree);
|
stPanel1.Controls.Add(ObjectTree);
|
||||||
|
AddIArchiveFile(FileFormat);
|
||||||
TreeNode FileRoot = new ArchiveRootNodeWrapper(FileFormat.FileName, (IArchiveFile)FileFormat);
|
|
||||||
FillTreeNodes(FileRoot, (IArchiveFile)FileFormat);
|
|
||||||
AddNode(FileRoot);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -106,6 +103,13 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddIArchiveFile(IFileFormat FileFormat)
|
||||||
|
{
|
||||||
|
TreeNode FileRoot = new ArchiveRootNodeWrapper(FileFormat.FileName, (IArchiveFile)FileFormat);
|
||||||
|
FillTreeNodes(FileRoot, (IArchiveFile)FileFormat);
|
||||||
|
AddNode(FileRoot);
|
||||||
|
}
|
||||||
|
|
||||||
void FillTreeNodes(TreeNode root, IArchiveFile archiveFile)
|
void FillTreeNodes(TreeNode root, IArchiveFile archiveFile)
|
||||||
{
|
{
|
||||||
var rootText = root.Text;
|
var rootText = root.Text;
|
||||||
|
@ -510,7 +510,7 @@ namespace Switch_Toolbox.Library
|
|||||||
if (fileFormat.CanSave)
|
if (fileFormat.CanSave)
|
||||||
{
|
{
|
||||||
ArchiveFileInfo.FileData = fileFormat.Save();
|
ArchiveFileInfo.FileData = fileFormat.Save();
|
||||||
UpdateHexView();
|
UpdateEditor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,20 +529,20 @@ namespace Switch_Toolbox.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void OnClick(TreeView treeView) {
|
public override void OnClick(TreeView treeView) {
|
||||||
UpdateHexView();
|
UpdateEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHexView()
|
public void UpdateEditor()
|
||||||
{
|
{
|
||||||
HexEditor editor = (HexEditor)LibraryGUI.Instance.GetActiveContent(typeof(HexEditor));
|
ArchiveFilePanel editor = (ArchiveFilePanel)LibraryGUI.Instance.GetActiveContent(typeof(ArchiveFilePanel));
|
||||||
if (editor == null)
|
if (editor == null)
|
||||||
{
|
{
|
||||||
editor = new HexEditor();
|
editor = new ArchiveFilePanel(ArchiveFileInfo);
|
||||||
|
editor.Dock = DockStyle.Fill;
|
||||||
LibraryGUI.Instance.LoadEditor(editor);
|
LibraryGUI.Instance.LoadEditor(editor);
|
||||||
}
|
}
|
||||||
editor.Text = Text;
|
|
||||||
editor.Dock = DockStyle.Fill;
|
editor.UpdateEditor();
|
||||||
editor.LoadData(ArchiveFileInfo.FileData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReplaceNode(TreeNode node, TreeNode replaceNode, TreeNode NewNode)
|
public static void ReplaceNode(TreeNode node, TreeNode replaceNode, TreeNode NewNode)
|
||||||
|
30
Switch_Toolbox_Library/Interfaces/IConvertableTextFormat.cs
Normal file
30
Switch_Toolbox_Library/Interfaces/IConvertableTextFormat.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Switch_Toolbox.Library
|
||||||
|
{
|
||||||
|
public enum TextFileType
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Yaml,
|
||||||
|
Xml,
|
||||||
|
Json,
|
||||||
|
CSharp,
|
||||||
|
CPP,
|
||||||
|
Python,
|
||||||
|
Glsl,
|
||||||
|
}
|
||||||
|
|
||||||
|
//Represets a text format which can be converted to and from a string based file
|
||||||
|
//This can be used for formats to be used as yaml, xml, etc
|
||||||
|
public interface IConvertableTextFormat
|
||||||
|
{
|
||||||
|
TextFileType TextFileType { get; }
|
||||||
|
bool CanConvertBack { get; }
|
||||||
|
string ConvertToString();
|
||||||
|
void ConvertFromString(string text);
|
||||||
|
}
|
||||||
|
}
|
@ -219,10 +219,16 @@
|
|||||||
<Compile Include="FileFormats\DAE\DAE.cs" />
|
<Compile Include="FileFormats\DAE\DAE.cs" />
|
||||||
<Compile Include="FileFormats\OBJ.cs" />
|
<Compile Include="FileFormats\OBJ.cs" />
|
||||||
<Compile Include="FileFormats\R4G4.cs" />
|
<Compile Include="FileFormats\R4G4.cs" />
|
||||||
<Compile Include="Forms\ArchiveListPreviewForm.cs">
|
<Compile Include="Forms\Archive\ArchiveFilePanel.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\Archive\ArchiveFilePanel.Designer.cs">
|
||||||
|
<DependentUpon>ArchiveFilePanel.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\Archive\ArchiveListPreviewForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Forms\ArchiveListPreviewForm.Designer.cs">
|
<Compile Include="Forms\Archive\ArchiveListPreviewForm.Designer.cs">
|
||||||
<DependentUpon>ArchiveListPreviewForm.cs</DependentUpon>
|
<DependentUpon>ArchiveListPreviewForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Forms\BatchFormatExport.cs">
|
<Compile Include="Forms\BatchFormatExport.cs">
|
||||||
@ -566,6 +572,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Helpers\TextureHelper.cs" />
|
<Compile Include="Helpers\TextureHelper.cs" />
|
||||||
<Compile Include="Helpers\TreeHelper.cs" />
|
<Compile Include="Helpers\TreeHelper.cs" />
|
||||||
|
<Compile Include="Interfaces\IConvertableTextFormat.cs" />
|
||||||
<Compile Include="Interfaces\IEditor.cs" />
|
<Compile Include="Interfaces\IEditor.cs" />
|
||||||
<Compile Include="Interfaces\IFIleEditor.cs" />
|
<Compile Include="Interfaces\IFIleEditor.cs" />
|
||||||
<Compile Include="Interfaces\IMdiContainer.cs" />
|
<Compile Include="Interfaces\IMdiContainer.cs" />
|
||||||
@ -675,7 +682,10 @@
|
|||||||
<Compile Include="XML\XmlDoc.cs" />
|
<Compile Include="XML\XmlDoc.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Forms\ArchiveListPreviewForm.resx">
|
<EmbeddedResource Include="Forms\Archive\ArchiveFilePanel.resx">
|
||||||
|
<DependentUpon>ArchiveFilePanel.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Forms\Archive\ArchiveListPreviewForm.resx">
|
||||||
<DependentUpon>ArchiveListPreviewForm.cs</DependentUpon>
|
<DependentUpon>ArchiveListPreviewForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\BatchFormatExport.resx">
|
<EmbeddedResource Include="Forms\BatchFormatExport.resx">
|
||||||
|
@ -309,7 +309,10 @@ namespace Toolbox
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddObjectEditorFile(((TreeNode)file), (ObjectEditor)editor, false);
|
if (IsArchiveFile)
|
||||||
|
((ObjectEditor)editor).AddIArchiveFile((IFileFormat)file);
|
||||||
|
else
|
||||||
|
AddObjectEditorFile(((TreeNode)file), (ObjectEditor)editor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFormatSettings(GetActiveIFileFormat());
|
SetFormatSettings(GetActiveIFileFormat());
|
||||||
|
Loading…
Reference in New Issue
Block a user