mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-16 19:11:54 +00:00
Added COL File Editor to Tools menu
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
PCK-Studio/MainForm.Designer.cs
generated
34
PCK-Studio/MainForm.Designer.cs
generated
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2394,5 +2394,10 @@ namespace PckStudio
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void colEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
new COLEditor().ShowDialog(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -522,7 +522,7 @@
|
||||
</value>
|
||||
</data>
|
||||
<data name="newToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="newToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>New</value>
|
||||
@@ -536,7 +536,7 @@
|
||||
</value>
|
||||
</data>
|
||||
<data name="openToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="openToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Open</value>
|
||||
@@ -550,7 +550,7 @@
|
||||
</value>
|
||||
</data>
|
||||
<data name="extractToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="extractToolStripMenuItem1.Text" xml:space="preserve">
|
||||
<value>Extract</value>
|
||||
@@ -562,7 +562,7 @@
|
||||
<value>Full box support</value>
|
||||
</data>
|
||||
<data name="packSettingsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="packSettingsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Pack Settings</value>
|
||||
@@ -584,7 +584,7 @@
|
||||
</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Text" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
@@ -603,13 +603,13 @@
|
||||
</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Save As</value>
|
||||
</data>
|
||||
<data name="closeToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="closeToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
@@ -703,6 +703,18 @@
|
||||
<data name="convertMusicFilesToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Convert Music Files</value>
|
||||
</data>
|
||||
<data name="cOLEditorToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="cOLEditorToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>.COL Editor</value>
|
||||
</data>
|
||||
<data name="fileEditorsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>195, 22</value>
|
||||
</data>
|
||||
<data name="fileEditorsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>File Editors</value>
|
||||
</data>
|
||||
<data name="miscToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>46, 20</value>
|
||||
</data>
|
||||
@@ -29098,9 +29110,6 @@
|
||||
AP//AAA=
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1064, 660</value>
|
||||
</data>
|
||||
@@ -29656,6 +29665,18 @@
|
||||
<data name=">>imageList.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>fileEditorsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>fileEditorsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>fileEditorsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>cOLEditorToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>cOLEditorToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>cOLEditorToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>MainForm</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user