diff --git a/PCK-Studio/Forms/Editor/COLEditor.cs b/PCK-Studio/Forms/Editor/COLEditor.cs
index a183da36..62be2cc6 100644
--- a/PCK-Studio/Forms/Editor/COLEditor.cs
+++ b/PCK-Studio/Forms/Editor/COLEditor.cs
@@ -44,6 +44,15 @@ namespace PckStudio.Forms.Editor
SetUpDefaultFile(null, EventArgs.Empty, 11, false);
}
+ public COLEditor() // for editing external files
+ {
+ InitializeComponent();
+
+ SetUpMenu();
+
+ openToolStripMenuItem_Click(null, null);
+ }
+
void SetUpMenu()
{
TU12ToolStripMenuItem.Click += (sender, e) => SetUpDefaultFile(sender, e, 0);
@@ -245,12 +254,39 @@ namespace PckStudio.Forms.Editor
return;
}
}
- using (var stream = new MemoryStream())
+
+ if(_file is null) // if external file is being edited
{
- var writer = new COLFileWriter(colourfile);
- writer.WriteToStream(stream);
- _file.SetData(stream.ToArray());
+ using (var sfd = new SaveFileDialog())
+ {
+ sfd.Filter = "COL (Minecraft Color Table)|*.col";
+ if (sfd.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ var writer = new COLFileWriter(colourfile);
+ writer.WriteToFile(sfd.FileName);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(this, $"Failed to read the selected file\nError: {ex.Message}", "Failed to read .col file");
+ }
+
+ SetUpDefaultFile(null, EventArgs.Empty, 11, false);
+ }
+ else return;
+ }
}
+ else
+ {
+ using (var stream = new MemoryStream())
+ {
+ var writer = new COLFileWriter(colourfile);
+ writer.WriteToStream(stream);
+ _file.SetData(stream.ToArray());
+ }
+ }
+
DialogResult = DialogResult.OK;
}
@@ -634,6 +670,10 @@ namespace PckStudio.Forms.Editor
SetUpDefaultFile(null, EventArgs.Empty, 11, false);
}
+ else if(_file is null)
+ {
+ Close();
+ }
}
}
}
diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs
index 42a20ff1..2880361f 100644
--- a/PCK-Studio/MainForm.Designer.cs
+++ b/PCK-Studio/MainForm.Designer.cs
@@ -145,8 +145,10 @@
this.label11 = new MetroFramework.Controls.MetroLabel();
this.treeViewMain = new System.Windows.Forms.TreeView();
this.imageList = new System.Windows.Forms.ImageList(this.components);
- this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.pictureBoxImagePreview = new PckStudio.PictureBoxWithInterpolationMode();
+ this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
+ this.fileEditorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.cOLEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuPCKEntries.SuspendLayout();
this.menuStrip.SuspendLayout();
this.contextMenuMetaTree.SuspendLayout();
@@ -552,7 +554,8 @@
this.miscToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addCustomPackImageToolStripMenuItem,
this.openPckManagerToolStripMenuItem,
- this.convertMusicFilesToolStripMenuItem});
+ this.convertMusicFilesToolStripMenuItem,
+ this.fileEditorsToolStripMenuItem});
this.miscToolStripMenuItem.ForeColor = System.Drawing.Color.White;
this.miscToolStripMenuItem.Name = "miscToolStripMenuItem";
resources.ApplyResources(this.miscToolStripMenuItem, "miscToolStripMenuItem");
@@ -1083,6 +1086,14 @@
resources.ApplyResources(this.imageList, "imageList");
this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
+ // pictureBoxImagePreview
+ //
+ resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview");
+ this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
+ this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
+ this.pictureBoxImagePreview.Name = "pictureBoxImagePreview";
+ this.pictureBoxImagePreview.TabStop = false;
+ //
// LittleEndianCheckBox
//
resources.ApplyResources(this.LittleEndianCheckBox, "LittleEndianCheckBox");
@@ -1092,13 +1103,18 @@
this.LittleEndianCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
this.LittleEndianCheckBox.UseSelectable = true;
//
- // pictureBoxImagePreview
+ // fileEditorsToolStripMenuItem
//
- resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview");
- this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
- this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
- this.pictureBoxImagePreview.Name = "pictureBoxImagePreview";
- this.pictureBoxImagePreview.TabStop = false;
+ this.fileEditorsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.cOLEditorToolStripMenuItem});
+ this.fileEditorsToolStripMenuItem.Name = "fileEditorsToolStripMenuItem";
+ resources.ApplyResources(this.fileEditorsToolStripMenuItem, "fileEditorsToolStripMenuItem");
+ //
+ // cOLEditorToolStripMenuItem
+ //
+ this.cOLEditorToolStripMenuItem.Name = "cOLEditorToolStripMenuItem";
+ resources.ApplyResources(this.cOLEditorToolStripMenuItem, "cOLEditorToolStripMenuItem");
+ this.cOLEditorToolStripMenuItem.Click += new System.EventHandler(this.colEditorToolStripMenuItem_Click);
//
// MainForm
//
@@ -1255,6 +1271,8 @@
private System.Windows.Forms.ToolStripMenuItem addEntryToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem addBOXEntryToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem addANIMEntryToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem fileEditorsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem cOLEditorToolStripMenuItem;
}
}
diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs
index 549ffa21..d3808515 100644
--- a/PCK-Studio/MainForm.cs
+++ b/PCK-Studio/MainForm.cs
@@ -2394,5 +2394,10 @@ namespace PckStudio
return;
}
}
+
+ private void colEditorToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ new COLEditor().ShowDialog(this);
+ }
}
}
\ No newline at end of file
diff --git a/PCK-Studio/MainForm.resx b/PCK-Studio/MainForm.resx
index b5c4e4b6..fef9305e 100644
--- a/PCK-Studio/MainForm.resx
+++ b/PCK-Studio/MainForm.resx
@@ -522,7 +522,7 @@
- 144, 22
+ 180, 22
New
@@ -536,7 +536,7 @@
- 144, 22
+ 180, 22
Open
@@ -550,7 +550,7 @@
- 144, 22
+ 180, 22
Extract
@@ -562,7 +562,7 @@
Full box support
- 144, 22
+ 180, 22
Pack Settings
@@ -584,7 +584,7 @@
- 144, 22
+ 180, 22
Save
@@ -603,13 +603,13 @@
- 144, 22
+ 180, 22
Save As
- 144, 22
+ 180, 22
Close
@@ -703,6 +703,18 @@
Convert Music Files
+
+ 180, 22
+
+
+ .COL Editor
+
+
+ 195, 22
+
+
+ File Editors
+
46, 20
@@ -29098,9 +29110,6 @@
AP//AAA=
-
- NoControl
-
1064, 660
@@ -29656,6 +29665,18 @@
System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ fileEditorsToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ cOLEditorToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
MainForm