@@ -54,8 +54,8 @@ private List<Rectangle> Boxes
5454 private static string ThirdPartyImageConverterPath ;
5555 public static bool PromptForDestinationFolder = true ;
5656 public static bool AutoOpenDestinationFolder = true ;
57-
5857 public static bool MakeBackgroundTransparent = true ;
58+ public static bool PreservePallette = false ;
5959
6060 private System . Threading . Timer multipleUnpackerTimer ;
6161 #endregion
@@ -66,6 +66,41 @@ public MainForm()
6666 this . InitializeComponent ( ) ;
6767 }
6868
69+ private void MainForm_Load ( object sender , System . EventArgs e )
70+ {
71+ try
72+ {
73+ this . SuppressThirdPartyWarningMessage = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "SuppressThirdPartyImageConverterWarningMessage" ] ) ;
74+ this . ExportLocationTextBox . Text = AppDomain . CurrentDomain . BaseDirectory ;
75+ this . KeyPreview = true ;
76+ ThirdPartyImageConverterPath = System . Configuration . ConfigurationManager . AppSettings [ "ThirdPartyImageConverter" ] ;
77+
78+ if ( ThirdPartyImageConverterPath . StartsWith ( "\\ " ) )
79+ {
80+ ThirdPartyImageConverterPath = AppDomain . CurrentDomain . BaseDirectory + ThirdPartyImageConverterPath ;
81+ }
82+ AutoOpenDestinationFolder = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "AutoOpenDestinationFolder" ] ) ;
83+ PromptForDestinationFolder = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "PromptForDestinationFolder" ] ) ;
84+ Outline . Width = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "TileOutlineWidth" ] ) ;
85+ DistanceBetweenTiles = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "DistanceBetweenFrames" ] ) ;
86+ MakeBackgroundTransparent = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "ExportedOptionsMakeBackgroundTransparent" ] ) ;
87+ PreservePallette = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "PreservePallette" ] ) ;
88+
89+ Dictionary < string , System . Drawing . Imaging . ImageFormat > formats = new Dictionary < string , System . Drawing . Imaging . ImageFormat > ( ) ;
90+ formats . Add ( "png" , System . Drawing . Imaging . ImageFormat . Png ) ;
91+ formats . Add ( "bmp" , System . Drawing . Imaging . ImageFormat . Bmp ) ;
92+ formats . Add ( "gif" , System . Drawing . Imaging . ImageFormat . Gif ) ;
93+ formats . Add ( "tiff" , System . Drawing . Imaging . ImageFormat . Tiff ) ;
94+ formats . Add ( "jpeg" , System . Drawing . Imaging . ImageFormat . Jpeg ) ;
95+ formats . Add ( "jpg" , System . Drawing . Imaging . ImageFormat . Jpeg ) ;
96+ ExportFormat = formats [ System . Configuration . ConfigurationManager . AppSettings [ "ExportedOptionsFileFormat" ] . Replace ( "." , "" ) . ToLower ( ) ] ;
97+ }
98+ catch ( Exception ex )
99+ {
100+ ForkandBeard . Logic . ExceptionHandler . HandleException ( ex , "cat@forkandbeard.co.uk" ) ;
101+ }
102+ }
103+
69104 private List < BO . ImageUnpacker > unpackers = new List < BO . ImageUnpacker > ( ) ;
70105 private void CreateUnpacker ( Bitmap image , string fileName )
71106 {
@@ -83,7 +118,7 @@ private void CreateUnpacker(Bitmap image, string fileName)
83118
84119 this . ZoomPanel . Visible = false ;
85120
86- unpacker = new BO . ImageUnpacker ( image , fileName , MakeBackgroundTransparent && ! this . Options . PreservePalletteCheckBox . Checked ) ;
121+ unpacker = new BO . ImageUnpacker ( image , fileName , MakeBackgroundTransparent && ! PreservePallette ) ;
87122 this . unpackers . Add ( unpacker ) ;
88123 }
89124
@@ -386,40 +421,6 @@ private void frmMain_FormClosing(object sender, System.Windows.Forms.FormClosing
386421 }
387422 }
388423
389- private void MainForm_Load ( object sender , System . EventArgs e )
390- {
391- try
392- {
393- this . SuppressThirdPartyWarningMessage = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "SuppressThirdPartyImageConverterWarningMessage" ] ) ;
394- this . ExportLocationTextBox . Text = AppDomain . CurrentDomain . BaseDirectory ;
395- this . KeyPreview = true ;
396- ThirdPartyImageConverterPath = System . Configuration . ConfigurationManager . AppSettings [ "ThirdPartyImageConverter" ] ;
397-
398- if ( ThirdPartyImageConverterPath . StartsWith ( "\\ " ) )
399- {
400- ThirdPartyImageConverterPath = AppDomain . CurrentDomain . BaseDirectory + ThirdPartyImageConverterPath ;
401- }
402- AutoOpenDestinationFolder = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "AutoOpenDestinationFolder" ] ) ;
403- PromptForDestinationFolder = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "PromptForDestinationFolder" ] ) ;
404- Outline . Width = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "TileOutlineWidth" ] ) ;
405- DistanceBetweenTiles = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "DistanceBetweenFrames" ] ) ;
406- MakeBackgroundTransparent = Convert . ToBoolean ( System . Configuration . ConfigurationManager . AppSettings [ "ExportedOptionsMakeBackgroundTransparent" ] ) ;
407-
408- Dictionary < string , System . Drawing . Imaging . ImageFormat > formats = new Dictionary < string , System . Drawing . Imaging . ImageFormat > ( ) ;
409- formats . Add ( "png" , System . Drawing . Imaging . ImageFormat . Png ) ;
410- formats . Add ( "bmp" , System . Drawing . Imaging . ImageFormat . Bmp ) ;
411- formats . Add ( "gif" , System . Drawing . Imaging . ImageFormat . Gif ) ;
412- formats . Add ( "tiff" , System . Drawing . Imaging . ImageFormat . Tiff ) ;
413- formats . Add ( "jpeg" , System . Drawing . Imaging . ImageFormat . Jpeg ) ;
414- formats . Add ( "jpg" , System . Drawing . Imaging . ImageFormat . Jpeg ) ;
415- ExportFormat = formats [ System . Configuration . ConfigurationManager . AppSettings [ "ExportedOptionsFileFormat" ] . Replace ( "." , "" ) . ToLower ( ) ] ;
416- }
417- catch ( Exception ex )
418- {
419- ForkandBeard . Logic . ExceptionHandler . HandleException ( ex , "cat@forkandbeard.co.uk" ) ;
420- }
421- }
422-
423424 private void MainPanel_DragDrop ( object sender , System . Windows . Forms . DragEventArgs e )
424425 {
425426 object dropped = null ;
@@ -1026,7 +1027,7 @@ private void ExportUnpackers(List<BO.ImageUnpacker> unpackers)
10261027 objGraphics . Dispose ( ) ;
10271028 }
10281029
1029- if ( this . Options != null && this . Options . PreservePalletteCheckBox . Checked )
1030+ if ( PreservePallette )
10301031 {
10311032 if ( unpacker . GetPallette ( ) != null )
10321033 {
0 commit comments