diff --git a/ASU/App.config b/ASU/App.config index 8e1d99f..e6e570b 100644 --- a/ASU/App.config +++ b/ASU/App.config @@ -6,8 +6,9 @@ - + + diff --git a/ASU/Properties/AssemblyInfo.cs b/ASU/Properties/AssemblyInfo.cs index c3e1685..56fd418 100644 --- a/ASU/Properties/AssemblyInfo.cs +++ b/ASU/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("16.0.0.0")] -[assembly: AssemblyFileVersion("16.0.0.0")] +[assembly: AssemblyVersion("17.0.0.0")] +[assembly: AssemblyFileVersion("17.0.0.0")] diff --git a/ASU/UI/MainForm.cs b/ASU/UI/MainForm.cs index ce44912..782a7be 100644 --- a/ASU/UI/MainForm.cs +++ b/ASU/UI/MainForm.cs @@ -54,8 +54,8 @@ private List Boxes private static string ThirdPartyImageConverterPath; public static bool PromptForDestinationFolder = true; public static bool AutoOpenDestinationFolder = true; - public static bool MakeBackgroundTransparent = true; + public static bool PreservePallette = false; private System.Threading.Timer multipleUnpackerTimer; #endregion @@ -66,6 +66,41 @@ public MainForm() this.InitializeComponent(); } + private void MainForm_Load(object sender, System.EventArgs e) + { + try + { + this.SuppressThirdPartyWarningMessage = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["SuppressThirdPartyImageConverterWarningMessage"]); + this.ExportLocationTextBox.Text = AppDomain.CurrentDomain.BaseDirectory; + this.KeyPreview = true; + ThirdPartyImageConverterPath = System.Configuration.ConfigurationManager.AppSettings["ThirdPartyImageConverter"]; + + if (ThirdPartyImageConverterPath.StartsWith("\\")) + { + ThirdPartyImageConverterPath = AppDomain.CurrentDomain.BaseDirectory + ThirdPartyImageConverterPath; + } + AutoOpenDestinationFolder = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["AutoOpenDestinationFolder"]); + PromptForDestinationFolder = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["PromptForDestinationFolder"]); + Outline.Width = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TileOutlineWidth"]); + DistanceBetweenTiles = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DistanceBetweenFrames"]); + MakeBackgroundTransparent = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["ExportedOptionsMakeBackgroundTransparent"]); + PreservePallette = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["PreservePallette"]); + + Dictionary formats = new Dictionary(); + formats.Add("png", System.Drawing.Imaging.ImageFormat.Png); + formats.Add("bmp", System.Drawing.Imaging.ImageFormat.Bmp); + formats.Add("gif", System.Drawing.Imaging.ImageFormat.Gif); + formats.Add("tiff", System.Drawing.Imaging.ImageFormat.Tiff); + formats.Add("jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); + formats.Add("jpg", System.Drawing.Imaging.ImageFormat.Jpeg); + ExportFormat = formats[System.Configuration.ConfigurationManager.AppSettings["ExportedOptionsFileFormat"].Replace(".", "").ToLower()]; + } + catch (Exception ex) + { + ForkandBeard.Logic.ExceptionHandler.HandleException(ex, "cat@forkandbeard.co.uk"); + } + } + private List unpackers = new List(); private void CreateUnpacker(Bitmap image, string fileName) { @@ -83,7 +118,7 @@ private void CreateUnpacker(Bitmap image, string fileName) this.ZoomPanel.Visible = false; - unpacker = new BO.ImageUnpacker(image, fileName, MakeBackgroundTransparent && !this.Options.PreservePalletteCheckBox.Checked); + unpacker = new BO.ImageUnpacker(image, fileName, MakeBackgroundTransparent && !PreservePallette); this.unpackers.Add(unpacker); } @@ -386,40 +421,6 @@ private void frmMain_FormClosing(object sender, System.Windows.Forms.FormClosing } } - private void MainForm_Load(object sender, System.EventArgs e) - { - try - { - this.SuppressThirdPartyWarningMessage = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["SuppressThirdPartyImageConverterWarningMessage"]); - this.ExportLocationTextBox.Text = AppDomain.CurrentDomain.BaseDirectory; - this.KeyPreview = true; - ThirdPartyImageConverterPath = System.Configuration.ConfigurationManager.AppSettings["ThirdPartyImageConverter"]; - - if (ThirdPartyImageConverterPath.StartsWith("\\")) - { - ThirdPartyImageConverterPath = AppDomain.CurrentDomain.BaseDirectory + ThirdPartyImageConverterPath; - } - AutoOpenDestinationFolder = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["AutoOpenDestinationFolder"]); - PromptForDestinationFolder = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["PromptForDestinationFolder"]); - Outline.Width = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TileOutlineWidth"]); - DistanceBetweenTiles = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DistanceBetweenFrames"]); - MakeBackgroundTransparent = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["ExportedOptionsMakeBackgroundTransparent"]); - - Dictionary formats = new Dictionary(); - formats.Add("png", System.Drawing.Imaging.ImageFormat.Png); - formats.Add("bmp", System.Drawing.Imaging.ImageFormat.Bmp); - formats.Add("gif", System.Drawing.Imaging.ImageFormat.Gif); - formats.Add("tiff", System.Drawing.Imaging.ImageFormat.Tiff); - formats.Add("jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); - formats.Add("jpg", System.Drawing.Imaging.ImageFormat.Jpeg); - ExportFormat = formats[System.Configuration.ConfigurationManager.AppSettings["ExportedOptionsFileFormat"].Replace(".", "").ToLower()]; - } - catch (Exception ex) - { - ForkandBeard.Logic.ExceptionHandler.HandleException(ex, "cat@forkandbeard.co.uk"); - } - } - private void MainPanel_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { object dropped = null; @@ -1026,7 +1027,7 @@ private void ExportUnpackers(List unpackers) objGraphics.Dispose(); } - if (this.Options != null && this.Options.PreservePalletteCheckBox.Checked) + if (PreservePallette) { if (unpacker.GetPallette() != null) { diff --git a/ASU/UI/OptionsForm.cs b/ASU/UI/OptionsForm.cs index f6df423..8348c3b 100644 --- a/ASU/UI/OptionsForm.cs +++ b/ASU/UI/OptionsForm.cs @@ -44,6 +44,8 @@ private void OptionsForm_Load(object sender, System.EventArgs e) this.HoverColourPanel.BackColor = MainForm.HoverFill.Color; this.DistanceBetweenTilesUpDown.Value = MainForm.DistanceBetweenTiles; this.OutlineWidthUpDown.Value = Convert.ToDecimal(MainForm.Outline.Width); + this.PreservePalletteCheckBox.Checked = MainForm.PreservePallette; + if (MainForm.ExportFormat != null) { this.ExportFormatComboBox.SelectedItem = MainForm.ExportFormat; @@ -96,6 +98,7 @@ private void CloseButton_Click(System.Object sender, System.EventArgs e) MainForm.PromptForDestinationFolder = this.PromptDestinationFolderCheckBox.Checked; MainForm.AutoOpenDestinationFolder = this.OpenExportedDestinationCheckBox.Checked; MainForm.MakeBackgroundTransparent = this.ExportBGTransparentCheckBox.Checked; + MainForm.PreservePallette = this.PreservePalletteCheckBox.Checked; if (this.ExportFormatComboBox.Text != STR_ADVANCED_EXPORT_FILE_FORMAT) {