diff --git a/GARbro.sln b/GARbro.sln
index c762691c..7ca45af6 100644
--- a/GARbro.sln
+++ b/GARbro.sln
@@ -16,7 +16,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcFormats", "ArcFormats\Ar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameRes", "GameRes\GameRes.csproj", "{453C087F-E416-4AE9-8C03-D8760DA0574B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GARbro.GUI", "GARbro.GUI.csproj", "{2935BE57-C4E0-43E7-86DE-C1848C820B19}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GARbro.GUI", "GUI\GARbro.GUI.csproj", "{2935BE57-C4E0-43E7-86DE-C1848C820B19}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Image.Convert", "Image.Convert\Image.Convert.csproj", "{757EB8B1-F62C-4690-AC3D-DAE4A5576B3E}"
ProjectSection(ProjectDependencies) = postProject
diff --git a/AboutBox.xaml b/GUI/AboutBox.xaml
similarity index 98%
rename from AboutBox.xaml
rename to GUI/AboutBox.xaml
index 1f581465..8c8330fd 100644
--- a/AboutBox.xaml
+++ b/GUI/AboutBox.xaml
@@ -1,144 +1,144 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AboutBox.xaml.cs b/GUI/AboutBox.xaml.cs
similarity index 97%
rename from AboutBox.xaml.cs
rename to GUI/AboutBox.xaml.cs
index b76b2ec7..06d51857 100644
--- a/AboutBox.xaml.cs
+++ b/GUI/AboutBox.xaml.cs
@@ -1,277 +1,277 @@
-/// Game Resource browser
-//
-// Copyright (C) 2014-2015 by morkt
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Windows;
-using System.Windows.Data;
-using System.Windows.Documents;
-using GARbro.GUI.Properties;
-using GARbro.GUI.Strings;
-
-namespace GARbro.GUI
-{
- ///
- /// Interaction logic for AboutBox.xaml
- ///
- public partial class AboutBox : Rnd.Windows.ModalWindow
- {
- public AboutBox()
- {
- InitializeComponent();
- LicenseTabText.Document = GetResourceDoc ("GARbro.GUI.LICENSE");
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
-
- #region License text backend
-
- static FlowDocument GetResourceDoc (string resource)
- {
- var assembly = Assembly.GetExecutingAssembly();
- using (var stream = assembly.GetManifestResourceStream (resource))
- {
- if (null == stream)
- return new FlowDocument();
- return ReadPlainText (stream);
- }
- }
-
- ///
- /// Read plain text from stream and return it as FlowDocument.
- ///
- static FlowDocument ReadPlainText (Stream stream)
- {
- using (var reader = new StreamReader (stream))
- {
- var doc = new FlowDocument();
- var para = new Paragraph();
- for (;;)
- {
- var line = reader.ReadLine();
- if (null == line)
- break;
- if (line.Length > 0)
- {
- if (para.Inlines.Count > 0)
- para.Inlines.Add (" ");
- para.Inlines.Add (line);
- }
- else
- {
- if (0 == para.Inlines.Count)
- para.Inlines.Add (new LineBreak());
- doc.Blocks.Add (para);
- para = new Paragraph();
- }
- }
- if (para.Inlines.Count > 0)
- doc.Blocks.Add (para);
- return doc;
- }
- }
-
- #endregion
-
- #region Assembly Attribute Accessors
-
- public string AssemblyTitle
- {
- get
- {
- object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
- if (attributes.Length > 0)
- {
- AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
- if (titleAttribute.Title != "")
- {
- return titleAttribute.Title;
- }
- }
- return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
- }
- }
-
- public string VersionString
- {
- get
- {
- return string.Format (guiStrings.MsgVersion, AssemblyVersion);
- }
- }
-
- public string AssemblyVersion
- {
- get
- {
- return Assembly.GetExecutingAssembly().GetName().Version.ToString();
- }
- }
-
- public string AssemblyDescription
- {
- get
- {
- object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
- if (attributes.Length == 0)
- {
- return "";
- }
- return ((AssemblyDescriptionAttribute)attributes[0]).Description;
- }
- }
-
- public string AssemblyProduct
- {
- get
- {
- object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
- if (attributes.Length == 0)
- {
- return "";
- }
- return ((AssemblyProductAttribute)attributes[0]).Product;
- }
- }
-
- public string AssemblyCopyright
- {
- get
- {
- object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
- if (attributes.Length == 0)
- {
- return "";
- }
- return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
- }
- }
-
- public string AssemblyCompany
- {
- get
- {
- object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
- if (attributes.Length == 0)
- {
- return "";
- }
- return ((AssemblyCompanyAttribute)attributes[0]).Company;
- }
- }
- #endregion
- }
-
- public class BooleanToVisibiltyConverter : IValueConverter
- {
- /// Convert a boolean value to a Visibility value
- public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- bool isVisible = (bool)value;
-
- // If visibility is inverted by the converter parameter, then invert our value
- if (IsVisibilityInverted (parameter))
- isVisible = !isVisible;
-
- return (isVisible ? Visibility.Visible : Visibility.Collapsed);
- }
-
- ///
- /// Determine the visibility mode based on a converter parameter. This parameter is
- /// of type Visibility, and specifies what visibility value to return when the boolean
- /// value is true.
- ///
- private static Visibility GetVisibilityMode(object parameter)
- {
- // Default to Visible
- Visibility mode = Visibility.Visible;
-
- // If a parameter is specified, then we'll try to understand it as a Visibility value
- if (parameter != null)
- {
- // If it's already a Visibility value, then just use it
- if (parameter is Visibility)
- {
- mode = (Visibility)parameter;
- }
- else
- {
- // Let's try to parse the parameter as a Visibility value, throwing an exception when the parsing fails
- try
- {
- mode = (Visibility)Enum.Parse(typeof(Visibility), parameter.ToString(), true);
- }
- catch (FormatException e)
- {
- throw new FormatException("Invalid Visibility specified as the ConverterParameter. Use Visible or Collapsed.", e);
- }
- }
- }
-
- // Return the detected mode
- return mode;
- }
-
- ///
- /// Determine whether or not visibility is inverted based on a converter parameter.
- /// When the parameter is specified as Collapsed, that means that when the boolean value
- /// is true, we should return Collapsed, which is inverted.
- ///
- private static bool IsVisibilityInverted(object parameter)
- {
- return (GetVisibilityMode(parameter) == Visibility.Collapsed);
- }
-
- ///
- /// Support 2-way databinding of the VisibilityConverter, converting Visibility to a boolean
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- bool isVisible = ((Visibility)value == Visibility.Visible);
-
- // If visibility is inverted by the converter parameter, then invert our value
- if (IsVisibilityInverted(parameter))
- isVisible = !isVisible;
-
- return isVisible;
- }
- }
-
- [ValueConversion(typeof(bool), typeof(string))]
- class CanCreateConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return (bool)value ? "[r/w]" : "[r]";
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return false;
- }
- }
-}
+/// Game Resource browser
+//
+// Copyright (C) 2014-2015 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Documents;
+using GARbro.GUI.Properties;
+using GARbro.GUI.Strings;
+
+namespace GARbro.GUI
+{
+ ///
+ /// Interaction logic for AboutBox.xaml
+ ///
+ public partial class AboutBox : Rnd.Windows.ModalWindow
+ {
+ public AboutBox()
+ {
+ InitializeComponent();
+ LicenseTabText.Document = GetResourceDoc ("GARbro.GUI.LICENSE");
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ #region License text backend
+
+ static FlowDocument GetResourceDoc (string resource)
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ using (var stream = assembly.GetManifestResourceStream (resource))
+ {
+ if (null == stream)
+ return new FlowDocument();
+ return ReadPlainText (stream);
+ }
+ }
+
+ ///
+ /// Read plain text from stream and return it as FlowDocument.
+ ///
+ static FlowDocument ReadPlainText (Stream stream)
+ {
+ using (var reader = new StreamReader (stream))
+ {
+ var doc = new FlowDocument();
+ var para = new Paragraph();
+ for (;;)
+ {
+ var line = reader.ReadLine();
+ if (null == line)
+ break;
+ if (line.Length > 0)
+ {
+ if (para.Inlines.Count > 0)
+ para.Inlines.Add (" ");
+ para.Inlines.Add (line);
+ }
+ else
+ {
+ if (0 == para.Inlines.Count)
+ para.Inlines.Add (new LineBreak());
+ doc.Blocks.Add (para);
+ para = new Paragraph();
+ }
+ }
+ if (para.Inlines.Count > 0)
+ doc.Blocks.Add (para);
+ return doc;
+ }
+ }
+
+ #endregion
+
+ #region Assembly Attribute Accessors
+
+ public string AssemblyTitle
+ {
+ get
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
+ if (attributes.Length > 0)
+ {
+ AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
+ if (titleAttribute.Title != "")
+ {
+ return titleAttribute.Title;
+ }
+ }
+ return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
+ }
+ }
+
+ public string VersionString
+ {
+ get
+ {
+ return string.Format (guiStrings.MsgVersion, AssemblyVersion);
+ }
+ }
+
+ public string AssemblyVersion
+ {
+ get
+ {
+ return Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ }
+ }
+
+ public string AssemblyDescription
+ {
+ get
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
+ if (attributes.Length == 0)
+ {
+ return "";
+ }
+ return ((AssemblyDescriptionAttribute)attributes[0]).Description;
+ }
+ }
+
+ public string AssemblyProduct
+ {
+ get
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
+ if (attributes.Length == 0)
+ {
+ return "";
+ }
+ return ((AssemblyProductAttribute)attributes[0]).Product;
+ }
+ }
+
+ public string AssemblyCopyright
+ {
+ get
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
+ if (attributes.Length == 0)
+ {
+ return "";
+ }
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
+ }
+ }
+
+ public string AssemblyCompany
+ {
+ get
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
+ if (attributes.Length == 0)
+ {
+ return "";
+ }
+ return ((AssemblyCompanyAttribute)attributes[0]).Company;
+ }
+ }
+ #endregion
+ }
+
+ public class BooleanToVisibiltyConverter : IValueConverter
+ {
+ /// Convert a boolean value to a Visibility value
+ public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ bool isVisible = (bool)value;
+
+ // If visibility is inverted by the converter parameter, then invert our value
+ if (IsVisibilityInverted (parameter))
+ isVisible = !isVisible;
+
+ return (isVisible ? Visibility.Visible : Visibility.Collapsed);
+ }
+
+ ///
+ /// Determine the visibility mode based on a converter parameter. This parameter is
+ /// of type Visibility, and specifies what visibility value to return when the boolean
+ /// value is true.
+ ///
+ private static Visibility GetVisibilityMode(object parameter)
+ {
+ // Default to Visible
+ Visibility mode = Visibility.Visible;
+
+ // If a parameter is specified, then we'll try to understand it as a Visibility value
+ if (parameter != null)
+ {
+ // If it's already a Visibility value, then just use it
+ if (parameter is Visibility)
+ {
+ mode = (Visibility)parameter;
+ }
+ else
+ {
+ // Let's try to parse the parameter as a Visibility value, throwing an exception when the parsing fails
+ try
+ {
+ mode = (Visibility)Enum.Parse(typeof(Visibility), parameter.ToString(), true);
+ }
+ catch (FormatException e)
+ {
+ throw new FormatException("Invalid Visibility specified as the ConverterParameter. Use Visible or Collapsed.", e);
+ }
+ }
+ }
+
+ // Return the detected mode
+ return mode;
+ }
+
+ ///
+ /// Determine whether or not visibility is inverted based on a converter parameter.
+ /// When the parameter is specified as Collapsed, that means that when the boolean value
+ /// is true, we should return Collapsed, which is inverted.
+ ///
+ private static bool IsVisibilityInverted(object parameter)
+ {
+ return (GetVisibilityMode(parameter) == Visibility.Collapsed);
+ }
+
+ ///
+ /// Support 2-way databinding of the VisibilityConverter, converting Visibility to a boolean
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ bool isVisible = ((Visibility)value == Visibility.Visible);
+
+ // If visibility is inverted by the converter parameter, then invert our value
+ if (IsVisibilityInverted(parameter))
+ isVisible = !isVisible;
+
+ return isVisible;
+ }
+ }
+
+ [ValueConversion(typeof(bool), typeof(string))]
+ class CanCreateConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return (bool)value ? "[r/w]" : "[r]";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return false;
+ }
+ }
+}
diff --git a/App.config b/GUI/App.config
similarity index 97%
rename from App.config
rename to GUI/App.config
index 8da65c22..0e0790bc 100644
--- a/App.config
+++ b/GUI/App.config
@@ -1,96 +1,96 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
-
-
- NaN
-
-
- NaN
-
-
- 1024
-
-
- 600
-
-
- Normal
-
-
- 265
-
-
- 75
-
-
- 75
-
-
- Name
-
-
- Ascending
-
-
- 448
-
-
- True
-
-
- True
-
-
-
-
-
- 65001
-
-
-
-
-
-
-
-
-
-
-
- Visible
-
-
- Visible
-
-
- Visible
-
-
- PNG
-
-
- False
-
-
- True
-
-
- False
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+
+
+ NaN
+
+
+ NaN
+
+
+ 1024
+
+
+ 600
+
+
+ Normal
+
+
+ 265
+
+
+ 75
+
+
+ 75
+
+
+ Name
+
+
+ Ascending
+
+
+ 448
+
+
+ True
+
+
+ True
+
+
+
+
+
+ 65001
+
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+ Visible
+
+
+ Visible
+
+
+ PNG
+
+
+ False
+
+
+ True
+
+
+ False
+
+
+
+
+
+
+
diff --git a/App.xaml b/GUI/App.xaml
similarity index 98%
rename from App.xaml
rename to GUI/App.xaml
index b2838dcb..378f6ff0 100644
--- a/App.xaml
+++ b/GUI/App.xaml
@@ -1,9 +1,9 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/App.xaml.cs b/GUI/App.xaml.cs
similarity index 97%
rename from App.xaml.cs
rename to GUI/App.xaml.cs
index 3979f81a..76072981 100644
--- a/App.xaml.cs
+++ b/GUI/App.xaml.cs
@@ -1,112 +1,112 @@
-// Game Resource Browser
-//
-// Copyright (C) 2014-2015 by morkt
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Linq;
-using System.Windows;
-using System.Diagnostics;
-using GARbro.GUI.Properties;
-using GameRes;
-using GameRes.Compression;
-
-namespace GARbro.GUI
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- const StringComparison StringIgnoreCase = StringComparison.OrdinalIgnoreCase;
-
- public static string Name { get { return "GARbro"; } }
-
- ///
- /// Initial browsing directory.
- ///
- public string InitPath { get; private set; }
-
- void ApplicationStartup (object sender, StartupEventArgs e)
- {
- string exe_dir = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location);
-#if DEBUG
- Trace.Listeners.Add (new TextWriterTraceListener (Path.Combine (exe_dir, "trace.log")));
- Trace.AutoFlush = true;
-#endif
- Trace.WriteLine ("ApplicationStartup --------------------------------", "GARbro.GUI.App");
- this.DispatcherUnhandledException += (s, args) =>
- {
- Trace.WriteLine (string.Format ("Unhandled exception caught: {0}", args.Exception.Message),
- "GARbro.GUI.App");
- Trace.WriteLine (args.Exception.StackTrace, "Stack trace");
- };
- try
- {
- if (0 != e.Args.Length)
- {
- InitPath = Path.GetFullPath (e.Args[0]);
- }
- else if (!string.IsNullOrEmpty (Settings.Default.appLastDirectory))
- {
- string last_dir = Settings.Default.appLastDirectory;
- Directory.SetCurrentDirectory (last_dir);
- InitPath = last_dir;
- }
- }
- catch { }
-
- if (string.IsNullOrEmpty (InitPath))
- InitPath = Directory.GetCurrentDirectory();
-
- string scheme_file = Path.Combine (exe_dir, "Formats.dat");
- try
- {
- using (var file = File.OpenRead (scheme_file))
- DeserializeScheme (file);
- }
- catch (Exception X)
- {
- Trace.WriteLine (X.Message, "scheme deserialization failed");
- }
- }
-
- void ApplicationExit (object sender, ExitEventArgs e)
- {
- Settings.Default.Save();
- }
-
- void DeserializeScheme (Stream file)
- {
- using (var reader = new BinaryReader (file))
- {
- var scheme_id = FormatCatalog.Instance.SchemeID;
- var header = reader.ReadChars (scheme_id.Length);
- if (!header.SequenceEqual (scheme_id))
- throw new FormatException ("Invalid serialization file");
- int version = reader.ReadInt32();
- using (var zs = new ZLibStream (file, CompressionMode.Decompress))
- FormatCatalog.Instance.DeserializeScheme (zs);
- }
- }
- }
-}
+// Game Resource Browser
+//
+// Copyright (C) 2014-2015 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Diagnostics;
+using GARbro.GUI.Properties;
+using GameRes;
+using GameRes.Compression;
+
+namespace GARbro.GUI
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ const StringComparison StringIgnoreCase = StringComparison.OrdinalIgnoreCase;
+
+ public static string Name { get { return "GARbro"; } }
+
+ ///
+ /// Initial browsing directory.
+ ///
+ public string InitPath { get; private set; }
+
+ void ApplicationStartup (object sender, StartupEventArgs e)
+ {
+ string exe_dir = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location);
+#if DEBUG
+ Trace.Listeners.Add (new TextWriterTraceListener (Path.Combine (exe_dir, "trace.log")));
+ Trace.AutoFlush = true;
+#endif
+ Trace.WriteLine ("ApplicationStartup --------------------------------", "GARbro.GUI.App");
+ this.DispatcherUnhandledException += (s, args) =>
+ {
+ Trace.WriteLine (string.Format ("Unhandled exception caught: {0}", args.Exception.Message),
+ "GARbro.GUI.App");
+ Trace.WriteLine (args.Exception.StackTrace, "Stack trace");
+ };
+ try
+ {
+ if (0 != e.Args.Length)
+ {
+ InitPath = Path.GetFullPath (e.Args[0]);
+ }
+ else if (!string.IsNullOrEmpty (Settings.Default.appLastDirectory))
+ {
+ string last_dir = Settings.Default.appLastDirectory;
+ Directory.SetCurrentDirectory (last_dir);
+ InitPath = last_dir;
+ }
+ }
+ catch { }
+
+ if (string.IsNullOrEmpty (InitPath))
+ InitPath = Directory.GetCurrentDirectory();
+
+ string scheme_file = Path.Combine (exe_dir, "Formats.dat");
+ try
+ {
+ using (var file = File.OpenRead (scheme_file))
+ DeserializeScheme (file);
+ }
+ catch (Exception X)
+ {
+ Trace.WriteLine (X.Message, "scheme deserialization failed");
+ }
+ }
+
+ void ApplicationExit (object sender, ExitEventArgs e)
+ {
+ Settings.Default.Save();
+ }
+
+ void DeserializeScheme (Stream file)
+ {
+ using (var reader = new BinaryReader (file))
+ {
+ var scheme_id = FormatCatalog.Instance.SchemeID;
+ var header = reader.ReadChars (scheme_id.Length);
+ if (!header.SequenceEqual (scheme_id))
+ throw new FormatException ("Invalid serialization file");
+ int version = reader.ReadInt32();
+ using (var zs = new ZLibStream (file, CompressionMode.Decompress))
+ FormatCatalog.Instance.DeserializeScheme (zs);
+ }
+ }
+ }
+}
diff --git a/ArcParameters.xaml b/GUI/ArcParameters.xaml
similarity index 98%
rename from ArcParameters.xaml
rename to GUI/ArcParameters.xaml
index 7a0d51b5..9cbad354 100644
--- a/ArcParameters.xaml
+++ b/GUI/ArcParameters.xaml
@@ -1,24 +1,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ArcParameters.xaml.cs b/GUI/ArcParameters.xaml.cs
similarity index 96%
rename from ArcParameters.xaml.cs
rename to GUI/ArcParameters.xaml.cs
index 53982627..97fd8e56 100644
--- a/ArcParameters.xaml.cs
+++ b/GUI/ArcParameters.xaml.cs
@@ -1,22 +1,22 @@
-using System.Windows;
-
-namespace GARbro.GUI
-{
- ///
- /// Interaction logic for ArcParameters.xaml
- ///
- public partial class ArcParametersDialog : Window
- {
- public ArcParametersDialog (UIElement widget, string notice)
- {
- InitializeComponent();
- this.WidgetPane.Children.Add (widget);
- this.Notice.Text = notice;
- }
-
- private void Button_Click (object sender, RoutedEventArgs e)
- {
- DialogResult = true;
- }
- }
-}
+using System.Windows;
+
+namespace GARbro.GUI
+{
+ ///
+ /// Interaction logic for ArcParameters.xaml
+ ///
+ public partial class ArcParametersDialog : Window
+ {
+ public ArcParametersDialog (UIElement widget, string notice)
+ {
+ InitializeComponent();
+ this.WidgetPane.Children.Add (widget);
+ this.Notice.Text = notice;
+ }
+
+ private void Button_Click (object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ }
+ }
+}
diff --git a/AutoComplete.cs b/GUI/AutoComplete.cs
similarity index 100%
rename from AutoComplete.cs
rename to GUI/AutoComplete.cs
diff --git a/ConvertMedia.xaml b/GUI/ConvertMedia.xaml
similarity index 100%
rename from ConvertMedia.xaml
rename to GUI/ConvertMedia.xaml
diff --git a/ConvertMedia.xaml.cs b/GUI/ConvertMedia.xaml.cs
similarity index 100%
rename from ConvertMedia.xaml.cs
rename to GUI/ConvertMedia.xaml.cs
diff --git a/CreateArchive.xaml b/GUI/CreateArchive.xaml
similarity index 100%
rename from CreateArchive.xaml
rename to GUI/CreateArchive.xaml
diff --git a/CreateArchive.xaml.cs b/GUI/CreateArchive.xaml.cs
similarity index 100%
rename from CreateArchive.xaml.cs
rename to GUI/CreateArchive.xaml.cs
diff --git a/DragScroll.cs b/GUI/DragScroll.cs
similarity index 97%
rename from DragScroll.cs
rename to GUI/DragScroll.cs
index 0259af13..252045ca 100644
--- a/DragScroll.cs
+++ b/GUI/DragScroll.cs
@@ -1,166 +1,166 @@
-//! \file DragScroll.cs
-//! \date Sun Jul 06 10:47:20 2014
-//! \brief Scroll control contents by dragging.
-//
-// http://matthamilton.net/touchscrolling-for-scrollviewer
-
-using System.Collections.Generic;
-using System.Windows.Controls;
-using System.Windows;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Diagnostics;
-
-namespace GARbro.GUI
-{
- public class TouchScrolling : DependencyObject
- {
- public static bool GetIsEnabled(DependencyObject obj)
- {
- return (bool)obj.GetValue(IsEnabledProperty);
- }
-
- public static void SetIsEnabled(DependencyObject obj, bool value)
- {
- obj.SetValue(IsEnabledProperty, value);
- }
-
- public bool IsEnabled
- {
- get { return (bool)GetValue(IsEnabledProperty); }
- set { SetValue(IsEnabledProperty, value); }
- }
-
- public static readonly DependencyProperty IsEnabledProperty =
- DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(TouchScrolling), new UIPropertyMetadata(false, IsEnabledChanged));
-
- static Dictionary