1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Add option to automatically compress on save with no notification

This commit is contained in:
KillzXGaming 2019-07-03 12:56:28 -04:00
parent 52d42358b2
commit 9d203da716
10 changed files with 48 additions and 15 deletions

Binary file not shown.

View File

@ -234,6 +234,9 @@ namespace Switch_Toolbox.Library
case "UseDirectXTexDecoder":
bool.TryParse(node.InnerText, out Runtime.UseDirectXTexDecoder);
break;
case "AlwaysCompressOnSave":
bool.TryParse(node.InnerText, out Runtime.AlwaysCompressOnSave);
break;
}
}
}
@ -357,6 +360,7 @@ namespace Switch_Toolbox.Library
parentNode.AppendChild(mainSettingsNode);
mainSettingsNode.AppendChild(createNode(doc, "UseDirectXTexDecoder", Runtime.UseDirectXTexDecoder.ToString()));
mainSettingsNode.AppendChild(createNode(doc, "AlwaysCompressOnSave", Runtime.AlwaysCompressOnSave.ToString()));
mainSettingsNode.AppendChild(createNode(doc, "DisplayViewport", Runtime.DisplayViewport.ToString()));
mainSettingsNode.AppendChild(createNode(doc, "UseOpenGL", Runtime.UseOpenGL.ToString()));
mainSettingsNode.AppendChild(createNode(doc, "UseDebugDomainExceptionHandler", Runtime.UseDebugDomainExceptionHandler.ToString()));

View File

@ -209,9 +209,16 @@ namespace Switch_Toolbox.Library.IO
if (EnableDialog && FileIsCompressed)
{
DialogResult save = MessageBox.Show($"Compress file with {CompressionType}?", "File Save", MessageBoxButtons.YesNo);
bool CompressFile = false;
if (Runtime.AlwaysCompressOnSave)
CompressFile = true;
else
{
DialogResult save = MessageBox.Show($"Compress file with {CompressionType}?", "File Save", MessageBoxButtons.YesNo);
CompressFile = (save == DialogResult.Yes);
}
if (save == DialogResult.Yes)
if (CompressFile)
{
switch (CompressionType)
{

View File

@ -19,6 +19,8 @@ namespace Switch_Toolbox.Library
public static bool DEVELOPER_DEBUG_MODE = false;
public static bool AlwaysCompressOnSave = false;
public static class ResourceTables
{
public static bool TpTable = false;

View File

@ -80,6 +80,8 @@
this.stTabControl1 = new Switch_Toolbox.Library.Forms.STTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.chkAlwaysCompressOnSave = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkFrameCamera = new Switch_Toolbox.Library.Forms.STCheckBox();
this.modelLoadArchive = new Switch_Toolbox.Library.Forms.STCheckBox();
this.gridCellCountUD = new Switch_Toolbox.Library.Forms.NumericUpDownUint();
this.stLabel7 = new Switch_Toolbox.Library.Forms.STLabel();
@ -117,7 +119,6 @@
this.chkTpFileTable = new Switch_Toolbox.Library.Forms.STCheckBox();
this.stLabel17 = new Switch_Toolbox.Library.Forms.STLabel();
this.chkBotwFileTable = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkFrameCamera = new Switch_Toolbox.Library.Forms.STCheckBox();
this.contentContainer.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cameraMaxSpeedUD)).BeginInit();
@ -832,6 +833,7 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.chkAlwaysCompressOnSave);
this.tabPage2.Controls.Add(this.chkFrameCamera);
this.tabPage2.Controls.Add(this.modelLoadArchive);
this.tabPage2.Controls.Add(this.gridCellCountUD);
@ -854,6 +856,30 @@
this.tabPage2.Text = "Editor";
this.tabPage2.UseVisualStyleBackColor = true;
//
// chkAlwaysCompressOnSave
//
this.chkAlwaysCompressOnSave.AutoSize = true;
this.chkAlwaysCompressOnSave.Location = new System.Drawing.Point(9, 210);
this.chkAlwaysCompressOnSave.Name = "chkAlwaysCompressOnSave";
this.chkAlwaysCompressOnSave.Size = new System.Drawing.Size(219, 17);
this.chkAlwaysCompressOnSave.TabIndex = 19;
this.chkAlwaysCompressOnSave.Text = "Always compress on save (if used on file)";
this.chkAlwaysCompressOnSave.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.chkAlwaysCompressOnSave.UseVisualStyleBackColor = true;
this.chkAlwaysCompressOnSave.CheckedChanged += new System.EventHandler(this.chkAlwaysCompressOnSave_CheckedChanged);
//
// chkFrameCamera
//
this.chkFrameCamera.AutoSize = true;
this.chkFrameCamera.Location = new System.Drawing.Point(9, 233);
this.chkFrameCamera.Name = "chkFrameCamera";
this.chkFrameCamera.Size = new System.Drawing.Size(210, 17);
this.chkFrameCamera.TabIndex = 18;
this.chkFrameCamera.Text = "Center camera to model when selected";
this.chkFrameCamera.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.chkFrameCamera.UseVisualStyleBackColor = true;
this.chkFrameCamera.CheckedChanged += new System.EventHandler(this.chkFrameCamera_CheckedChanged);
//
// modelLoadArchive
//
this.modelLoadArchive.AutoSize = true;
@ -1254,18 +1280,6 @@
this.chkBotwFileTable.UseVisualStyleBackColor = true;
this.chkBotwFileTable.CheckedChanged += new System.EventHandler(this.chkBotwFileTable_CheckedChanged);
//
// chkFrameCamera
//
this.chkFrameCamera.AutoSize = true;
this.chkFrameCamera.Location = new System.Drawing.Point(9, 208);
this.chkFrameCamera.Name = "chkFrameCamera";
this.chkFrameCamera.Size = new System.Drawing.Size(210, 17);
this.chkFrameCamera.TabIndex = 18;
this.chkFrameCamera.Text = "Center camera to model when selected";
this.chkFrameCamera.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.chkFrameCamera.UseVisualStyleBackColor = true;
this.chkFrameCamera.CheckedChanged += new System.EventHandler(this.chkFrameCamera_CheckedChanged);
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1401,5 +1415,6 @@
private Switch_Toolbox.Library.Forms.STLabel stLabel17;
private Switch_Toolbox.Library.Forms.STCheckBox chkBotwFileTable;
private Switch_Toolbox.Library.Forms.STCheckBox chkFrameCamera;
private Switch_Toolbox.Library.Forms.STCheckBox chkAlwaysCompressOnSave;
}
}

View File

@ -88,6 +88,7 @@ namespace Toolbox
chkBotwFileTable.Checked = Runtime.ResourceTables.BotwTable;
chkTpFileTable.Checked = Runtime.ResourceTables.TpTable;
chkFrameCamera.Checked = Runtime.FrameCamera;
chkAlwaysCompressOnSave.Checked = Runtime.AlwaysCompressOnSave;
displayBoundingBoxeChk.Checked = Runtime.renderBoundingBoxes;
@ -656,5 +657,9 @@ namespace Toolbox
private void chkFrameCamera_CheckedChanged(object sender, EventArgs e) {
Runtime.FrameCamera = chkFrameCamera.Checked;
}
private void chkAlwaysCompressOnSave_CheckedChanged(object sender, EventArgs e) {
Runtime.AlwaysCompressOnSave = chkAlwaysCompressOnSave.Checked;
}
}
}