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/MainWindow.xaml.cs b/GUI/MainWindow.xaml.cs similarity index 97% rename from MainWindow.xaml.cs rename to GUI/MainWindow.xaml.cs index 63203fba..e650699e 100644 --- a/MainWindow.xaml.cs +++ b/GUI/MainWindow.xaml.cs @@ -1,1382 +1,1382 @@ -// 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.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Threading; -using Microsoft.VisualBasic.FileIO; -using GARbro.GUI.Properties; -using GARbro.GUI.Strings; -using GameRes; -using Rnd.Windows; -using Microsoft.Win32; -using NAudio.Wave; - -namespace GARbro.GUI -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - private App m_app; - - const StringComparison StringIgnoreCase = StringComparison.CurrentCultureIgnoreCase; - - public MainWindow() - { - m_app = Application.Current as App; - InitializeComponent(); - if (this.Top < 0) this.Top = 0; - if (this.Left < 0) this.Left = 0; - InitDirectoryChangesWatcher(); - InitPreviewPane(); - - if (null == Settings.Default.appRecentFiles) - Settings.Default.appRecentFiles = new StringCollection(); - m_recent_files = new LinkedList (Settings.Default.appRecentFiles.Cast().Take (MaxRecentFiles)); - RecentFilesMenu.ItemsSource = RecentFiles; - - FormatCatalog.Instance.ParametersRequest += (s, e) => Dispatcher.Invoke (() => OnParametersRequest (s, e)); - - CurrentDirectory.SizeChanged += (s, e) => { - if (e.WidthChanged) - { - pathLine.MinWidth = e.NewSize.Width-79; - this.MinWidth = e.NewSize.Width+79; - } - }; - pathLine.EnterKeyDown += acb_OnKeyDown; - } - - void WindowLoaded (object sender, RoutedEventArgs e) - { - lv_SetSortMode (Settings.Default.lvSortColumn, Settings.Default.lvSortDirection); - Dispatcher.InvokeAsync (WindowRendered, DispatcherPriority.ContextIdle); - ImageData.SetDefaultDpi (Desktop.DpiX, Desktop.DpiY); - } - - void WindowRendered () - { - DirectoryViewModel vm = null; - try - { - vm = GetNewViewModel (m_app.InitPath); - } - catch (Exception X) - { - PopupError (X.Message, guiStrings.MsgErrorOpening); - } - if (null == vm) - { - vm = CreateViewModel (Directory.GetCurrentDirectory(), true); - } - ViewModel = vm; - lv_SelectItem (0); - if (!vm.IsArchive) - SetStatusText (guiStrings.MsgReady); - } - - void WindowKeyDown (object sender, KeyEventArgs e) - { - if (MainMenuBar.Visibility != Visibility.Visible && Key.System == e.Key) - { - MainMenuBar.Visibility = Visibility.Visible; - MainMenuBar.IsKeyboardFocusWithinChanged += HideMenuBar; - } - } - - void HideMenuBar (object sender, DependencyPropertyChangedEventArgs e) - { - if (!MainMenuBar.IsKeyboardFocusWithin) - { - MainMenuBar.IsKeyboardFocusWithinChanged -= HideMenuBar; - MainMenuBar.Visibility = Visibility.Collapsed; - } - } - - /// - /// Save settings when main window is about to close - /// - protected override void OnClosing (CancelEventArgs e) - { - try - { - SaveSettings(); - AudioDevice = null; - CurrentAudio = null; - } - catch (Exception X) - { - Trace.WriteLine (X.Message, "[OnClosing]"); - Trace.WriteLine (X.StackTrace, "Stack trace"); - } - base.OnClosing (e); - } - - /// - /// Manually save settings that are not automatically saved by bindings. - /// - private void SaveSettings() - { - if (null != m_lvSortByColumn) - { - Settings.Default.lvSortColumn = SortMode; - Settings.Default.lvSortDirection = m_lvSortDirection; - } - else - Settings.Default.lvSortColumn = ""; - - Settings.Default.appRecentFiles.Clear(); - foreach (var file in m_recent_files) - Settings.Default.appRecentFiles.Add (file); - - string cwd = CurrentPath; - if (!string.IsNullOrEmpty (cwd)) - { - if (ViewModel.IsArchive) - cwd = Path.GetDirectoryName (cwd); - } - else - cwd = Directory.GetCurrentDirectory(); - Settings.Default.appLastDirectory = cwd; - } - - /// - /// Set status line text. Could be called from any thread. - /// - public void SetStatusText (string text) - { - Dispatcher.Invoke (() => { appStatusText.Text = text; }); - } - - public void SetResourceText (string text) - { - Dispatcher.Invoke (() => { appResourceText.Text = text; }); - } - - /// - /// Popup error message box. Could be called from any thread. - /// - public void PopupError (string message, string title) - { - Dispatcher.Invoke (() => MessageBox.Show (this, message, title, MessageBoxButton.OK, MessageBoxImage.Error)); - } - - const int MaxRecentFiles = 9; - LinkedList m_recent_files; - - // Item1 = file name, Item2 = menu item string - public IEnumerable> RecentFiles - { - get - { - int i = 1; - return m_recent_files.Select (f => Tuple.Create (f, string.Format ("_{0} {1}", i++, f))); - } - } - - void PushRecentFile (string file) - { - var node = m_recent_files.Find (file); - if (node != null && node == m_recent_files.First) - return; - if (null == node) - { - while (MaxRecentFiles <= m_recent_files.Count) - m_recent_files.RemoveLast(); - m_recent_files.AddFirst (file); - } - else - { - m_recent_files.Remove (node); - m_recent_files.AddFirst (node); - } - RecentFilesMenu.ItemsSource = RecentFiles; - } - - /// - /// Set data context of the ListView. - /// - - public DirectoryViewModel ViewModel - { - get - { - var source = CurrentDirectory.ItemsSource as CollectionView; - if (null == source) - return null; - return source.SourceCollection as DirectoryViewModel; - } - private set - { - StopWatchDirectoryChanges(); - var cvs = this.Resources["ListViewSource"] as CollectionViewSource; - cvs.Source = value; - - // update path textbox - var path_component = value.Path.Last(); - if (string.IsNullOrEmpty (path_component) && value.Path.Count > 1) - path_component = value.Path[value.Path.Count-2]; - pathLine.Text = path_component; - - if (value.IsArchive && value.Path.Count <= 2) - PushRecentFile (value.Path.First()); - - lv_Sort (SortMode, m_lvSortDirection); - if (!value.IsArchive && !string.IsNullOrEmpty (value.Path.First())) - { - WatchDirectoryChanges (value.Path.First()); - } - CurrentDirectory.UpdateLayout(); - } - } - - /// - /// Save current position and update view model. - /// - void PushViewModel (DirectoryViewModel vm) - { - SaveCurrentPosition(); - ViewModel = vm; - } - - DirectoryViewModel GetNewViewModel (string path) - { - if (!string.IsNullOrEmpty (path)) - { - if (!VFS.IsVirtual) - path = Path.GetFullPath (path); - var entry = VFS.FindFile (path); - if (!(entry is SubDirEntry)) - SetBusyState(); - VFS.ChDir (entry); - } - return new DirectoryViewModel (VFS.FullPath, VFS.GetFiles(), VFS.IsVirtual); - } - - private bool m_busy_state = false; - - public void SetBusyState() - { - m_busy_state = true; - Mouse.OverrideCursor = Cursors.Wait; - Dispatcher.InvokeAsync (() => { - m_busy_state = false; - Mouse.OverrideCursor = null; - }, DispatcherPriority.ApplicationIdle); - } - - /// - /// Create view model corresponding to . Returns null on error. - /// - DirectoryViewModel TryCreateViewModel (string path) - { - try - { - return GetNewViewModel (path); - } - catch (Exception X) - { - SetStatusText (string.Format ("{0}: {1}", Path.GetFileName (path), X.Message)); - return null; - } - } - - /// - /// Create view model corresponding to or empty view model if there was - /// an error accessing path. - /// - DirectoryViewModel CreateViewModel (string path, bool suppress_warning = false) - { - try - { - return GetNewViewModel (path); - } - catch (Exception X) - { - if (!suppress_warning) - PopupError (X.Message, guiStrings.MsgErrorOpening); - return new DirectoryViewModel (new string[] { "" }, new Entry[0], false); - } - } - - #region Refresh view on filesystem changes - - private FileSystemWatcher m_watcher = new FileSystemWatcher(); - - void InitDirectoryChangesWatcher () - { - m_watcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName; - m_watcher.Changed += InvokeRefreshView; - m_watcher.Created += InvokeRefreshView; - m_watcher.Deleted += InvokeRefreshView; - m_watcher.Renamed += InvokeRefreshView; - } - - void WatchDirectoryChanges (string path) - { - m_watcher.Path = path; - m_watcher.EnableRaisingEvents = true; - } - - public void StopWatchDirectoryChanges() - { - m_watcher.EnableRaisingEvents = false; - } - - public void ResumeWatchDirectoryChanges () - { - m_watcher.EnableRaisingEvents = !ViewModel.IsArchive; - } - - private void InvokeRefreshView (object source, FileSystemEventArgs e) - { - var watcher = source as FileSystemWatcher; - var vm = ViewModel; - if (!vm.IsArchive && vm.Path.First() == watcher.Path) - { - watcher.EnableRaisingEvents = false; - Dispatcher.Invoke (RefreshView); - } - } - #endregion - - /// - /// Select specified item within CurrentDirectory and bring it into a view. - /// - - void lv_SelectItem (EntryViewModel item) - { - if (item != null) - { - CurrentDirectory.SelectedItem = item; - CurrentDirectory.ScrollIntoView (item); - var lvi = (ListViewItem)CurrentDirectory.ItemContainerGenerator.ContainerFromItem (item); - if (lvi != null) - lvi.Focus(); - } - } - - void lv_SelectItem (int index) - { - CurrentDirectory.SelectedIndex = index; - CurrentDirectory.ScrollIntoView (CurrentDirectory.SelectedItem); - var lvi = (ListViewItem)CurrentDirectory.ItemContainerGenerator.ContainerFromIndex (index); - if (lvi != null) - lvi.Focus(); - } - - void lv_SelectItem (string name) - { - if (!string.IsNullOrEmpty (name)) - lv_SelectItem (ViewModel.Find (name)); - } - - private void lv_Focus () - { - if (CurrentDirectory.SelectedIndex != -1) - { - var item = CurrentDirectory.SelectedItem; - var lvi = CurrentDirectory.ItemContainerGenerator.ContainerFromItem (item) as ListViewItem; - if (lvi != null) - { - lvi.Focus(); - return; - } - } - CurrentDirectory.Focus(); - } - - void lvi_Selected (object sender, RoutedEventArgs args) - { - var lvi = sender as ListViewItem; - if (lvi == null) - return; - var entry = lvi.Content as EntryViewModel; - if (entry == null) - return; - PreviewEntry (entry.Source); - } - - EntryViewModel m_last_selected = null; - - void lv_SelectionChanged (object sender, SelectionChangedEventArgs args) - { - var lv = sender as ListView; - if (null == lv) - return; - var item = lv.SelectedItem as EntryViewModel; - if (item != null && m_last_selected != item) - { - m_last_selected = item; - PreviewEntry (item.Source); - } - } - - void lvi_DoubleClick (object sender, MouseButtonEventArgs args) - { - var lvi = sender as ListViewItem; - if (Commands.OpenItem.CanExecute (null, lvi)) - { - Commands.OpenItem.Execute (null, lvi); - args.Handled = true; - } - } - - /// - /// Get currently selected item from ListView widget. - /// - private ListViewItem lv_GetCurrentContainer () - { - int current = CurrentDirectory.SelectedIndex; - if (-1 == current) - return null; - - return CurrentDirectory.ItemContainerGenerator.ContainerFromIndex (current) as ListViewItem; - } - - GridViewColumnHeader m_lvSortByColumn = null; - ListSortDirection m_lvSortDirection = ListSortDirection.Ascending; - - public string SortMode - { - get { return GetValue (SortModeProperty) as string; } - private set { SetValue (SortModeProperty, value); } - } - - public static readonly DependencyProperty SortModeProperty = - DependencyProperty.RegisterAttached ("SortMode", typeof(string), typeof(MainWindow), new UIPropertyMetadata()); - - void lv_SetSortMode (string sortBy, ListSortDirection direction) - { - m_lvSortByColumn = null; - GridView view = CurrentDirectory.View as GridView; - foreach (var column in view.Columns) - { - var header = column.Header as GridViewColumnHeader; - if (null != header && !string.IsNullOrEmpty (sortBy) && sortBy.Equals (header.Tag)) - { - if (ListSortDirection.Ascending == direction) - column.HeaderTemplate = Resources["SortArrowUp"] as DataTemplate; - else - column.HeaderTemplate = Resources["SortArrowDown"] as DataTemplate; - m_lvSortByColumn = header; - m_lvSortDirection = direction; - } - else - { - column.HeaderTemplate = Resources["SortArrowNone"] as DataTemplate; - } - } - SortMode = sortBy; - } - - private void lv_Sort (string sortBy, ListSortDirection direction) - { - var dataView = CollectionViewSource.GetDefaultView (CurrentDirectory.ItemsSource) as ListCollectionView; - dataView.CustomSort = new FileSystemComparer (sortBy, direction); - } - - /// - /// Sort Listview by columns - /// - void lv_ColumnHeaderClicked (object sender, RoutedEventArgs e) - { - var headerClicked = e.OriginalSource as GridViewColumnHeader; - - if (null == headerClicked) - return; - if (headerClicked.Role == GridViewColumnHeaderRole.Padding) - return; - - ListSortDirection direction; - if (headerClicked != m_lvSortByColumn) - direction = ListSortDirection.Ascending; - else if (m_lvSortDirection == ListSortDirection.Ascending) - direction = ListSortDirection.Descending; - else - direction = ListSortDirection.Ascending; - - string sortBy = headerClicked.Tag.ToString(); - lv_Sort (sortBy, direction); - SortMode = sortBy; - - // Remove arrow from previously sorted header - if (m_lvSortByColumn != null && m_lvSortByColumn != headerClicked) - { - m_lvSortByColumn.Column.HeaderTemplate = Resources["SortArrowNone"] as DataTemplate; - } - - if (ListSortDirection.Ascending == direction) - { - headerClicked.Column.HeaderTemplate = Resources["SortArrowUp"] as DataTemplate; - } - else - { - headerClicked.Column.HeaderTemplate = Resources["SortArrowDown"] as DataTemplate; - } - m_lvSortByColumn = headerClicked; - m_lvSortDirection = direction; - } - - /// - /// Handle "Sort By" commands. - /// - - private void SortByExec (object sender, ExecutedRoutedEventArgs e) - { - string sort_by = e.Parameter as string; - lv_Sort (sort_by, ListSortDirection.Ascending); - lv_SetSortMode (sort_by, ListSortDirection.Ascending); - } - - /// - /// Handle "Set file type" commands. - /// - private void SetFileTypeExec (object sender, ExecutedRoutedEventArgs e) - { - var selected = CurrentDirectory.SelectedItems.Cast().Where (x => !x.IsDirectory); - if (!selected.Any()) - return; - string type = e.Parameter as string; - foreach (var entry in selected) - { - entry.Type = type; - } - } - - /// - /// Event handler for keys pressed in the directory view pane - /// - - private void lv_TextInput (object sender, TextCompositionEventArgs e) - { - LookupItem (e.Text, e.Timestamp); - e.Handled = true; - } - - private void lv_KeyDown (object sender, KeyEventArgs e) - { - if (e.IsDown && Key.Space == e.Key && LookupActive) - { - LookupItem (" ", e.Timestamp); - e.Handled = true; - } - } - - class InputData - { - public int LastTime = 0; - public StringBuilder Phrase = new StringBuilder(); - public bool Mismatch = false; - - public bool LookupActive - { - get { return Phrase.Length > 0 && Environment.TickCount - LastTime < TextLookupTimeout; } - } - - public void Reset () - { - Phrase.Clear (); - Mismatch = false; - } - } - - const int TextLookupTimeout = 1000; // milliseconds - - InputData m_current_input = new InputData(); - - public bool LookupActive { get { return m_current_input.LookupActive; } } - - /// - /// Lookup item in listview pane by first letters of name. - /// - - private void LookupItem (string key, int timestamp) - { - if (string.IsNullOrEmpty (key)) - return; - var source = CurrentDirectory.ItemsSource as CollectionView; - if (source == null) - return; - - if (timestamp - m_current_input.LastTime > TextLookupTimeout) - { - m_current_input.Reset(); - } - m_current_input.LastTime = timestamp; - if (m_current_input.Mismatch) - return; - - if (!(1 == m_current_input.Phrase.Length && m_current_input.Phrase[0] == key[0])) - { - m_current_input.Phrase.Append (key); - } - int start_index = CurrentDirectory.SelectedIndex; - if (1 == m_current_input.Phrase.Length) - { - // lookup starting from the next item - if (start_index != -1 && start_index+1 < source.Count) - ++start_index; - } - var items = source.Cast(); - if (start_index > 0) - { - items = items.Skip (start_index).Concat (items.Take (start_index)); - } - string input = m_current_input.Phrase.ToString(); - var matched = items.Where (e => e.Name.StartsWith (input, StringIgnoreCase)).FirstOrDefault(); - if (null != matched) - lv_SelectItem (matched); - else - m_current_input.Mismatch = true; - } - - static readonly Regex FullpathRe = new Regex (@"^(?:[a-z]:|[\\/])", RegexOptions.IgnoreCase); - - private void acb_OnKeyDown (object sender, KeyEventArgs e) - { - if (e.Key != Key.Return) - return; - string path = (sender as AutoCompleteBox).Text; - if (string.IsNullOrEmpty (path)) - return; - if (FullpathRe.IsMatch (path)) - { - OpenFile (path); - return; - } - try - { - PushViewModel (GetNewViewModel (path)); - lv_Focus(); - } - catch (Exception X) - { - PopupError (X.Message, guiStrings.MsgErrorOpening); - } - } - - #region Navigation history implementation - - internal string CurrentPath { get { return ViewModel.Path.First(); } } - - HistoryStack m_history = new HistoryStack(); - - public DirectoryPosition GetCurrentPosition () - { - var evm = CurrentDirectory.SelectedItem as EntryViewModel; - return new DirectoryPosition (ViewModel, evm); - } - - public bool SetCurrentPosition (DirectoryPosition pos) - { - try - { - VFS.FullPath = pos.Path; - var vm = TryCreateViewModel (pos.Path.Last()); - if (null == vm) - return false; - ViewModel = vm; - if (null != pos.Item) - lv_SelectItem (pos.Item); - return true; - } - catch (Exception X) - { - // if VFS.FullPath throws an exception, ViewModel becomes inconsistent at this point - // and should be rebuilt - ViewModel = CreateViewModel (VFS.Top.CurrentDirectory, true); - SetStatusText (X.Message); - return false; - } - } - - public void SaveCurrentPosition () - { - m_history.Push (GetCurrentPosition()); - } - - public void ChangePosition (DirectoryPosition new_pos) - { - var current = GetCurrentPosition(); - if (!current.Path.SequenceEqual (new_pos.Path)) - SaveCurrentPosition(); - SetCurrentPosition (new_pos); - } - - private void GoBackExec (object sender, ExecutedRoutedEventArgs e) - { - DirectoryPosition current = m_history.Undo (GetCurrentPosition()); - if (current != null) - SetCurrentPosition (current); - } - - private void GoForwardExec (object sender, ExecutedRoutedEventArgs e) - { - DirectoryPosition current = m_history.Redo (GetCurrentPosition()); - if (current != null) - SetCurrentPosition (current); - } - - private void CanExecuteGoBack (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = m_history.CanUndo(); - } - - private void CanExecuteGoForward (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = m_history.CanRedo(); - } - #endregion - - private void OpenFileExec (object control, ExecutedRoutedEventArgs e) - { - var dlg = new OpenFileDialog { - CheckFileExists = true, - CheckPathExists = true, - Multiselect = false, - Title = guiStrings.TextChooseArchive, - }; - if (!dlg.ShowDialog (this).Value) - return; - OpenFile (dlg.FileName); - } - - private void OpenFile (string filename) - { - if (filename == CurrentPath || string.IsNullOrEmpty (filename)) - return; - try - { - if (File.Exists (filename)) - VFS.FullPath = new string[] { filename, "" }; - else - VFS.FullPath = new string[] { filename }; - var vm = new DirectoryViewModel (VFS.FullPath, VFS.GetFiles(), VFS.IsVirtual); - PushViewModel (vm); - if (null != VFS.CurrentArchive) - SetStatusText (VFS.CurrentArchive.Description); - lv_SelectItem (0); - } - catch (OperationCanceledException X) - { - SetStatusText (X.Message); - } - catch (Exception X) - { - PopupError (string.Format("{0}:\n{1}", filename, X.Message), guiStrings.MsgErrorOpening); - } - } - - private void OpenRecentExec (object control, ExecutedRoutedEventArgs e) - { - string filename = e.Parameter as string; - if (string.IsNullOrEmpty (filename)) - return; - OpenFile (filename); - } - - /// - /// Open file/directory. - /// - private void OpenItemExec (object control, ExecutedRoutedEventArgs e) - { - EntryViewModel entry = null; - var lvi = e.OriginalSource as ListViewItem; - if (lvi != null) - entry = lvi.Content as EntryViewModel; - if (null == entry) - entry = CurrentDirectory.SelectedItem as EntryViewModel; - if (null == entry) - return; - if ("audio" == entry.Type) - { - PlayFile (entry.Source); - return; - } - OpenDirectoryEntry (ViewModel, entry); - } - - private void OpenDirectoryEntry (DirectoryViewModel vm, EntryViewModel entry) - { - string old_dir = null == vm ? "" : vm.Path.Last(); - string new_dir = entry.Source.Name; - if (".." == new_dir) - { - if (null != vm && !vm.IsArchive) - new_dir = Path.Combine (old_dir, entry.Name); - if (vm.Path.Count > 1 && string.IsNullOrEmpty (old_dir)) - old_dir = vm.Path[vm.Path.Count-2]; - } - Trace.WriteLine (new_dir, "OpenDirectoryEntry"); - int old_fs_count = VFS.Count; - vm = TryCreateViewModel (new_dir); - if (null == vm) - { - if (VFS.Count == old_fs_count) - return; - vm = new DirectoryViewModel (VFS.FullPath, new Entry[0], VFS.IsVirtual); - PushViewModel (vm); - } - else - { - PushViewModel (vm); - if (VFS.Count > old_fs_count && null != VFS.CurrentArchive) - SetStatusText (string.Format ("{0}: {1}", VFS.CurrentArchive.Description, - Localization.Format ("MsgFiles", VFS.CurrentArchive.Dir.Count()))); - else - SetStatusText (""); - } - if (".." == entry.Name) - lv_SelectItem (Path.GetFileName (old_dir)); - else - lv_SelectItem (0); - } - - WaveOutEvent m_audio_device; - WaveOutEvent AudioDevice - { - get { return m_audio_device; } - set - { - var old_value = m_audio_device; - m_audio_device = value; - if (old_value != null) - old_value.Dispose(); - } - } - - WaveStream m_audio_input; - WaveStream CurrentAudio - { - get { return m_audio_input; } - set - { - var old_value = m_audio_input; - m_audio_input = value; - if (old_value != null) - old_value.Dispose(); - } - } - - private void PlayFile (Entry entry) - { - SoundInput sound = null; - try - { - SetBusyState(); - using (var input = VFS.OpenStream (entry)) - { - FormatCatalog.Instance.LastError = null; - sound = AudioFormat.Read (input); - if (null == sound) - { - if (null != FormatCatalog.Instance.LastError) - throw FormatCatalog.Instance.LastError; - return; - } - - if (AudioDevice != null) - { - AudioDevice.PlaybackStopped -= OnPlaybackStopped; - AudioDevice = null; - } - CurrentAudio = new WaveStreamImpl (sound); - AudioDevice = new WaveOutEvent(); - AudioDevice.Init (CurrentAudio); - AudioDevice.PlaybackStopped += OnPlaybackStopped; - AudioDevice.Play(); - var fmt = CurrentAudio.WaveFormat; - SetResourceText (string.Format ("Playing {0} / {3} / {2}bps / {1}Hz", entry.Name, - fmt.SampleRate, sound.SourceBitrate / 1000, - CurrentAudio.TotalTime.ToString ("m':'ss"))); - } - } - catch (Exception X) - { - SetStatusText (X.Message); - if (null != sound) - sound.Dispose(); - } - } - - private void OnPlaybackStopped (object sender, StoppedEventArgs e) - { - try - { - SetResourceText (""); - CurrentAudio = null; - } - catch (Exception X) - { - Trace.WriteLine (X.Message, "[OnPlaybackStopped]"); - } - } - - /// - /// Launch specified file. - /// - private void SystemOpen (string file) - { - try - { - Process.Start (file); - } - catch (Exception X) - { - SetStatusText (X.Message); - } - } - - /// - /// Refresh current view. - /// - private void RefreshExec (object sender, ExecutedRoutedEventArgs e) - { - RefreshView(); - } - - public void RefreshView () - { - VFS.Flush(); - var pos = GetCurrentPosition(); - SetCurrentPosition (pos); - } - - /// - /// Open current file in Explorer. - /// - - private void ExploreItemExec (object sender, ExecutedRoutedEventArgs e) - { - var entry = CurrentDirectory.SelectedItem as EntryViewModel; - if (entry != null && !ViewModel.IsArchive) - { - try - { - string name = Path.Combine (CurrentPath, entry.Name); - Process.Start ("explorer.exe", "/select,"+name); - } - catch (Exception X) - { - // ignore - Trace.WriteLine (X.Message, "explorer.exe"); - } - } - } - - /// - /// Delete item from both media library and disk drive. - /// - private void DeleteItemExec (object sender, ExecutedRoutedEventArgs e) - { - var items = CurrentDirectory.SelectedItems.Cast().Where (f => !f.IsDirectory); - if (!items.Any()) - return; - - this.IsEnabled = false; - try - { - VFS.Flush(); - ResetPreviewPane(); - if (!items.Skip (1).Any()) // items.Count() == 1 - { - string item_name = Path.Combine (CurrentPath, items.First().Name); - Trace.WriteLine (item_name, "DeleteItemExec"); - FileSystem.DeleteFile (item_name, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); - DeleteItem (lv_GetCurrentContainer()); - SetStatusText (string.Format(guiStrings.MsgDeletedItem, item_name)); - } - else - { - int count = 0; - StopWatchDirectoryChanges (); - try - { - var file_list = items.Select (entry => Path.Combine (CurrentPath, entry.Name)); - GARbro.Shell.File.Delete (file_list); - count = file_list.Count(); - } - catch - { - ResumeWatchDirectoryChanges(); - throw; - } - RefreshView(); - SetStatusText (Localization.Format ("MsgDeletedItems", count)); - } - } - catch (OperationCanceledException) - { - } - catch (Exception X) - { - SetStatusText (X.Message); - } - finally - { - this.IsEnabled = true; - } - } - - /// - /// Delete item at the specified position within ListView, correctly adjusting current - /// position. - /// - private void DeleteItem (ListViewItem item) - { - int i = CurrentDirectory.SelectedIndex; - int next = -1; - if (i+1 < CurrentDirectory.Items.Count) - next = i + 1; - else if (i > 0) - next = i - 1; - - if (next != -1) - CurrentDirectory.SelectedIndex = next; - - var entry = item.Content as EntryViewModel; - if (entry != null) - { - ViewModel.Remove (entry); - } - } - - /// - /// Rename selected item. - /// - private void RenameItemExec(object sender, ExecutedRoutedEventArgs e) - { - RenameElement (lv_GetCurrentContainer()); - } - - /// - /// Rename item contained within specified framework control. - /// - void RenameElement (ListViewItem item) - { - if (item == null) - return; -/* - TextBlock block = FindByName (item, "item_Text") as TextBlock; - TextBox box = FindSibling (block, "item_Input") as TextBox; - - if (block == null || box == null) - return; - - IsRenameActive = true; - - block.Visibility = Visibility.Collapsed; - box.Text = block.Text; - box.Visibility = Visibility.Visible; - box.Select (0, box.Text.Length); - box.Focus(); -*/ - } - - /// - /// Select files matching mask. - /// - void AddSelectionExec (object sender, ExecutedRoutedEventArgs e) - { - try - { - var ext_list = new SortedSet(); - foreach (var entry in ViewModel) - { - var ext = Path.GetExtension (entry.Name).ToLowerInvariant(); - if (!string.IsNullOrEmpty (ext)) - ext_list.Add (ext); - } - var selection = new EnterMaskDialog (ext_list.Select (ext => "*"+ext)); - selection.Owner = this; - var result = selection.ShowDialog(); - if (!result.Value) - return; - if ("*.*" == selection.Mask.Text) - { - CurrentDirectory.SelectAll(); - return; - } - var mask = Regex.Escape (selection.Mask.Text).Replace (@"\*", ".*").Replace (@"\?", "."); - var glob = new Regex ("^"+mask+"$", RegexOptions.IgnoreCase); - var matching = ViewModel.Where (entry => glob.IsMatch (entry.Name)); - if (!matching.Any()) - { - SetStatusText (string.Format (guiStrings.MsgNoMatching, selection.Mask.Text)); - return; - } - int count = 0; - foreach (var item in matching) - { - if (!CurrentDirectory.SelectedItems.Contains (item)) - { - CurrentDirectory.SelectedItems.Add (item); - ++count; - } - } - if (count != 0) - SetStatusText (Localization.Format ("MsgSelectedFiles", count)); - } - catch (Exception X) - { - SetStatusText (X.Message); - } - } - - void SelectAllExec (object sender, ExecutedRoutedEventArgs e) - { - CurrentDirectory.SelectAll(); - } - - void NextItemExec (object sender, ExecutedRoutedEventArgs e) - { - if (LookupActive) - return; - - var index = CurrentDirectory.SelectedIndex + 1; - if (index < CurrentDirectory.Items.Count) - CurrentDirectory.SelectedIndex = index; - } - - /// - /// Handle "Exit" command. - /// - void ExitExec (object sender, ExecutedRoutedEventArgs e) - { - Application.Current.Shutdown(); - } - - private void AboutExec (object sender, ExecutedRoutedEventArgs e) - { - var about = new AboutBox(); - about.Owner = this; - about.ShowDialog(); - } - - private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = true; - } - - private void CanExecuteControlCommand (object sender, CanExecuteRoutedEventArgs e) - { - Control target = e.Source as Control; - e.CanExecute = target != null; - } - - private void CanExecuteOnSelected (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = CurrentDirectory.SelectedIndex != -1; - } - - private void CanExecuteConvertMedia (object sender, CanExecuteRoutedEventArgs e) - { - if (CurrentDirectory.SelectedItems.Count >= 1) - { - e.CanExecute = !ViewModel.IsArchive; - } - } - - private void CanExecuteOnImage (object sender, CanExecuteRoutedEventArgs e) - { - var entry = CurrentDirectory.SelectedItem as EntryViewModel; - e.CanExecute = !ViewModel.IsArchive && entry != null && entry.Type == "image"; - } - - private void CanExecuteInArchive (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = ViewModel.IsArchive && CurrentDirectory.SelectedIndex != -1; - } - - private void CanExecuteCreateArchive (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = !ViewModel.IsArchive && CurrentDirectory.SelectedItems.Count > 0; - } - - private void CanExecuteInDirectory (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = !ViewModel.IsArchive; - } - - private void CanExecuteExtract (object sender, CanExecuteRoutedEventArgs e) - { - if (ViewModel.IsArchive) - { - e.CanExecute = true; - return; - } - else if (CurrentDirectory.SelectedIndex != -1) - { - var entry = CurrentDirectory.SelectedItem as EntryViewModel; - if (entry != null && !entry.IsDirectory) - { - e.CanExecute = true; - return; - } - } - e.CanExecute = false; - } - - private void CanExecuteOnPhysicalFile (object sender, CanExecuteRoutedEventArgs e) - { - if (!ViewModel.IsArchive && CurrentDirectory.SelectedIndex != -1) - { - var entry = CurrentDirectory.SelectedItem as EntryViewModel; - if (entry != null && !entry.IsDirectory) - { - e.CanExecute = true; - return; - } - } - e.CanExecute = false; - } - - private void OnParametersRequest (object sender, ParametersRequestEventArgs e) - { - var format = sender as IResource; - if (null != format) - { - var control = format.GetAccessWidget() as UIElement; - if (null != control) - { - bool busy_state = m_busy_state; - var param_dialog = new ArcParametersDialog (control, e.Notice); - param_dialog.Owner = this; - e.InputResult = param_dialog.ShowDialog() ?? false; - if (e.InputResult) - e.Options = format.GetOptions (control); - if (busy_state) - SetBusyState(); - } - } - } - - private void CanExecuteFitWindow (object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = ImageCanvas.Source != null; - } - - private void HideStatusBarExec (object sender, ExecutedRoutedEventArgs e) - { - ToggleVisibility (AppStatusBar); - } - - private void HideMenuBarExec (object sender, ExecutedRoutedEventArgs e) - { - ToggleVisibility (MainMenuBar); - } - - private void HideToolBarExec (object sender, ExecutedRoutedEventArgs e) - { - ToggleVisibility (MainToolBar); - } - - static void ToggleVisibility (UIElement item) - { - var status = item.Visibility; - if (Visibility.Visible == status) - item.Visibility = Visibility.Collapsed; - else - item.Visibility = Visibility.Visible; - } - } - - public class SortModeToBooleanConverter : IValueConverter - { - public object Convert (object value, Type targetType, object parameter, CultureInfo culture) - { - string actual_mode = value as string; - string check_mode = parameter as string; - if (string.IsNullOrEmpty (check_mode)) - return string.IsNullOrEmpty (actual_mode); - return check_mode.Equals (actual_mode); - } - - public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class BooleanToCollapsedVisibilityConverter : IValueConverter - { - #region IValueConverter Members - - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - //reverse conversion (false=>Visible, true=>collapsed) on any given parameter - bool input = (null == parameter) ? (bool)value : !((bool)value); - return (input) ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - - #endregion - } - - public static class Commands - { - public static readonly RoutedCommand OpenItem = new RoutedCommand(); - public static readonly RoutedCommand OpenFile = new RoutedCommand(); - public static readonly RoutedCommand OpenRecent = new RoutedCommand(); - public static readonly RoutedCommand ExtractItem = new RoutedCommand(); - public static readonly RoutedCommand CreateArchive = new RoutedCommand(); - public static readonly RoutedCommand SortBy = new RoutedCommand(); - public static readonly RoutedCommand Exit = new RoutedCommand(); - public static readonly RoutedCommand About = new RoutedCommand(); - public static readonly RoutedCommand GoBack = new RoutedCommand(); - public static readonly RoutedCommand GoForward = new RoutedCommand(); - public static readonly RoutedCommand DeleteItem = new RoutedCommand(); - public static readonly RoutedCommand RenameItem = new RoutedCommand(); - public static readonly RoutedCommand ExploreItem = new RoutedCommand(); - public static readonly RoutedCommand ConvertMedia = new RoutedCommand(); - public static readonly RoutedCommand Refresh = new RoutedCommand(); - public static readonly RoutedCommand Browse = new RoutedCommand(); - public static readonly RoutedCommand FitWindow = new RoutedCommand(); - public static readonly RoutedCommand HideStatusBar = new RoutedCommand(); - public static readonly RoutedCommand HideMenuBar = new RoutedCommand(); - public static readonly RoutedCommand HideToolBar = new RoutedCommand(); - public static readonly RoutedCommand AddSelection = new RoutedCommand(); - public static readonly RoutedCommand SelectAll = new RoutedCommand(); - public static readonly RoutedCommand SetFileType = new RoutedCommand(); - public static readonly RoutedCommand NextItem = new RoutedCommand(); - } -} +// 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.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Threading; +using Microsoft.VisualBasic.FileIO; +using GARbro.GUI.Properties; +using GARbro.GUI.Strings; +using GameRes; +using Rnd.Windows; +using Microsoft.Win32; +using NAudio.Wave; + +namespace GARbro.GUI +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + private App m_app; + + const StringComparison StringIgnoreCase = StringComparison.CurrentCultureIgnoreCase; + + public MainWindow() + { + m_app = Application.Current as App; + InitializeComponent(); + if (this.Top < 0) this.Top = 0; + if (this.Left < 0) this.Left = 0; + InitDirectoryChangesWatcher(); + InitPreviewPane(); + + if (null == Settings.Default.appRecentFiles) + Settings.Default.appRecentFiles = new StringCollection(); + m_recent_files = new LinkedList (Settings.Default.appRecentFiles.Cast().Take (MaxRecentFiles)); + RecentFilesMenu.ItemsSource = RecentFiles; + + FormatCatalog.Instance.ParametersRequest += (s, e) => Dispatcher.Invoke (() => OnParametersRequest (s, e)); + + CurrentDirectory.SizeChanged += (s, e) => { + if (e.WidthChanged) + { + pathLine.MinWidth = e.NewSize.Width-79; + this.MinWidth = e.NewSize.Width+79; + } + }; + pathLine.EnterKeyDown += acb_OnKeyDown; + } + + void WindowLoaded (object sender, RoutedEventArgs e) + { + lv_SetSortMode (Settings.Default.lvSortColumn, Settings.Default.lvSortDirection); + Dispatcher.InvokeAsync (WindowRendered, DispatcherPriority.ContextIdle); + ImageData.SetDefaultDpi (Desktop.DpiX, Desktop.DpiY); + } + + void WindowRendered () + { + DirectoryViewModel vm = null; + try + { + vm = GetNewViewModel (m_app.InitPath); + } + catch (Exception X) + { + PopupError (X.Message, guiStrings.MsgErrorOpening); + } + if (null == vm) + { + vm = CreateViewModel (Directory.GetCurrentDirectory(), true); + } + ViewModel = vm; + lv_SelectItem (0); + if (!vm.IsArchive) + SetStatusText (guiStrings.MsgReady); + } + + void WindowKeyDown (object sender, KeyEventArgs e) + { + if (MainMenuBar.Visibility != Visibility.Visible && Key.System == e.Key) + { + MainMenuBar.Visibility = Visibility.Visible; + MainMenuBar.IsKeyboardFocusWithinChanged += HideMenuBar; + } + } + + void HideMenuBar (object sender, DependencyPropertyChangedEventArgs e) + { + if (!MainMenuBar.IsKeyboardFocusWithin) + { + MainMenuBar.IsKeyboardFocusWithinChanged -= HideMenuBar; + MainMenuBar.Visibility = Visibility.Collapsed; + } + } + + /// + /// Save settings when main window is about to close + /// + protected override void OnClosing (CancelEventArgs e) + { + try + { + SaveSettings(); + AudioDevice = null; + CurrentAudio = null; + } + catch (Exception X) + { + Trace.WriteLine (X.Message, "[OnClosing]"); + Trace.WriteLine (X.StackTrace, "Stack trace"); + } + base.OnClosing (e); + } + + /// + /// Manually save settings that are not automatically saved by bindings. + /// + private void SaveSettings() + { + if (null != m_lvSortByColumn) + { + Settings.Default.lvSortColumn = SortMode; + Settings.Default.lvSortDirection = m_lvSortDirection; + } + else + Settings.Default.lvSortColumn = ""; + + Settings.Default.appRecentFiles.Clear(); + foreach (var file in m_recent_files) + Settings.Default.appRecentFiles.Add (file); + + string cwd = CurrentPath; + if (!string.IsNullOrEmpty (cwd)) + { + if (ViewModel.IsArchive) + cwd = Path.GetDirectoryName (cwd); + } + else + cwd = Directory.GetCurrentDirectory(); + Settings.Default.appLastDirectory = cwd; + } + + /// + /// Set status line text. Could be called from any thread. + /// + public void SetStatusText (string text) + { + Dispatcher.Invoke (() => { appStatusText.Text = text; }); + } + + public void SetResourceText (string text) + { + Dispatcher.Invoke (() => { appResourceText.Text = text; }); + } + + /// + /// Popup error message box. Could be called from any thread. + /// + public void PopupError (string message, string title) + { + Dispatcher.Invoke (() => MessageBox.Show (this, message, title, MessageBoxButton.OK, MessageBoxImage.Error)); + } + + const int MaxRecentFiles = 9; + LinkedList m_recent_files; + + // Item1 = file name, Item2 = menu item string + public IEnumerable> RecentFiles + { + get + { + int i = 1; + return m_recent_files.Select (f => Tuple.Create (f, string.Format ("_{0} {1}", i++, f))); + } + } + + void PushRecentFile (string file) + { + var node = m_recent_files.Find (file); + if (node != null && node == m_recent_files.First) + return; + if (null == node) + { + while (MaxRecentFiles <= m_recent_files.Count) + m_recent_files.RemoveLast(); + m_recent_files.AddFirst (file); + } + else + { + m_recent_files.Remove (node); + m_recent_files.AddFirst (node); + } + RecentFilesMenu.ItemsSource = RecentFiles; + } + + /// + /// Set data context of the ListView. + /// + + public DirectoryViewModel ViewModel + { + get + { + var source = CurrentDirectory.ItemsSource as CollectionView; + if (null == source) + return null; + return source.SourceCollection as DirectoryViewModel; + } + private set + { + StopWatchDirectoryChanges(); + var cvs = this.Resources["ListViewSource"] as CollectionViewSource; + cvs.Source = value; + + // update path textbox + var path_component = value.Path.Last(); + if (string.IsNullOrEmpty (path_component) && value.Path.Count > 1) + path_component = value.Path[value.Path.Count-2]; + pathLine.Text = path_component; + + if (value.IsArchive && value.Path.Count <= 2) + PushRecentFile (value.Path.First()); + + lv_Sort (SortMode, m_lvSortDirection); + if (!value.IsArchive && !string.IsNullOrEmpty (value.Path.First())) + { + WatchDirectoryChanges (value.Path.First()); + } + CurrentDirectory.UpdateLayout(); + } + } + + /// + /// Save current position and update view model. + /// + void PushViewModel (DirectoryViewModel vm) + { + SaveCurrentPosition(); + ViewModel = vm; + } + + DirectoryViewModel GetNewViewModel (string path) + { + if (!string.IsNullOrEmpty (path)) + { + if (!VFS.IsVirtual) + path = Path.GetFullPath (path); + var entry = VFS.FindFile (path); + if (!(entry is SubDirEntry)) + SetBusyState(); + VFS.ChDir (entry); + } + return new DirectoryViewModel (VFS.FullPath, VFS.GetFiles(), VFS.IsVirtual); + } + + private bool m_busy_state = false; + + public void SetBusyState() + { + m_busy_state = true; + Mouse.OverrideCursor = Cursors.Wait; + Dispatcher.InvokeAsync (() => { + m_busy_state = false; + Mouse.OverrideCursor = null; + }, DispatcherPriority.ApplicationIdle); + } + + /// + /// Create view model corresponding to . Returns null on error. + /// + DirectoryViewModel TryCreateViewModel (string path) + { + try + { + return GetNewViewModel (path); + } + catch (Exception X) + { + SetStatusText (string.Format ("{0}: {1}", Path.GetFileName (path), X.Message)); + return null; + } + } + + /// + /// Create view model corresponding to or empty view model if there was + /// an error accessing path. + /// + DirectoryViewModel CreateViewModel (string path, bool suppress_warning = false) + { + try + { + return GetNewViewModel (path); + } + catch (Exception X) + { + if (!suppress_warning) + PopupError (X.Message, guiStrings.MsgErrorOpening); + return new DirectoryViewModel (new string[] { "" }, new Entry[0], false); + } + } + + #region Refresh view on filesystem changes + + private FileSystemWatcher m_watcher = new FileSystemWatcher(); + + void InitDirectoryChangesWatcher () + { + m_watcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName; + m_watcher.Changed += InvokeRefreshView; + m_watcher.Created += InvokeRefreshView; + m_watcher.Deleted += InvokeRefreshView; + m_watcher.Renamed += InvokeRefreshView; + } + + void WatchDirectoryChanges (string path) + { + m_watcher.Path = path; + m_watcher.EnableRaisingEvents = true; + } + + public void StopWatchDirectoryChanges() + { + m_watcher.EnableRaisingEvents = false; + } + + public void ResumeWatchDirectoryChanges () + { + m_watcher.EnableRaisingEvents = !ViewModel.IsArchive; + } + + private void InvokeRefreshView (object source, FileSystemEventArgs e) + { + var watcher = source as FileSystemWatcher; + var vm = ViewModel; + if (!vm.IsArchive && vm.Path.First() == watcher.Path) + { + watcher.EnableRaisingEvents = false; + Dispatcher.Invoke (RefreshView); + } + } + #endregion + + /// + /// Select specified item within CurrentDirectory and bring it into a view. + /// + + void lv_SelectItem (EntryViewModel item) + { + if (item != null) + { + CurrentDirectory.SelectedItem = item; + CurrentDirectory.ScrollIntoView (item); + var lvi = (ListViewItem)CurrentDirectory.ItemContainerGenerator.ContainerFromItem (item); + if (lvi != null) + lvi.Focus(); + } + } + + void lv_SelectItem (int index) + { + CurrentDirectory.SelectedIndex = index; + CurrentDirectory.ScrollIntoView (CurrentDirectory.SelectedItem); + var lvi = (ListViewItem)CurrentDirectory.ItemContainerGenerator.ContainerFromIndex (index); + if (lvi != null) + lvi.Focus(); + } + + void lv_SelectItem (string name) + { + if (!string.IsNullOrEmpty (name)) + lv_SelectItem (ViewModel.Find (name)); + } + + private void lv_Focus () + { + if (CurrentDirectory.SelectedIndex != -1) + { + var item = CurrentDirectory.SelectedItem; + var lvi = CurrentDirectory.ItemContainerGenerator.ContainerFromItem (item) as ListViewItem; + if (lvi != null) + { + lvi.Focus(); + return; + } + } + CurrentDirectory.Focus(); + } + + void lvi_Selected (object sender, RoutedEventArgs args) + { + var lvi = sender as ListViewItem; + if (lvi == null) + return; + var entry = lvi.Content as EntryViewModel; + if (entry == null) + return; + PreviewEntry (entry.Source); + } + + EntryViewModel m_last_selected = null; + + void lv_SelectionChanged (object sender, SelectionChangedEventArgs args) + { + var lv = sender as ListView; + if (null == lv) + return; + var item = lv.SelectedItem as EntryViewModel; + if (item != null && m_last_selected != item) + { + m_last_selected = item; + PreviewEntry (item.Source); + } + } + + void lvi_DoubleClick (object sender, MouseButtonEventArgs args) + { + var lvi = sender as ListViewItem; + if (Commands.OpenItem.CanExecute (null, lvi)) + { + Commands.OpenItem.Execute (null, lvi); + args.Handled = true; + } + } + + /// + /// Get currently selected item from ListView widget. + /// + private ListViewItem lv_GetCurrentContainer () + { + int current = CurrentDirectory.SelectedIndex; + if (-1 == current) + return null; + + return CurrentDirectory.ItemContainerGenerator.ContainerFromIndex (current) as ListViewItem; + } + + GridViewColumnHeader m_lvSortByColumn = null; + ListSortDirection m_lvSortDirection = ListSortDirection.Ascending; + + public string SortMode + { + get { return GetValue (SortModeProperty) as string; } + private set { SetValue (SortModeProperty, value); } + } + + public static readonly DependencyProperty SortModeProperty = + DependencyProperty.RegisterAttached ("SortMode", typeof(string), typeof(MainWindow), new UIPropertyMetadata()); + + void lv_SetSortMode (string sortBy, ListSortDirection direction) + { + m_lvSortByColumn = null; + GridView view = CurrentDirectory.View as GridView; + foreach (var column in view.Columns) + { + var header = column.Header as GridViewColumnHeader; + if (null != header && !string.IsNullOrEmpty (sortBy) && sortBy.Equals (header.Tag)) + { + if (ListSortDirection.Ascending == direction) + column.HeaderTemplate = Resources["SortArrowUp"] as DataTemplate; + else + column.HeaderTemplate = Resources["SortArrowDown"] as DataTemplate; + m_lvSortByColumn = header; + m_lvSortDirection = direction; + } + else + { + column.HeaderTemplate = Resources["SortArrowNone"] as DataTemplate; + } + } + SortMode = sortBy; + } + + private void lv_Sort (string sortBy, ListSortDirection direction) + { + var dataView = CollectionViewSource.GetDefaultView (CurrentDirectory.ItemsSource) as ListCollectionView; + dataView.CustomSort = new FileSystemComparer (sortBy, direction); + } + + /// + /// Sort Listview by columns + /// + void lv_ColumnHeaderClicked (object sender, RoutedEventArgs e) + { + var headerClicked = e.OriginalSource as GridViewColumnHeader; + + if (null == headerClicked) + return; + if (headerClicked.Role == GridViewColumnHeaderRole.Padding) + return; + + ListSortDirection direction; + if (headerClicked != m_lvSortByColumn) + direction = ListSortDirection.Ascending; + else if (m_lvSortDirection == ListSortDirection.Ascending) + direction = ListSortDirection.Descending; + else + direction = ListSortDirection.Ascending; + + string sortBy = headerClicked.Tag.ToString(); + lv_Sort (sortBy, direction); + SortMode = sortBy; + + // Remove arrow from previously sorted header + if (m_lvSortByColumn != null && m_lvSortByColumn != headerClicked) + { + m_lvSortByColumn.Column.HeaderTemplate = Resources["SortArrowNone"] as DataTemplate; + } + + if (ListSortDirection.Ascending == direction) + { + headerClicked.Column.HeaderTemplate = Resources["SortArrowUp"] as DataTemplate; + } + else + { + headerClicked.Column.HeaderTemplate = Resources["SortArrowDown"] as DataTemplate; + } + m_lvSortByColumn = headerClicked; + m_lvSortDirection = direction; + } + + /// + /// Handle "Sort By" commands. + /// + + private void SortByExec (object sender, ExecutedRoutedEventArgs e) + { + string sort_by = e.Parameter as string; + lv_Sort (sort_by, ListSortDirection.Ascending); + lv_SetSortMode (sort_by, ListSortDirection.Ascending); + } + + /// + /// Handle "Set file type" commands. + /// + private void SetFileTypeExec (object sender, ExecutedRoutedEventArgs e) + { + var selected = CurrentDirectory.SelectedItems.Cast().Where (x => !x.IsDirectory); + if (!selected.Any()) + return; + string type = e.Parameter as string; + foreach (var entry in selected) + { + entry.Type = type; + } + } + + /// + /// Event handler for keys pressed in the directory view pane + /// + + private void lv_TextInput (object sender, TextCompositionEventArgs e) + { + LookupItem (e.Text, e.Timestamp); + e.Handled = true; + } + + private void lv_KeyDown (object sender, KeyEventArgs e) + { + if (e.IsDown && Key.Space == e.Key && LookupActive) + { + LookupItem (" ", e.Timestamp); + e.Handled = true; + } + } + + class InputData + { + public int LastTime = 0; + public StringBuilder Phrase = new StringBuilder(); + public bool Mismatch = false; + + public bool LookupActive + { + get { return Phrase.Length > 0 && Environment.TickCount - LastTime < TextLookupTimeout; } + } + + public void Reset () + { + Phrase.Clear (); + Mismatch = false; + } + } + + const int TextLookupTimeout = 1000; // milliseconds + + InputData m_current_input = new InputData(); + + public bool LookupActive { get { return m_current_input.LookupActive; } } + + /// + /// Lookup item in listview pane by first letters of name. + /// + + private void LookupItem (string key, int timestamp) + { + if (string.IsNullOrEmpty (key)) + return; + var source = CurrentDirectory.ItemsSource as CollectionView; + if (source == null) + return; + + if (timestamp - m_current_input.LastTime > TextLookupTimeout) + { + m_current_input.Reset(); + } + m_current_input.LastTime = timestamp; + if (m_current_input.Mismatch) + return; + + if (!(1 == m_current_input.Phrase.Length && m_current_input.Phrase[0] == key[0])) + { + m_current_input.Phrase.Append (key); + } + int start_index = CurrentDirectory.SelectedIndex; + if (1 == m_current_input.Phrase.Length) + { + // lookup starting from the next item + if (start_index != -1 && start_index+1 < source.Count) + ++start_index; + } + var items = source.Cast(); + if (start_index > 0) + { + items = items.Skip (start_index).Concat (items.Take (start_index)); + } + string input = m_current_input.Phrase.ToString(); + var matched = items.Where (e => e.Name.StartsWith (input, StringIgnoreCase)).FirstOrDefault(); + if (null != matched) + lv_SelectItem (matched); + else + m_current_input.Mismatch = true; + } + + static readonly Regex FullpathRe = new Regex (@"^(?:[a-z]:|[\\/])", RegexOptions.IgnoreCase); + + private void acb_OnKeyDown (object sender, KeyEventArgs e) + { + if (e.Key != Key.Return) + return; + string path = (sender as AutoCompleteBox).Text; + if (string.IsNullOrEmpty (path)) + return; + if (FullpathRe.IsMatch (path)) + { + OpenFile (path); + return; + } + try + { + PushViewModel (GetNewViewModel (path)); + lv_Focus(); + } + catch (Exception X) + { + PopupError (X.Message, guiStrings.MsgErrorOpening); + } + } + + #region Navigation history implementation + + internal string CurrentPath { get { return ViewModel.Path.First(); } } + + HistoryStack m_history = new HistoryStack(); + + public DirectoryPosition GetCurrentPosition () + { + var evm = CurrentDirectory.SelectedItem as EntryViewModel; + return new DirectoryPosition (ViewModel, evm); + } + + public bool SetCurrentPosition (DirectoryPosition pos) + { + try + { + VFS.FullPath = pos.Path; + var vm = TryCreateViewModel (pos.Path.Last()); + if (null == vm) + return false; + ViewModel = vm; + if (null != pos.Item) + lv_SelectItem (pos.Item); + return true; + } + catch (Exception X) + { + // if VFS.FullPath throws an exception, ViewModel becomes inconsistent at this point + // and should be rebuilt + ViewModel = CreateViewModel (VFS.Top.CurrentDirectory, true); + SetStatusText (X.Message); + return false; + } + } + + public void SaveCurrentPosition () + { + m_history.Push (GetCurrentPosition()); + } + + public void ChangePosition (DirectoryPosition new_pos) + { + var current = GetCurrentPosition(); + if (!current.Path.SequenceEqual (new_pos.Path)) + SaveCurrentPosition(); + SetCurrentPosition (new_pos); + } + + private void GoBackExec (object sender, ExecutedRoutedEventArgs e) + { + DirectoryPosition current = m_history.Undo (GetCurrentPosition()); + if (current != null) + SetCurrentPosition (current); + } + + private void GoForwardExec (object sender, ExecutedRoutedEventArgs e) + { + DirectoryPosition current = m_history.Redo (GetCurrentPosition()); + if (current != null) + SetCurrentPosition (current); + } + + private void CanExecuteGoBack (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = m_history.CanUndo(); + } + + private void CanExecuteGoForward (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = m_history.CanRedo(); + } + #endregion + + private void OpenFileExec (object control, ExecutedRoutedEventArgs e) + { + var dlg = new OpenFileDialog { + CheckFileExists = true, + CheckPathExists = true, + Multiselect = false, + Title = guiStrings.TextChooseArchive, + }; + if (!dlg.ShowDialog (this).Value) + return; + OpenFile (dlg.FileName); + } + + private void OpenFile (string filename) + { + if (filename == CurrentPath || string.IsNullOrEmpty (filename)) + return; + try + { + if (File.Exists (filename)) + VFS.FullPath = new string[] { filename, "" }; + else + VFS.FullPath = new string[] { filename }; + var vm = new DirectoryViewModel (VFS.FullPath, VFS.GetFiles(), VFS.IsVirtual); + PushViewModel (vm); + if (null != VFS.CurrentArchive) + SetStatusText (VFS.CurrentArchive.Description); + lv_SelectItem (0); + } + catch (OperationCanceledException X) + { + SetStatusText (X.Message); + } + catch (Exception X) + { + PopupError (string.Format("{0}:\n{1}", filename, X.Message), guiStrings.MsgErrorOpening); + } + } + + private void OpenRecentExec (object control, ExecutedRoutedEventArgs e) + { + string filename = e.Parameter as string; + if (string.IsNullOrEmpty (filename)) + return; + OpenFile (filename); + } + + /// + /// Open file/directory. + /// + private void OpenItemExec (object control, ExecutedRoutedEventArgs e) + { + EntryViewModel entry = null; + var lvi = e.OriginalSource as ListViewItem; + if (lvi != null) + entry = lvi.Content as EntryViewModel; + if (null == entry) + entry = CurrentDirectory.SelectedItem as EntryViewModel; + if (null == entry) + return; + if ("audio" == entry.Type) + { + PlayFile (entry.Source); + return; + } + OpenDirectoryEntry (ViewModel, entry); + } + + private void OpenDirectoryEntry (DirectoryViewModel vm, EntryViewModel entry) + { + string old_dir = null == vm ? "" : vm.Path.Last(); + string new_dir = entry.Source.Name; + if (".." == new_dir) + { + if (null != vm && !vm.IsArchive) + new_dir = Path.Combine (old_dir, entry.Name); + if (vm.Path.Count > 1 && string.IsNullOrEmpty (old_dir)) + old_dir = vm.Path[vm.Path.Count-2]; + } + Trace.WriteLine (new_dir, "OpenDirectoryEntry"); + int old_fs_count = VFS.Count; + vm = TryCreateViewModel (new_dir); + if (null == vm) + { + if (VFS.Count == old_fs_count) + return; + vm = new DirectoryViewModel (VFS.FullPath, new Entry[0], VFS.IsVirtual); + PushViewModel (vm); + } + else + { + PushViewModel (vm); + if (VFS.Count > old_fs_count && null != VFS.CurrentArchive) + SetStatusText (string.Format ("{0}: {1}", VFS.CurrentArchive.Description, + Localization.Format ("MsgFiles", VFS.CurrentArchive.Dir.Count()))); + else + SetStatusText (""); + } + if (".." == entry.Name) + lv_SelectItem (Path.GetFileName (old_dir)); + else + lv_SelectItem (0); + } + + WaveOutEvent m_audio_device; + WaveOutEvent AudioDevice + { + get { return m_audio_device; } + set + { + var old_value = m_audio_device; + m_audio_device = value; + if (old_value != null) + old_value.Dispose(); + } + } + + WaveStream m_audio_input; + WaveStream CurrentAudio + { + get { return m_audio_input; } + set + { + var old_value = m_audio_input; + m_audio_input = value; + if (old_value != null) + old_value.Dispose(); + } + } + + private void PlayFile (Entry entry) + { + SoundInput sound = null; + try + { + SetBusyState(); + using (var input = VFS.OpenStream (entry)) + { + FormatCatalog.Instance.LastError = null; + sound = AudioFormat.Read (input); + if (null == sound) + { + if (null != FormatCatalog.Instance.LastError) + throw FormatCatalog.Instance.LastError; + return; + } + + if (AudioDevice != null) + { + AudioDevice.PlaybackStopped -= OnPlaybackStopped; + AudioDevice = null; + } + CurrentAudio = new WaveStreamImpl (sound); + AudioDevice = new WaveOutEvent(); + AudioDevice.Init (CurrentAudio); + AudioDevice.PlaybackStopped += OnPlaybackStopped; + AudioDevice.Play(); + var fmt = CurrentAudio.WaveFormat; + SetResourceText (string.Format ("Playing {0} / {3} / {2}bps / {1}Hz", entry.Name, + fmt.SampleRate, sound.SourceBitrate / 1000, + CurrentAudio.TotalTime.ToString ("m':'ss"))); + } + } + catch (Exception X) + { + SetStatusText (X.Message); + if (null != sound) + sound.Dispose(); + } + } + + private void OnPlaybackStopped (object sender, StoppedEventArgs e) + { + try + { + SetResourceText (""); + CurrentAudio = null; + } + catch (Exception X) + { + Trace.WriteLine (X.Message, "[OnPlaybackStopped]"); + } + } + + /// + /// Launch specified file. + /// + private void SystemOpen (string file) + { + try + { + Process.Start (file); + } + catch (Exception X) + { + SetStatusText (X.Message); + } + } + + /// + /// Refresh current view. + /// + private void RefreshExec (object sender, ExecutedRoutedEventArgs e) + { + RefreshView(); + } + + public void RefreshView () + { + VFS.Flush(); + var pos = GetCurrentPosition(); + SetCurrentPosition (pos); + } + + /// + /// Open current file in Explorer. + /// + + private void ExploreItemExec (object sender, ExecutedRoutedEventArgs e) + { + var entry = CurrentDirectory.SelectedItem as EntryViewModel; + if (entry != null && !ViewModel.IsArchive) + { + try + { + string name = Path.Combine (CurrentPath, entry.Name); + Process.Start ("explorer.exe", "/select,"+name); + } + catch (Exception X) + { + // ignore + Trace.WriteLine (X.Message, "explorer.exe"); + } + } + } + + /// + /// Delete item from both media library and disk drive. + /// + private void DeleteItemExec (object sender, ExecutedRoutedEventArgs e) + { + var items = CurrentDirectory.SelectedItems.Cast().Where (f => !f.IsDirectory); + if (!items.Any()) + return; + + this.IsEnabled = false; + try + { + VFS.Flush(); + ResetPreviewPane(); + if (!items.Skip (1).Any()) // items.Count() == 1 + { + string item_name = Path.Combine (CurrentPath, items.First().Name); + Trace.WriteLine (item_name, "DeleteItemExec"); + FileSystem.DeleteFile (item_name, UIOption.AllDialogs, RecycleOption.SendToRecycleBin); + DeleteItem (lv_GetCurrentContainer()); + SetStatusText (string.Format(guiStrings.MsgDeletedItem, item_name)); + } + else + { + int count = 0; + StopWatchDirectoryChanges (); + try + { + var file_list = items.Select (entry => Path.Combine (CurrentPath, entry.Name)); + GARbro.Shell.File.Delete (file_list); + count = file_list.Count(); + } + catch + { + ResumeWatchDirectoryChanges(); + throw; + } + RefreshView(); + SetStatusText (Localization.Format ("MsgDeletedItems", count)); + } + } + catch (OperationCanceledException) + { + } + catch (Exception X) + { + SetStatusText (X.Message); + } + finally + { + this.IsEnabled = true; + } + } + + /// + /// Delete item at the specified position within ListView, correctly adjusting current + /// position. + /// + private void DeleteItem (ListViewItem item) + { + int i = CurrentDirectory.SelectedIndex; + int next = -1; + if (i+1 < CurrentDirectory.Items.Count) + next = i + 1; + else if (i > 0) + next = i - 1; + + if (next != -1) + CurrentDirectory.SelectedIndex = next; + + var entry = item.Content as EntryViewModel; + if (entry != null) + { + ViewModel.Remove (entry); + } + } + + /// + /// Rename selected item. + /// + private void RenameItemExec(object sender, ExecutedRoutedEventArgs e) + { + RenameElement (lv_GetCurrentContainer()); + } + + /// + /// Rename item contained within specified framework control. + /// + void RenameElement (ListViewItem item) + { + if (item == null) + return; +/* + TextBlock block = FindByName (item, "item_Text") as TextBlock; + TextBox box = FindSibling (block, "item_Input") as TextBox; + + if (block == null || box == null) + return; + + IsRenameActive = true; + + block.Visibility = Visibility.Collapsed; + box.Text = block.Text; + box.Visibility = Visibility.Visible; + box.Select (0, box.Text.Length); + box.Focus(); +*/ + } + + /// + /// Select files matching mask. + /// + void AddSelectionExec (object sender, ExecutedRoutedEventArgs e) + { + try + { + var ext_list = new SortedSet(); + foreach (var entry in ViewModel) + { + var ext = Path.GetExtension (entry.Name).ToLowerInvariant(); + if (!string.IsNullOrEmpty (ext)) + ext_list.Add (ext); + } + var selection = new EnterMaskDialog (ext_list.Select (ext => "*"+ext)); + selection.Owner = this; + var result = selection.ShowDialog(); + if (!result.Value) + return; + if ("*.*" == selection.Mask.Text) + { + CurrentDirectory.SelectAll(); + return; + } + var mask = Regex.Escape (selection.Mask.Text).Replace (@"\*", ".*").Replace (@"\?", "."); + var glob = new Regex ("^"+mask+"$", RegexOptions.IgnoreCase); + var matching = ViewModel.Where (entry => glob.IsMatch (entry.Name)); + if (!matching.Any()) + { + SetStatusText (string.Format (guiStrings.MsgNoMatching, selection.Mask.Text)); + return; + } + int count = 0; + foreach (var item in matching) + { + if (!CurrentDirectory.SelectedItems.Contains (item)) + { + CurrentDirectory.SelectedItems.Add (item); + ++count; + } + } + if (count != 0) + SetStatusText (Localization.Format ("MsgSelectedFiles", count)); + } + catch (Exception X) + { + SetStatusText (X.Message); + } + } + + void SelectAllExec (object sender, ExecutedRoutedEventArgs e) + { + CurrentDirectory.SelectAll(); + } + + void NextItemExec (object sender, ExecutedRoutedEventArgs e) + { + if (LookupActive) + return; + + var index = CurrentDirectory.SelectedIndex + 1; + if (index < CurrentDirectory.Items.Count) + CurrentDirectory.SelectedIndex = index; + } + + /// + /// Handle "Exit" command. + /// + void ExitExec (object sender, ExecutedRoutedEventArgs e) + { + Application.Current.Shutdown(); + } + + private void AboutExec (object sender, ExecutedRoutedEventArgs e) + { + var about = new AboutBox(); + about.Owner = this; + about.ShowDialog(); + } + + private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = true; + } + + private void CanExecuteControlCommand (object sender, CanExecuteRoutedEventArgs e) + { + Control target = e.Source as Control; + e.CanExecute = target != null; + } + + private void CanExecuteOnSelected (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = CurrentDirectory.SelectedIndex != -1; + } + + private void CanExecuteConvertMedia (object sender, CanExecuteRoutedEventArgs e) + { + if (CurrentDirectory.SelectedItems.Count >= 1) + { + e.CanExecute = !ViewModel.IsArchive; + } + } + + private void CanExecuteOnImage (object sender, CanExecuteRoutedEventArgs e) + { + var entry = CurrentDirectory.SelectedItem as EntryViewModel; + e.CanExecute = !ViewModel.IsArchive && entry != null && entry.Type == "image"; + } + + private void CanExecuteInArchive (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = ViewModel.IsArchive && CurrentDirectory.SelectedIndex != -1; + } + + private void CanExecuteCreateArchive (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = !ViewModel.IsArchive && CurrentDirectory.SelectedItems.Count > 0; + } + + private void CanExecuteInDirectory (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = !ViewModel.IsArchive; + } + + private void CanExecuteExtract (object sender, CanExecuteRoutedEventArgs e) + { + if (ViewModel.IsArchive) + { + e.CanExecute = true; + return; + } + else if (CurrentDirectory.SelectedIndex != -1) + { + var entry = CurrentDirectory.SelectedItem as EntryViewModel; + if (entry != null && !entry.IsDirectory) + { + e.CanExecute = true; + return; + } + } + e.CanExecute = false; + } + + private void CanExecuteOnPhysicalFile (object sender, CanExecuteRoutedEventArgs e) + { + if (!ViewModel.IsArchive && CurrentDirectory.SelectedIndex != -1) + { + var entry = CurrentDirectory.SelectedItem as EntryViewModel; + if (entry != null && !entry.IsDirectory) + { + e.CanExecute = true; + return; + } + } + e.CanExecute = false; + } + + private void OnParametersRequest (object sender, ParametersRequestEventArgs e) + { + var format = sender as IResource; + if (null != format) + { + var control = format.GetAccessWidget() as UIElement; + if (null != control) + { + bool busy_state = m_busy_state; + var param_dialog = new ArcParametersDialog (control, e.Notice); + param_dialog.Owner = this; + e.InputResult = param_dialog.ShowDialog() ?? false; + if (e.InputResult) + e.Options = format.GetOptions (control); + if (busy_state) + SetBusyState(); + } + } + } + + private void CanExecuteFitWindow (object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = ImageCanvas.Source != null; + } + + private void HideStatusBarExec (object sender, ExecutedRoutedEventArgs e) + { + ToggleVisibility (AppStatusBar); + } + + private void HideMenuBarExec (object sender, ExecutedRoutedEventArgs e) + { + ToggleVisibility (MainMenuBar); + } + + private void HideToolBarExec (object sender, ExecutedRoutedEventArgs e) + { + ToggleVisibility (MainToolBar); + } + + static void ToggleVisibility (UIElement item) + { + var status = item.Visibility; + if (Visibility.Visible == status) + item.Visibility = Visibility.Collapsed; + else + item.Visibility = Visibility.Visible; + } + } + + public class SortModeToBooleanConverter : IValueConverter + { + public object Convert (object value, Type targetType, object parameter, CultureInfo culture) + { + string actual_mode = value as string; + string check_mode = parameter as string; + if (string.IsNullOrEmpty (check_mode)) + return string.IsNullOrEmpty (actual_mode); + return check_mode.Equals (actual_mode); + } + + public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class BooleanToCollapsedVisibilityConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + //reverse conversion (false=>Visible, true=>collapsed) on any given parameter + bool input = (null == parameter) ? (bool)value : !((bool)value); + return (input) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } + + public static class Commands + { + public static readonly RoutedCommand OpenItem = new RoutedCommand(); + public static readonly RoutedCommand OpenFile = new RoutedCommand(); + public static readonly RoutedCommand OpenRecent = new RoutedCommand(); + public static readonly RoutedCommand ExtractItem = new RoutedCommand(); + public static readonly RoutedCommand CreateArchive = new RoutedCommand(); + public static readonly RoutedCommand SortBy = new RoutedCommand(); + public static readonly RoutedCommand Exit = new RoutedCommand(); + public static readonly RoutedCommand About = new RoutedCommand(); + public static readonly RoutedCommand GoBack = new RoutedCommand(); + public static readonly RoutedCommand GoForward = new RoutedCommand(); + public static readonly RoutedCommand DeleteItem = new RoutedCommand(); + public static readonly RoutedCommand RenameItem = new RoutedCommand(); + public static readonly RoutedCommand ExploreItem = new RoutedCommand(); + public static readonly RoutedCommand ConvertMedia = new RoutedCommand(); + public static readonly RoutedCommand Refresh = new RoutedCommand(); + public static readonly RoutedCommand Browse = new RoutedCommand(); + public static readonly RoutedCommand FitWindow = new RoutedCommand(); + public static readonly RoutedCommand HideStatusBar = new RoutedCommand(); + public static readonly RoutedCommand HideMenuBar = new RoutedCommand(); + public static readonly RoutedCommand HideToolBar = new RoutedCommand(); + public static readonly RoutedCommand AddSelection = new RoutedCommand(); + public static readonly RoutedCommand SelectAll = new RoutedCommand(); + public static readonly RoutedCommand SetFileType = new RoutedCommand(); + public static readonly RoutedCommand NextItem = new RoutedCommand(); + } +} diff --git a/ModalWindow.cs b/GUI/ModalWindow.cs similarity index 97% rename from ModalWindow.cs rename to GUI/ModalWindow.cs index 6b1aa5cc..f5c3839d 100644 --- a/ModalWindow.cs +++ b/GUI/ModalWindow.cs @@ -1,88 +1,88 @@ -//! \file ModalWindow.cs -//! \date Tue Aug 02 10:20:50 2011 -//! \brief Window without an icon. -// -// Copyright (C) 2011 by poddav -// -// 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.Windows; -using System.Windows.Interop; -using System.Runtime.InteropServices; - -namespace Rnd.Windows -{ - /// - /// Window without an icon. - /// - public class ModalWindow : Window - { - protected override void OnSourceInitialized(EventArgs e) - { - base.OnSourceInitialized(e); - - HideIcon (this); - } - - internal class NativeMethods - { - [DllImport ("user32.dll")] - internal static extern int GetWindowLong (IntPtr hwnd, int index); - - [DllImport ("user32.dll")] - internal static extern int SetWindowLong (IntPtr hwnd, int index, int newStyle); - - [DllImport ("user32.dll")] - internal static extern bool SetWindowPos (IntPtr hwnd, IntPtr hwndInsertAfter, int x, int y, int width, int height, uint flags); - - [DllImport ("user32.dll")] - internal static extern IntPtr SendMessage (IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam); - } - - const int GWL_EXSTYLE = -20; - const int WS_EX_DLGMODALFRAME = 0x0001; - - const int SWP_NOSIZE = 0x0001; - const int SWP_NOMOVE = 0x0002; - const int SWP_NOZORDER = 0x0004; - const int SWP_FRAMECHANGED = 0x0020; - const uint WM_SETICON = 0x0080; - - /// - /// Win32 mumbo-jumbo to hide window icon and its menu. - /// - - public static void HideIcon (Window window) - { - // Get this window's handle - IntPtr hwnd = new WindowInteropHelper (window).Handle; - - // Change the extended window style to not show a window icon - int extendedStyle = NativeMethods.GetWindowLong (hwnd, GWL_EXSTYLE); - NativeMethods.SetWindowLong (hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME); - NativeMethods.SendMessage (hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero); - NativeMethods.SendMessage (hwnd, WM_SETICON, new IntPtr (1), IntPtr.Zero); - - // Update the window's non-client area to reflect the changes - NativeMethods.SetWindowPos (hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); - } - } -} +//! \file ModalWindow.cs +//! \date Tue Aug 02 10:20:50 2011 +//! \brief Window without an icon. +// +// Copyright (C) 2011 by poddav +// +// 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.Windows; +using System.Windows.Interop; +using System.Runtime.InteropServices; + +namespace Rnd.Windows +{ + /// + /// Window without an icon. + /// + public class ModalWindow : Window + { + protected override void OnSourceInitialized(EventArgs e) + { + base.OnSourceInitialized(e); + + HideIcon (this); + } + + internal class NativeMethods + { + [DllImport ("user32.dll")] + internal static extern int GetWindowLong (IntPtr hwnd, int index); + + [DllImport ("user32.dll")] + internal static extern int SetWindowLong (IntPtr hwnd, int index, int newStyle); + + [DllImport ("user32.dll")] + internal static extern bool SetWindowPos (IntPtr hwnd, IntPtr hwndInsertAfter, int x, int y, int width, int height, uint flags); + + [DllImport ("user32.dll")] + internal static extern IntPtr SendMessage (IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam); + } + + const int GWL_EXSTYLE = -20; + const int WS_EX_DLGMODALFRAME = 0x0001; + + const int SWP_NOSIZE = 0x0001; + const int SWP_NOMOVE = 0x0002; + const int SWP_NOZORDER = 0x0004; + const int SWP_FRAMECHANGED = 0x0020; + const uint WM_SETICON = 0x0080; + + /// + /// Win32 mumbo-jumbo to hide window icon and its menu. + /// + + public static void HideIcon (Window window) + { + // Get this window's handle + IntPtr hwnd = new WindowInteropHelper (window).Handle; + + // Change the extended window style to not show a window icon + int extendedStyle = NativeMethods.GetWindowLong (hwnd, GWL_EXSTYLE); + NativeMethods.SetWindowLong (hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME); + NativeMethods.SendMessage (hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero); + NativeMethods.SendMessage (hwnd, WM_SETICON, new IntPtr (1), IntPtr.Zero); + + // Update the window's non-client area to reflect the changes + NativeMethods.SetWindowPos (hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + } + } +} diff --git a/NAudio.cs b/GUI/NAudio.cs similarity index 100% rename from NAudio.cs rename to GUI/NAudio.cs diff --git a/Properties/AssemblyInfo.cs b/GUI/Properties/AssemblyInfo.cs similarity index 93% rename from Properties/AssemblyInfo.cs rename to GUI/Properties/AssemblyInfo.cs index 42f50728..96b87f3f 100644 --- a/Properties/AssemblyInfo.cs +++ b/GUI/Properties/AssemblyInfo.cs @@ -1,55 +1,55 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Game Resource browser")] -[assembly: AssemblyDescription("Game Resource browser")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany ("mørkt")] -[assembly: AssemblyProduct("GARbro.GUI")] -[assembly: AssemblyCopyright ("Copyright © 2014-2015 mørkt")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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 ("1.2.12.953")] -[assembly: AssemblyFileVersion ("1.2.12.953")] +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Game Resource browser")] +[assembly: AssemblyDescription("Game Resource browser")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany ("mørkt")] +[assembly: AssemblyProduct("GARbro.GUI")] +[assembly: AssemblyCopyright ("Copyright © 2014-2015 mørkt")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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 ("1.2.12.0")] +[assembly: AssemblyFileVersion ("1.2.12.0")] diff --git a/Properties/Resources.Designer.cs b/GUI/Properties/Resources.Designer.cs similarity index 97% rename from Properties/Resources.Designer.cs rename to GUI/Properties/Resources.Designer.cs index 836235e8..8d74d938 100644 --- a/Properties/Resources.Designer.cs +++ b/GUI/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18444 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GARbro.GUI.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GARbro.GUI.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GARbro.GUI.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GARbro.GUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/GUI/Properties/Resources.resx similarity index 97% rename from Properties/Resources.resx rename to GUI/Properties/Resources.resx index ffecec85..af7dbebb 100644 --- a/Properties/Resources.resx +++ b/GUI/Properties/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/GUI/Properties/Settings.Designer.cs similarity index 97% rename from Properties/Settings.Designer.cs rename to GUI/Properties/Settings.Designer.cs index a8a205fc..7d21d9ad 100644 --- a/Properties/Settings.Designer.cs +++ b/GUI/Properties/Settings.Designer.cs @@ -1,361 +1,361 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34209 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GARbro.GUI.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool UpgradeRequired { - get { - return ((bool)(this["UpgradeRequired"])); - } - set { - this["UpgradeRequired"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double winTop { - get { - return ((double)(this["winTop"])); - } - set { - this["winTop"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double winLeft { - get { - return ((double)(this["winLeft"])); - } - set { - this["winLeft"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("1024")] - public double winWidth { - get { - return ((double)(this["winWidth"])); - } - set { - this["winWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("600")] - public double winHeight { - get { - return ((double)(this["winHeight"])); - } - set { - this["winHeight"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Normal")] - public global::System.Windows.WindowState winState { - get { - return ((global::System.Windows.WindowState)(this["winState"])); - } - set { - this["winState"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("265")] - public double lvNameColumnWidth { - get { - return ((double)(this["lvNameColumnWidth"])); - } - set { - this["lvNameColumnWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("75")] - public double lvTypeColumnWidth { - get { - return ((double)(this["lvTypeColumnWidth"])); - } - set { - this["lvTypeColumnWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("75")] - public double lvSizeColumnWidth { - get { - return ((double)(this["lvSizeColumnWidth"])); - } - set { - this["lvSizeColumnWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Name")] - public string lvSortColumn { - get { - return ((string)(this["lvSortColumn"])); - } - set { - this["lvSortColumn"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Ascending")] - public global::System.ComponentModel.ListSortDirection lvSortDirection { - get { - return ((global::System.ComponentModel.ListSortDirection)(this["lvSortDirection"])); - } - set { - this["lvSortDirection"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("448")] - public global::System.Windows.GridLength lvPanelWidth { - get { - return ((global::System.Windows.GridLength)(this["lvPanelWidth"])); - } - set { - this["lvPanelWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool appExtractImages { - get { - return ((bool)(this["appExtractImages"])); - } - set { - this["appExtractImages"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool appExtractText { - get { - return ((bool)(this["appExtractText"])); - } - set { - this["appExtractText"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string appImageFormat { - get { - return ((string)(this["appImageFormat"])); - } - set { - this["appImageFormat"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("65001")] - public int appTextEncoding { - get { - return ((int)(this["appTextEncoding"])); - } - set { - this["appTextEncoding"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string appLastDirectory { - get { - return ((string)(this["appLastDirectory"])); - } - set { - this["appLastDirectory"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string appArchiveFormat { - get { - return ((string)(this["appArchiveFormat"])); - } - set { - this["appArchiveFormat"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection appRecentFiles { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["appRecentFiles"])); - } - set { - this["appRecentFiles"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string appLastCreatedArchive { - get { - return ((string)(this["appLastCreatedArchive"])); - } - set { - this["appLastCreatedArchive"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Visible")] - public global::System.Windows.Visibility winMenuBarVisibility { - get { - return ((global::System.Windows.Visibility)(this["winMenuBarVisibility"])); - } - set { - this["winMenuBarVisibility"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Visible")] - public global::System.Windows.Visibility winToolBarVisibility { - get { - return ((global::System.Windows.Visibility)(this["winToolBarVisibility"])); - } - set { - this["winToolBarVisibility"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Visible")] - public global::System.Windows.Visibility winStatusBarVisibility { - get { - return ((global::System.Windows.Visibility)(this["winStatusBarVisibility"])); - } - set { - this["winStatusBarVisibility"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("PNG")] - public string appLastImageFormat { - get { - return ((string)(this["appLastImageFormat"])); - } - set { - this["appLastImageFormat"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool appConvertAudio { - get { - return ((bool)(this["appConvertAudio"])); - } - set { - this["appConvertAudio"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool appExtractAudio { - get { - return ((bool)(this["appExtractAudio"])); - } - set { - this["appExtractAudio"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool appIgnoreConversionErrors { - get { - return ((bool)(this["appIgnoreConversionErrors"])); - } - set { - this["appIgnoreConversionErrors"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string appLastDestination { - get { - return ((string)(this["appLastDestination"])); - } - set { - this["appLastDestination"] = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GARbro.GUI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool UpgradeRequired { + get { + return ((bool)(this["UpgradeRequired"])); + } + set { + this["UpgradeRequired"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("NaN")] + public double winTop { + get { + return ((double)(this["winTop"])); + } + set { + this["winTop"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("NaN")] + public double winLeft { + get { + return ((double)(this["winLeft"])); + } + set { + this["winLeft"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1024")] + public double winWidth { + get { + return ((double)(this["winWidth"])); + } + set { + this["winWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("600")] + public double winHeight { + get { + return ((double)(this["winHeight"])); + } + set { + this["winHeight"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Normal")] + public global::System.Windows.WindowState winState { + get { + return ((global::System.Windows.WindowState)(this["winState"])); + } + set { + this["winState"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("265")] + public double lvNameColumnWidth { + get { + return ((double)(this["lvNameColumnWidth"])); + } + set { + this["lvNameColumnWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("75")] + public double lvTypeColumnWidth { + get { + return ((double)(this["lvTypeColumnWidth"])); + } + set { + this["lvTypeColumnWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("75")] + public double lvSizeColumnWidth { + get { + return ((double)(this["lvSizeColumnWidth"])); + } + set { + this["lvSizeColumnWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Name")] + public string lvSortColumn { + get { + return ((string)(this["lvSortColumn"])); + } + set { + this["lvSortColumn"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Ascending")] + public global::System.ComponentModel.ListSortDirection lvSortDirection { + get { + return ((global::System.ComponentModel.ListSortDirection)(this["lvSortDirection"])); + } + set { + this["lvSortDirection"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("448")] + public global::System.Windows.GridLength lvPanelWidth { + get { + return ((global::System.Windows.GridLength)(this["lvPanelWidth"])); + } + set { + this["lvPanelWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool appExtractImages { + get { + return ((bool)(this["appExtractImages"])); + } + set { + this["appExtractImages"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool appExtractText { + get { + return ((bool)(this["appExtractText"])); + } + set { + this["appExtractText"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string appImageFormat { + get { + return ((string)(this["appImageFormat"])); + } + set { + this["appImageFormat"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("65001")] + public int appTextEncoding { + get { + return ((int)(this["appTextEncoding"])); + } + set { + this["appTextEncoding"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string appLastDirectory { + get { + return ((string)(this["appLastDirectory"])); + } + set { + this["appLastDirectory"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string appArchiveFormat { + get { + return ((string)(this["appArchiveFormat"])); + } + set { + this["appArchiveFormat"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Collections.Specialized.StringCollection appRecentFiles { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["appRecentFiles"])); + } + set { + this["appRecentFiles"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string appLastCreatedArchive { + get { + return ((string)(this["appLastCreatedArchive"])); + } + set { + this["appLastCreatedArchive"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Visible")] + public global::System.Windows.Visibility winMenuBarVisibility { + get { + return ((global::System.Windows.Visibility)(this["winMenuBarVisibility"])); + } + set { + this["winMenuBarVisibility"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Visible")] + public global::System.Windows.Visibility winToolBarVisibility { + get { + return ((global::System.Windows.Visibility)(this["winToolBarVisibility"])); + } + set { + this["winToolBarVisibility"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Visible")] + public global::System.Windows.Visibility winStatusBarVisibility { + get { + return ((global::System.Windows.Visibility)(this["winStatusBarVisibility"])); + } + set { + this["winStatusBarVisibility"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("PNG")] + public string appLastImageFormat { + get { + return ((string)(this["appLastImageFormat"])); + } + set { + this["appLastImageFormat"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool appConvertAudio { + get { + return ((bool)(this["appConvertAudio"])); + } + set { + this["appConvertAudio"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool appExtractAudio { + get { + return ((bool)(this["appExtractAudio"])); + } + set { + this["appExtractAudio"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool appIgnoreConversionErrors { + get { + return ((bool)(this["appIgnoreConversionErrors"])); + } + set { + this["appIgnoreConversionErrors"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string appLastDestination { + get { + return ((string)(this["appLastDestination"])); + } + set { + this["appLastDestination"] = value; + } + } + } +} diff --git a/Properties/Settings.settings b/GUI/Properties/Settings.settings similarity index 97% rename from Properties/Settings.settings rename to GUI/Properties/Settings.settings index 5ca6b625..0a8838d0 100644 --- a/Properties/Settings.settings +++ b/GUI/Properties/Settings.settings @@ -1,90 +1,90 @@ - - - - - - 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 + + + + + \ No newline at end of file diff --git a/Properties/app.manifest b/GUI/Properties/app.manifest similarity index 98% rename from Properties/app.manifest rename to GUI/Properties/app.manifest index 5d2bdc37..cc922d5e 100644 --- a/Properties/app.manifest +++ b/GUI/Properties/app.manifest @@ -1,56 +1,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/Formats.dat b/GUI/Resources/Formats.dat similarity index 100% rename from Resources/Formats.dat rename to GUI/Resources/Formats.dat diff --git a/Settings.cs b/GUI/Settings.cs similarity index 97% rename from Settings.cs rename to GUI/Settings.cs index cc3aad29..97c648d9 100644 --- a/Settings.cs +++ b/GUI/Settings.cs @@ -1,43 +1,43 @@ -namespace GARbro.GUI.Properties { - - - // This class allows you to handle specific events on the settings class: - // The SettingChanging event is raised before a setting's value is changed. - // The PropertyChanged event is raised after a setting's value is changed. - // The SettingsLoaded event is raised after the setting values are loaded. - // The SettingsSaving event is raised before the setting values are saved. - internal sealed partial class Settings { - - public Settings() { - // // To add event handlers for saving and changing settings, uncomment the lines below: - // - // this.SettingChanging += this.SettingChangingEventHandler; - // - // this.SettingsSaving += this.SettingsSavingEventHandler; - // - this.SettingsLoaded += OnSettingsLoadedHandler; - } - - void OnSettingsLoadedHandler (object sender, System.Configuration.SettingsLoadedEventArgs e) - { - if (Settings.Default.UpgradeRequired) - { - Settings.Default.Upgrade(); - Settings.Default.UpgradeRequired = false; - Settings.Default.Save(); - } - - // do not restore in minimized state - if (Settings.Default.winState == System.Windows.WindowState.Minimized) - Settings.Default.winState = System.Windows.WindowState.Normal; - } - - private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { - // Add code to handle the SettingChangingEvent event here. - } - - private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { - // Add code to handle the SettingsSaving event here. - } - } -} +namespace GARbro.GUI.Properties { + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings { + + public Settings() { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + this.SettingsLoaded += OnSettingsLoadedHandler; + } + + void OnSettingsLoadedHandler (object sender, System.Configuration.SettingsLoadedEventArgs e) + { + if (Settings.Default.UpgradeRequired) + { + Settings.Default.Upgrade(); + Settings.Default.UpgradeRequired = false; + Settings.Default.Save(); + } + + // do not restore in minimized state + if (Settings.Default.winState == System.Windows.WindowState.Minimized) + Settings.Default.winState = System.Windows.WindowState.Normal; + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/Shell.cs b/GUI/Shell.cs similarity index 97% rename from Shell.cs rename to GUI/Shell.cs index b75598cc..0134b362 100644 --- a/Shell.cs +++ b/GUI/Shell.cs @@ -1,345 +1,345 @@ -//! \file Shell.cs -//! \date Tue Aug 02 13:48:55 2011 -//! \brief Win32 shell functions. -// -// Copyright (C) 2011 by poddav -// -// 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.Text; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace GARbro.Shell -{ - /// - /// Wrapper around MoveFileEx WINAPI call. - /// - class File - { - [DllImport("kernel32.dll", EntryPoint="MoveFileExW", SetLastError=true, CharSet=CharSet.Unicode)] - public static extern bool MoveFileEx (string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); - - [Flags] - public enum MoveFileFlags : uint - { - ReplaceExisting = 0x00000001, - CopyAllowed = 0x00000002, - DelayUntilReboot = 0x00000004, - WriteThrough = 0x00000008, - CreateHardlink = 0x00000010, - FailIfNotTrackable = 0x00000020 - } - - public static bool Rename (string szFrom, string szTo) - { - return MoveFileEx (szFrom, szTo, MoveFileFlags.ReplaceExisting); - } - - public static int GetLastError () - { - return Marshal.GetLastWin32Error(); - } - - /// - /// Possible flags for the SHFileOperation method. - /// - [Flags] - public enum FileOperationFlags : ushort - { - /// - /// Do not show a dialog during the process - /// - FOF_SILENT = 0x0004, - /// - /// Do not ask the user to confirm selection - /// - FOF_NOCONFIRMATION = 0x0010, - /// - /// Delete the file to the recycle bin. (Required flag to send a file to the bin - /// - FOF_ALLOWUNDO = 0x0040, - /// - /// Do not show the names of the files or folders that are being recycled. - /// - FOF_SIMPLEPROGRESS = 0x0100, - /// - /// Surpress errors, if any occur during the process. - /// - FOF_NOERRORUI = 0x0400, - /// - /// Warn if files are too big to fit in the recycle bin and will need - /// to be deleted completely. - /// - FOF_WANTNUKEWARNING = 0x4000, - } - - /// - /// File Operation Function Type for SHFileOperation - /// - public enum FileOperationType : uint - { - /// - /// Move the objects - /// - FO_MOVE = 0x0001, - /// - /// Copy the objects - /// - FO_COPY = 0x0002, - /// - /// Delete (or recycle) the objects - /// - FO_DELETE = 0x0003, - /// - /// Rename the object(s) - /// - FO_RENAME = 0x0004, - } - - /// - /// SHFILEOPSTRUCT for SHFileOperation from COM - /// - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] - private struct SHFILEOPSTRUCT - { - - public IntPtr hwnd; - [MarshalAs(UnmanagedType.U4)] - public FileOperationType wFunc; - public string pFrom; - public string pTo; - public FileOperationFlags fFlags; - [MarshalAs(UnmanagedType.Bool)] - public bool fAnyOperationsAborted; - public IntPtr hNameMappings; - public string lpszProgressTitle; - } - - [DllImport("shell32.dll", CharSet = CharSet.Auto)] - private static extern int SHFileOperation (ref SHFILEOPSTRUCT FileOp); - - /// - /// Send file to recycle bin - /// - /// Location of directory or file to recycle - /// FileOperationFlags to add in addition to FOF_ALLOWUNDO - public static bool Delete (string path, FileOperationFlags flags) - { - var fs = new SHFILEOPSTRUCT - { - wFunc = FileOperationType.FO_DELETE, - pFrom = path + '\0' + '\0', - fFlags = FileOperationFlags.FOF_ALLOWUNDO | flags - }; - return 0 == SHFileOperation (ref fs); - } - - public static bool Delete (IEnumerable file_list, FileOperationFlags flags) - { - var files = new StringBuilder(); - foreach (var file in file_list) - { - files.Append (file); - files.Append ('\0'); - } - if (0 == files.Length) - return false; - files.Append ('\0'); - var fs = new SHFILEOPSTRUCT - { - wFunc = FileOperationType.FO_DELETE, - pFrom = files.ToString(), - fFlags = FileOperationFlags.FOF_ALLOWUNDO | flags - }; - return 0 == SHFileOperation (ref fs); - } - - public static bool Delete (IEnumerable file_list) - { - return Delete (file_list, FileOperationFlags.FOF_WANTNUKEWARNING); - } - - /// - /// Send file to recycle bin. Display dialog, display warning if files are too big to fit (FOF_WANTNUKEWARNING) - /// - /// Location of directory or file to recycle - public static bool Delete (string path) - { - return Delete (path, FileOperationFlags.FOF_NOCONFIRMATION | FileOperationFlags.FOF_WANTNUKEWARNING); - } - - /// - /// Send file silently to recycle bin. Surpress dialog, surpress errors, delete if too large. - /// - /// Location of directory or file to recycle - public static bool MoveToRecycleBin (string path) - { - return Delete (path, FileOperationFlags.FOF_NOCONFIRMATION | FileOperationFlags.FOF_NOERRORUI | FileOperationFlags.FOF_SILENT); - - } - } - - public class TemporaryFile : IDisposable - { - private string m_name; - public string Name { get { return m_name; } } - - public TemporaryFile () - { - m_name = Path.GetRandomFileName(); - } - - public TemporaryFile (string filename) - { - m_name = filename; - } - - public TemporaryFile (string path, string filename) - { - m_name = Path.Combine (path, filename); - } - - #region IDisposable Members - bool disposed = false; - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (!disposed) - { - if (disposing) - { - System.IO.File.Delete (m_name); - } - disposed = true; - } - } - #endregion - }; - - /// - /// Wrapper around SHGetFileInfo WINAPI call. - /// - class FileInfo - { - [DllImport("shell32.dll", CharSet=CharSet.Auto)] - public static extern IntPtr SHGetFileInfo( - string pszPath, Int32 dwFileAttributes, - ref SHFILEINFO psfi, int cbFileInfo, int uFlags); - - [DllImport("User32.dll")] - public static extern int DestroyIcon(IntPtr hIcon); - - [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] - public struct SHFILEINFO - { - public IntPtr hIcon; - public int iIcon; - public uint dwAttributes; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string szDisplayName; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] - public string szTypeName; - - public SHFILEINFO(bool b) - { - hIcon = IntPtr.Zero; - iIcon = 0; - dwAttributes = 0; - szDisplayName = ""; - szTypeName = ""; - } - }; - - [Flags] - public enum SHGFI : uint - { - /// get icon - Icon = 0x000000100, - /// get display name - DisplayName = 0x000000200, - /// get type name - TypeName = 0x000000400, - /// get attributes - Attributes = 0x000000800, - /// get icon location - IconLocation = 0x000001000, - /// return exe type - ExeType = 0x000002000, - /// get system icon index - SysIconIndex = 0x000004000, - /// put a link overlay on icon - LinkOverlay = 0x000008000, - /// show icon in selected state - Selected = 0x000010000, - /// get only specified attributes - Attr_Specified = 0x000020000, - /// get large icon - LargeIcon = 0x000000000, - /// get small icon - SmallIcon = 0x000000001, - /// get open icon - OpenIcon = 0x000000002, - /// get shell size icon - ShellIconSize = 0x000000004, - /// pszPath is a pidl - PIDL = 0x000000008, - /// use passed dwFileAttribute - UseFileAttributes= 0x000000010, - /// apply the appropriate overlays - AddOverlays = 0x000000020, - /// Get the index of the overlay in the upper 8 bits of the iIcon - OverlayIndex = 0x000000040, - } - - public static string GetTypeName (string filename) - { - SHFILEINFO info = new SHFILEINFO(true); - int szInfo = Marshal.SizeOf (info); - int result = (int)SHGetFileInfo (filename, 0, ref info, szInfo, (int)SHGFI.TypeName); - - // If uFlags does not contain SHGFI_EXETYPE or SHGFI_SYSICONINDEX, - // the return value is nonzero if successful, or zero otherwise. - if (result != 0) - return info.szTypeName; - else - return string.Empty; - } - - public static SHFILEINFO? GetInfo (string filename, SHGFI flags) - { - SHFILEINFO info = new SHFILEINFO(true); - int szInfo = Marshal.SizeOf (info); - int result = (int)SHGetFileInfo (filename, 0, ref info, szInfo, (int)flags); - - return result != 0? new Nullable (info): null; - } - } -} +//! \file Shell.cs +//! \date Tue Aug 02 13:48:55 2011 +//! \brief Win32 shell functions. +// +// Copyright (C) 2011 by poddav +// +// 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.Text; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace GARbro.Shell +{ + /// + /// Wrapper around MoveFileEx WINAPI call. + /// + class File + { + [DllImport("kernel32.dll", EntryPoint="MoveFileExW", SetLastError=true, CharSet=CharSet.Unicode)] + public static extern bool MoveFileEx (string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); + + [Flags] + public enum MoveFileFlags : uint + { + ReplaceExisting = 0x00000001, + CopyAllowed = 0x00000002, + DelayUntilReboot = 0x00000004, + WriteThrough = 0x00000008, + CreateHardlink = 0x00000010, + FailIfNotTrackable = 0x00000020 + } + + public static bool Rename (string szFrom, string szTo) + { + return MoveFileEx (szFrom, szTo, MoveFileFlags.ReplaceExisting); + } + + public static int GetLastError () + { + return Marshal.GetLastWin32Error(); + } + + /// + /// Possible flags for the SHFileOperation method. + /// + [Flags] + public enum FileOperationFlags : ushort + { + /// + /// Do not show a dialog during the process + /// + FOF_SILENT = 0x0004, + /// + /// Do not ask the user to confirm selection + /// + FOF_NOCONFIRMATION = 0x0010, + /// + /// Delete the file to the recycle bin. (Required flag to send a file to the bin + /// + FOF_ALLOWUNDO = 0x0040, + /// + /// Do not show the names of the files or folders that are being recycled. + /// + FOF_SIMPLEPROGRESS = 0x0100, + /// + /// Surpress errors, if any occur during the process. + /// + FOF_NOERRORUI = 0x0400, + /// + /// Warn if files are too big to fit in the recycle bin and will need + /// to be deleted completely. + /// + FOF_WANTNUKEWARNING = 0x4000, + } + + /// + /// File Operation Function Type for SHFileOperation + /// + public enum FileOperationType : uint + { + /// + /// Move the objects + /// + FO_MOVE = 0x0001, + /// + /// Copy the objects + /// + FO_COPY = 0x0002, + /// + /// Delete (or recycle) the objects + /// + FO_DELETE = 0x0003, + /// + /// Rename the object(s) + /// + FO_RENAME = 0x0004, + } + + /// + /// SHFILEOPSTRUCT for SHFileOperation from COM + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] + private struct SHFILEOPSTRUCT + { + + public IntPtr hwnd; + [MarshalAs(UnmanagedType.U4)] + public FileOperationType wFunc; + public string pFrom; + public string pTo; + public FileOperationFlags fFlags; + [MarshalAs(UnmanagedType.Bool)] + public bool fAnyOperationsAborted; + public IntPtr hNameMappings; + public string lpszProgressTitle; + } + + [DllImport("shell32.dll", CharSet = CharSet.Auto)] + private static extern int SHFileOperation (ref SHFILEOPSTRUCT FileOp); + + /// + /// Send file to recycle bin + /// + /// Location of directory or file to recycle + /// FileOperationFlags to add in addition to FOF_ALLOWUNDO + public static bool Delete (string path, FileOperationFlags flags) + { + var fs = new SHFILEOPSTRUCT + { + wFunc = FileOperationType.FO_DELETE, + pFrom = path + '\0' + '\0', + fFlags = FileOperationFlags.FOF_ALLOWUNDO | flags + }; + return 0 == SHFileOperation (ref fs); + } + + public static bool Delete (IEnumerable file_list, FileOperationFlags flags) + { + var files = new StringBuilder(); + foreach (var file in file_list) + { + files.Append (file); + files.Append ('\0'); + } + if (0 == files.Length) + return false; + files.Append ('\0'); + var fs = new SHFILEOPSTRUCT + { + wFunc = FileOperationType.FO_DELETE, + pFrom = files.ToString(), + fFlags = FileOperationFlags.FOF_ALLOWUNDO | flags + }; + return 0 == SHFileOperation (ref fs); + } + + public static bool Delete (IEnumerable file_list) + { + return Delete (file_list, FileOperationFlags.FOF_WANTNUKEWARNING); + } + + /// + /// Send file to recycle bin. Display dialog, display warning if files are too big to fit (FOF_WANTNUKEWARNING) + /// + /// Location of directory or file to recycle + public static bool Delete (string path) + { + return Delete (path, FileOperationFlags.FOF_NOCONFIRMATION | FileOperationFlags.FOF_WANTNUKEWARNING); + } + + /// + /// Send file silently to recycle bin. Surpress dialog, surpress errors, delete if too large. + /// + /// Location of directory or file to recycle + public static bool MoveToRecycleBin (string path) + { + return Delete (path, FileOperationFlags.FOF_NOCONFIRMATION | FileOperationFlags.FOF_NOERRORUI | FileOperationFlags.FOF_SILENT); + + } + } + + public class TemporaryFile : IDisposable + { + private string m_name; + public string Name { get { return m_name; } } + + public TemporaryFile () + { + m_name = Path.GetRandomFileName(); + } + + public TemporaryFile (string filename) + { + m_name = filename; + } + + public TemporaryFile (string path, string filename) + { + m_name = Path.Combine (path, filename); + } + + #region IDisposable Members + bool disposed = false; + + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose (bool disposing) + { + if (!disposed) + { + if (disposing) + { + System.IO.File.Delete (m_name); + } + disposed = true; + } + } + #endregion + }; + + /// + /// Wrapper around SHGetFileInfo WINAPI call. + /// + class FileInfo + { + [DllImport("shell32.dll", CharSet=CharSet.Auto)] + public static extern IntPtr SHGetFileInfo( + string pszPath, Int32 dwFileAttributes, + ref SHFILEINFO psfi, int cbFileInfo, int uFlags); + + [DllImport("User32.dll")] + public static extern int DestroyIcon(IntPtr hIcon); + + [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] + public struct SHFILEINFO + { + public IntPtr hIcon; + public int iIcon; + public uint dwAttributes; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; + + public SHFILEINFO(bool b) + { + hIcon = IntPtr.Zero; + iIcon = 0; + dwAttributes = 0; + szDisplayName = ""; + szTypeName = ""; + } + }; + + [Flags] + public enum SHGFI : uint + { + /// get icon + Icon = 0x000000100, + /// get display name + DisplayName = 0x000000200, + /// get type name + TypeName = 0x000000400, + /// get attributes + Attributes = 0x000000800, + /// get icon location + IconLocation = 0x000001000, + /// return exe type + ExeType = 0x000002000, + /// get system icon index + SysIconIndex = 0x000004000, + /// put a link overlay on icon + LinkOverlay = 0x000008000, + /// show icon in selected state + Selected = 0x000010000, + /// get only specified attributes + Attr_Specified = 0x000020000, + /// get large icon + LargeIcon = 0x000000000, + /// get small icon + SmallIcon = 0x000000001, + /// get open icon + OpenIcon = 0x000000002, + /// get shell size icon + ShellIconSize = 0x000000004, + /// pszPath is a pidl + PIDL = 0x000000008, + /// use passed dwFileAttribute + UseFileAttributes= 0x000000010, + /// apply the appropriate overlays + AddOverlays = 0x000000020, + /// Get the index of the overlay in the upper 8 bits of the iIcon + OverlayIndex = 0x000000040, + } + + public static string GetTypeName (string filename) + { + SHFILEINFO info = new SHFILEINFO(true); + int szInfo = Marshal.SizeOf (info); + int result = (int)SHGetFileInfo (filename, 0, ref info, szInfo, (int)SHGFI.TypeName); + + // If uFlags does not contain SHGFI_EXETYPE or SHGFI_SYSICONINDEX, + // the return value is nonzero if successful, or zero otherwise. + if (result != 0) + return info.szTypeName; + else + return string.Empty; + } + + public static SHFILEINFO? GetInfo (string filename, SHGFI flags) + { + SHFILEINFO info = new SHFILEINFO(true); + int szInfo = Marshal.SizeOf (info); + int result = (int)SHGetFileInfo (filename, 0, ref info, szInfo, (int)flags); + + return result != 0? new Nullable (info): null; + } + } +} diff --git a/Strings/guiStrings.Designer.cs b/GUI/Strings/guiStrings.Designer.cs similarity index 97% rename from Strings/guiStrings.Designer.cs rename to GUI/Strings/guiStrings.Designer.cs index ae8586f9..b2955d1f 100644 --- a/Strings/guiStrings.Designer.cs +++ b/GUI/Strings/guiStrings.Designer.cs @@ -1,1049 +1,1049 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34209 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GARbro.GUI.Strings { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class guiStrings { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal guiStrings() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GARbro.GUI.Strings.guiStrings", typeof(guiStrings).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Cancel. - /// - public static string ButtonCancel { - get { - return ResourceManager.GetString("ButtonCancel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Convert. - /// - public static string ButtonConvert { - get { - return ResourceManager.GetString("ButtonConvert", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract. - /// - public static string ButtonExtract { - get { - return ResourceManager.GetString("ButtonExtract", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to OK. - /// - public static string ButtonOK { - get { - return ResourceManager.GetString("ButtonOK", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _Close. - /// - public static string CtxMenuClose { - get { - return ResourceManager.GetString("CtxMenuClose", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Convert multimedia.... - /// - public static string CtxMenuConvert { - get { - return ResourceManager.GetString("CtxMenuConvert", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Copy. - /// - public static string CtxMenuCopy { - get { - return ResourceManager.GetString("CtxMenuCopy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Create archive.... - /// - public static string CtxMenuCreate { - get { - return ResourceManager.GetString("CtxMenuCreate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cut. - /// - public static string CtxMenuCut { - get { - return ResourceManager.GetString("CtxMenuCut", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _Delete. - /// - public static string CtxMenuDelete { - get { - return ResourceManager.GetString("CtxMenuDelete", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Browse in _Explorer. - /// - public static string CtxMenuExplorer { - get { - return ResourceManager.GetString("CtxMenuExplorer", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract. - /// - public static string CtxMenuExtract { - get { - return ResourceManager.GetString("CtxMenuExtract", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Assign file type. - /// - public static string CtxMenuFileType { - get { - return ResourceManager.GetString("CtxMenuFileType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open. - /// - public static string CtxMenuOpen { - get { - return ResourceManager.GetString("CtxMenuOpen", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Paste. - /// - public static string CtxMenuPaste { - get { - return ResourceManager.GetString("CtxMenuPaste", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Refresh. - /// - public static string CtxMenuRefresh { - get { - return ResourceManager.GetString("CtxMenuRefresh", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _Rename. - /// - public static string CtxMenuRename { - get { - return ResourceManager.GetString("CtxMenuRename", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Sort by. - /// - public static string CtxMenuSortBy { - get { - return ResourceManager.GetString("CtxMenuSortBy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Name. - /// - public static string CtxMenuSortByName { - get { - return ResourceManager.GetString("CtxMenuSortByName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size. - /// - public static string CtxMenuSortBySize { - get { - return ResourceManager.GetString("CtxMenuSortBySize", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type. - /// - public static string CtxMenuSortByType { - get { - return ResourceManager.GetString("CtxMenuSortByType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unsorted. - /// - public static string CtxMenuUnsorted { - get { - return ResourceManager.GetString("CtxMenuUnsorted", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Name. - /// - public static string HeaderName { - get { - return ResourceManager.GetString("HeaderName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size. - /// - public static string HeaderSize { - get { - return ResourceManager.GetString("HeaderSize", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type. - /// - public static string HeaderType { - get { - return ResourceManager.GetString("HeaderType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archive format. - /// - public static string LabelArchiveFormat { - get { - return ResourceManager.GetString("LabelArchiveFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archive name. - /// - public static string LabelArchiveName { - get { - return ResourceManager.GetString("LabelArchiveName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archive options. - /// - public static string LabelArchiveOptions { - get { - return ResourceManager.GetString("LabelArchiveOptions", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose destination format for images. - /// - public static string LabelDestinationFormat { - get { - return ResourceManager.GetString("LabelDestinationFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Encoding. - /// - public static string LabelEncoding { - get { - return ResourceManager.GetString("LabelEncoding", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enter wildcard mask. - /// - public static string LabelEnterMask { - get { - return ResourceManager.GetString("LabelEnterMask", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract files from {0} to. - /// - public static string LabelExtractAllTo { - get { - return ResourceManager.GetString("LabelExtractAllTo", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract {0} to. - /// - public static string LabelExtractFileTo { - get { - return ResourceManager.GetString("LabelExtractFileTo", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Skip incovertible files.. - /// - public static string LabelSkipFailures { - get { - return ResourceManager.GetString("LabelSkipFailures", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About Game Resource browser. - /// - public static string MenuAbout { - get { - return ResourceManager.GetString("MenuAbout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to E_xit. - /// - public static string MenuExit { - get { - return ResourceManager.GetString("MenuExit", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _File. - /// - public static string MenuFile { - get { - return ResourceManager.GetString("MenuFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Fit preview _window to image. - /// - public static string MenuFitWindow { - get { - return ResourceManager.GetString("MenuFitWindow", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _Help. - /// - public static string MenuHelp { - get { - return ResourceManager.GetString("MenuHelp", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open.... - /// - public static string MenuOpen { - get { - return ResourceManager.GetString("MenuOpen", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Recent files. - /// - public static string MenuRecent { - get { - return ResourceManager.GetString("MenuRecent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show/hide main _menu bar. - /// - public static string MenuToggleMenuBar { - get { - return ResourceManager.GetString("MenuToggleMenuBar", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show/hide _status bar. - /// - public static string MenuToggleStatusBar { - get { - return ResourceManager.GetString("MenuToggleStatusBar", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show/hide _toolbar. - /// - public static string MenuToggleToolBar { - get { - return ResourceManager.GetString("MenuToggleToolBar", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to _View. - /// - public static string MenuView { - get { - return ResourceManager.GetString("MenuView", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose files to extract. - /// - public static string MsgChooseFiles { - get { - return ResourceManager.GetString("MsgChooseFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Are you sure you want to delete these files?. - /// - public static string MsgConfirmDeleteFiles { - get { - return ResourceManager.GetString("MsgConfirmDeleteFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Converting file {0}. - /// - public static string MsgConvertingFile { - get { - return ResourceManager.GetString("MsgConvertingFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Creating archive {0}. - /// - public static string MsgCreatingArchive { - get { - return ResourceManager.GetString("MsgCreatingArchive", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Deleted {0}. - /// - public static string MsgDeletedItem { - get { - return ResourceManager.GetString("MsgDeletedItem", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Deleted {0} file. - /// - public static string MsgDeletedItems1 { - get { - return ResourceManager.GetString("MsgDeletedItems1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Deleted {0} files. - /// - public static string MsgDeletedItems2 { - get { - return ResourceManager.GetString("MsgDeletedItems2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to directory not found. - /// - public static string MsgDirectoryNotFound { - get { - return ResourceManager.GetString("MsgDirectoryNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to archive is empty. - /// - public static string MsgEmptyArchive { - get { - return ResourceManager.GetString("MsgEmptyArchive", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Error extracting file. - /// - public static string MsgErrorExtracting { - get { - return ResourceManager.GetString("MsgErrorExtracting", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Error opening file. - /// - public static string MsgErrorOpening { - get { - return ResourceManager.GetString("MsgErrorOpening", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracted {0} into {1}. - /// - public static string MsgExtractComplete { - get { - return ResourceManager.GetString("MsgExtractComplete", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracted {0} file. - /// - public static string MsgExtractedFiles1 { - get { - return ResourceManager.GetString("MsgExtractedFiles1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracted {0} files. - /// - public static string MsgExtractedFiles2 { - get { - return ResourceManager.GetString("MsgExtractedFiles2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracting files from {0}. - /// - public static string MsgExtractingArchive { - get { - return ResourceManager.GetString("MsgExtractingArchive", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracting file from {0}. - /// - public static string MsgExtractingFile { - get { - return ResourceManager.GetString("MsgExtractingFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extracting files from {0} to {1}. - /// - public static string MsgExtractingTo { - get { - return ResourceManager.GetString("MsgExtractingTo", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} file. - /// - public static string MsgFiles1 { - get { - return ResourceManager.GetString("MsgFiles1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} files. - /// - public static string MsgFiles2 { - get { - return ResourceManager.GetString("MsgFiles2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Image {0} x {1} x {2}bpp. - /// - public static string MsgImageSize { - get { - return ResourceManager.GetString("MsgImageSize", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to no files to extract. - /// - public static string MsgNoFiles { - get { - return ResourceManager.GetString("MsgNoFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No entries matching "{0}". - /// - public static string MsgNoMatching { - get { - return ResourceManager.GetString("MsgNoMatching", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No media files selected.. - /// - public static string MsgNoMediaFiles { - get { - return ResourceManager.GetString("MsgNoMediaFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File {0} - ///already exists. - /// - ///Overwrite?. - /// - public static string MsgOverwrite { - get { - return ResourceManager.GetString("MsgOverwrite", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ready. - /// - public static string MsgReady { - get { - return ResourceManager.GetString("MsgReady", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} file added to selection. - /// - public static string MsgSelectedFiles1 { - get { - return ResourceManager.GetString("MsgSelectedFiles1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} files added to selection. - /// - public static string MsgSelectedFiles2 { - get { - return ResourceManager.GetString("MsgSelectedFiles2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to unable to interpret audio format. - /// - public static string MsgUnableInterpretAudio { - get { - return ResourceManager.GetString("MsgUnableInterpretAudio", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to unable to interpret image format. - /// - public static string MsgUnableInterpretImage { - get { - return ResourceManager.GetString("MsgUnableInterpretImage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Version {0}. - /// - public static string MsgVersion { - get { - return ResourceManager.GetString("MsgVersion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archives. - /// - public static string TextAboutArchives { - get { - return ResourceManager.GetString("TextAboutArchives", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Audio. - /// - public static string TextAboutAudio { - get { - return ResourceManager.GetString("TextAboutAudio", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [builtin]. - /// - public static string TextAboutBuiltin { - get { - return ResourceManager.GetString("TextAboutBuiltin", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Images. - /// - public static string TextAboutImages { - get { - return ResourceManager.GetString("TextAboutImages", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to License. - /// - public static string TextAboutLicense { - get { - return ResourceManager.GetString("TextAboutLicense", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About Game Resource browser. - /// - public static string TextAboutTitle { - get { - return ResourceManager.GetString("TextAboutTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to All Files. - /// - public static string TextAllFiles { - get { - return ResourceManager.GetString("TextAllFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to as is. - /// - public static string TextAsIs { - get { - return ResourceManager.GetString("TextAsIs", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Audio will be converted to either WAV, MP3 or OGG.. - /// - public static string TextAudioConversion { - get { - return ResourceManager.GetString("TextAudioConversion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose archive location. - /// - public static string TextChooseArchive { - get { - return ResourceManager.GetString("TextChooseArchive", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose destination directory. - /// - public static string TextChooseDestDir { - get { - return ResourceManager.GetString("TextChooseDestDir", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Confirm overwrite. - /// - public static string TextConfirmOverwrite { - get { - return ResourceManager.GetString("TextConfirmOverwrite", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Convert audio to common format. - /// - public static string TextConvertAudio { - get { - return ResourceManager.GetString("TextConvertAudio", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Media conversion. - /// - public static string TextConvertMedia { - get { - return ResourceManager.GetString("TextConvertMedia", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Create archive. - /// - public static string TextCreateArchive { - get { - return ResourceManager.GetString("TextCreateArchive", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archive creation error. - /// - public static string TextCreateArchiveError { - get { - return ResourceManager.GetString("TextCreateArchiveError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete files. - /// - public static string TextDeleteFiles { - get { - return ResourceManager.GetString("TextDeleteFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Text encoding. - /// - public static string TextEncoding { - get { - return ResourceManager.GetString("TextEncoding", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Error occured while extracting file - ///{0} - ///{1}. - /// - public static string TextErrorExtracting { - get { - return ResourceManager.GetString("TextErrorExtracting", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract audio. - /// - public static string TextExtractAudio { - get { - return ResourceManager.GetString("TextExtractAudio", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract images. - /// - public static string TextExtractImages { - get { - return ResourceManager.GetString("TextExtractImages", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract text. - /// - public static string TextExtractText { - get { - return ResourceManager.GetString("TextExtractText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Extract from archive. - /// - public static string TextExtractTitle { - get { - return ResourceManager.GetString("TextExtractTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multimedia conversion error. - /// - public static string TextMediaConvertError { - get { - return ResourceManager.GetString("TextMediaConvertError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Archive parameters. - /// - public static string TextParametersTitle { - get { - return ResourceManager.GetString("TextParametersTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save as. - /// - public static string TextSaveAs { - get { - return ResourceManager.GetString("TextSaveAs", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save images as. - /// - public static string TextSaveImagesAs { - get { - return ResourceManager.GetString("TextSaveImagesAs", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select files. - /// - public static string TextSelectFiles { - get { - return ResourceManager.GetString("TextSelectFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Game Resource browser. - /// - public static string TextTitle { - get { - return ResourceManager.GetString("TextTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Either WAV, MP3 or OGG. - /// - public static string TooltipAudioFormats { - get { - return ResourceManager.GetString("TooltipAudioFormats", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Back. - /// - public static string TooltipBack { - get { - return ResourceManager.GetString("TooltipBack", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forward. - /// - public static string TooltipForward { - get { - return ResourceManager.GetString("TooltipForward", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <DIR>. - /// - public static string Type_directory { - get { - return ResourceManager.GetString("Type_directory", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to none. - /// - public static string Type_NONE { - get { - return ResourceManager.GetString("Type_NONE", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GARbro.GUI.Strings { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class guiStrings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal guiStrings() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GARbro.GUI.Strings.guiStrings", typeof(guiStrings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + public static string ButtonCancel { + get { + return ResourceManager.GetString("ButtonCancel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Convert. + /// + public static string ButtonConvert { + get { + return ResourceManager.GetString("ButtonConvert", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract. + /// + public static string ButtonExtract { + get { + return ResourceManager.GetString("ButtonExtract", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OK. + /// + public static string ButtonOK { + get { + return ResourceManager.GetString("ButtonOK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Close. + /// + public static string CtxMenuClose { + get { + return ResourceManager.GetString("CtxMenuClose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Convert multimedia.... + /// + public static string CtxMenuConvert { + get { + return ResourceManager.GetString("CtxMenuConvert", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy. + /// + public static string CtxMenuCopy { + get { + return ResourceManager.GetString("CtxMenuCopy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create archive.... + /// + public static string CtxMenuCreate { + get { + return ResourceManager.GetString("CtxMenuCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cut. + /// + public static string CtxMenuCut { + get { + return ResourceManager.GetString("CtxMenuCut", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Delete. + /// + public static string CtxMenuDelete { + get { + return ResourceManager.GetString("CtxMenuDelete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Browse in _Explorer. + /// + public static string CtxMenuExplorer { + get { + return ResourceManager.GetString("CtxMenuExplorer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract. + /// + public static string CtxMenuExtract { + get { + return ResourceManager.GetString("CtxMenuExtract", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Assign file type. + /// + public static string CtxMenuFileType { + get { + return ResourceManager.GetString("CtxMenuFileType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Open. + /// + public static string CtxMenuOpen { + get { + return ResourceManager.GetString("CtxMenuOpen", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Paste. + /// + public static string CtxMenuPaste { + get { + return ResourceManager.GetString("CtxMenuPaste", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Refresh. + /// + public static string CtxMenuRefresh { + get { + return ResourceManager.GetString("CtxMenuRefresh", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Rename. + /// + public static string CtxMenuRename { + get { + return ResourceManager.GetString("CtxMenuRename", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sort by. + /// + public static string CtxMenuSortBy { + get { + return ResourceManager.GetString("CtxMenuSortBy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name. + /// + public static string CtxMenuSortByName { + get { + return ResourceManager.GetString("CtxMenuSortByName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Size. + /// + public static string CtxMenuSortBySize { + get { + return ResourceManager.GetString("CtxMenuSortBySize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type. + /// + public static string CtxMenuSortByType { + get { + return ResourceManager.GetString("CtxMenuSortByType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unsorted. + /// + public static string CtxMenuUnsorted { + get { + return ResourceManager.GetString("CtxMenuUnsorted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name. + /// + public static string HeaderName { + get { + return ResourceManager.GetString("HeaderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Size. + /// + public static string HeaderSize { + get { + return ResourceManager.GetString("HeaderSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type. + /// + public static string HeaderType { + get { + return ResourceManager.GetString("HeaderType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archive format. + /// + public static string LabelArchiveFormat { + get { + return ResourceManager.GetString("LabelArchiveFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archive name. + /// + public static string LabelArchiveName { + get { + return ResourceManager.GetString("LabelArchiveName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archive options. + /// + public static string LabelArchiveOptions { + get { + return ResourceManager.GetString("LabelArchiveOptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose destination format for images. + /// + public static string LabelDestinationFormat { + get { + return ResourceManager.GetString("LabelDestinationFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Encoding. + /// + public static string LabelEncoding { + get { + return ResourceManager.GetString("LabelEncoding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enter wildcard mask. + /// + public static string LabelEnterMask { + get { + return ResourceManager.GetString("LabelEnterMask", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract files from {0} to. + /// + public static string LabelExtractAllTo { + get { + return ResourceManager.GetString("LabelExtractAllTo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract {0} to. + /// + public static string LabelExtractFileTo { + get { + return ResourceManager.GetString("LabelExtractFileTo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skip incovertible files.. + /// + public static string LabelSkipFailures { + get { + return ResourceManager.GetString("LabelSkipFailures", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to About Game Resource browser. + /// + public static string MenuAbout { + get { + return ResourceManager.GetString("MenuAbout", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to E_xit. + /// + public static string MenuExit { + get { + return ResourceManager.GetString("MenuExit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _File. + /// + public static string MenuFile { + get { + return ResourceManager.GetString("MenuFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Fit preview _window to image. + /// + public static string MenuFitWindow { + get { + return ResourceManager.GetString("MenuFitWindow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Help. + /// + public static string MenuHelp { + get { + return ResourceManager.GetString("MenuHelp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Open.... + /// + public static string MenuOpen { + get { + return ResourceManager.GetString("MenuOpen", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Recent files. + /// + public static string MenuRecent { + get { + return ResourceManager.GetString("MenuRecent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Show/hide main _menu bar. + /// + public static string MenuToggleMenuBar { + get { + return ResourceManager.GetString("MenuToggleMenuBar", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Show/hide _status bar. + /// + public static string MenuToggleStatusBar { + get { + return ResourceManager.GetString("MenuToggleStatusBar", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Show/hide _toolbar. + /// + public static string MenuToggleToolBar { + get { + return ResourceManager.GetString("MenuToggleToolBar", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _View. + /// + public static string MenuView { + get { + return ResourceManager.GetString("MenuView", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose files to extract. + /// + public static string MsgChooseFiles { + get { + return ResourceManager.GetString("MsgChooseFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete these files?. + /// + public static string MsgConfirmDeleteFiles { + get { + return ResourceManager.GetString("MsgConfirmDeleteFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Converting file {0}. + /// + public static string MsgConvertingFile { + get { + return ResourceManager.GetString("MsgConvertingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating archive {0}. + /// + public static string MsgCreatingArchive { + get { + return ResourceManager.GetString("MsgCreatingArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted {0}. + /// + public static string MsgDeletedItem { + get { + return ResourceManager.GetString("MsgDeletedItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted {0} file. + /// + public static string MsgDeletedItems1 { + get { + return ResourceManager.GetString("MsgDeletedItems1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted {0} files. + /// + public static string MsgDeletedItems2 { + get { + return ResourceManager.GetString("MsgDeletedItems2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to directory not found. + /// + public static string MsgDirectoryNotFound { + get { + return ResourceManager.GetString("MsgDirectoryNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to archive is empty. + /// + public static string MsgEmptyArchive { + get { + return ResourceManager.GetString("MsgEmptyArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error extracting file. + /// + public static string MsgErrorExtracting { + get { + return ResourceManager.GetString("MsgErrorExtracting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error opening file. + /// + public static string MsgErrorOpening { + get { + return ResourceManager.GetString("MsgErrorOpening", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracted {0} into {1}. + /// + public static string MsgExtractComplete { + get { + return ResourceManager.GetString("MsgExtractComplete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracted {0} file. + /// + public static string MsgExtractedFiles1 { + get { + return ResourceManager.GetString("MsgExtractedFiles1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracted {0} files. + /// + public static string MsgExtractedFiles2 { + get { + return ResourceManager.GetString("MsgExtractedFiles2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracting files from {0}. + /// + public static string MsgExtractingArchive { + get { + return ResourceManager.GetString("MsgExtractingArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracting file from {0}. + /// + public static string MsgExtractingFile { + get { + return ResourceManager.GetString("MsgExtractingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracting files from {0} to {1}. + /// + public static string MsgExtractingTo { + get { + return ResourceManager.GetString("MsgExtractingTo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} file. + /// + public static string MsgFiles1 { + get { + return ResourceManager.GetString("MsgFiles1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} files. + /// + public static string MsgFiles2 { + get { + return ResourceManager.GetString("MsgFiles2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Image {0} x {1} x {2}bpp. + /// + public static string MsgImageSize { + get { + return ResourceManager.GetString("MsgImageSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to no files to extract. + /// + public static string MsgNoFiles { + get { + return ResourceManager.GetString("MsgNoFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No entries matching "{0}". + /// + public static string MsgNoMatching { + get { + return ResourceManager.GetString("MsgNoMatching", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No media files selected.. + /// + public static string MsgNoMediaFiles { + get { + return ResourceManager.GetString("MsgNoMediaFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} + ///already exists. + /// + ///Overwrite?. + /// + public static string MsgOverwrite { + get { + return ResourceManager.GetString("MsgOverwrite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ready. + /// + public static string MsgReady { + get { + return ResourceManager.GetString("MsgReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} file added to selection. + /// + public static string MsgSelectedFiles1 { + get { + return ResourceManager.GetString("MsgSelectedFiles1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} files added to selection. + /// + public static string MsgSelectedFiles2 { + get { + return ResourceManager.GetString("MsgSelectedFiles2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to unable to interpret audio format. + /// + public static string MsgUnableInterpretAudio { + get { + return ResourceManager.GetString("MsgUnableInterpretAudio", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to unable to interpret image format. + /// + public static string MsgUnableInterpretImage { + get { + return ResourceManager.GetString("MsgUnableInterpretImage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version {0}. + /// + public static string MsgVersion { + get { + return ResourceManager.GetString("MsgVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archives. + /// + public static string TextAboutArchives { + get { + return ResourceManager.GetString("TextAboutArchives", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Audio. + /// + public static string TextAboutAudio { + get { + return ResourceManager.GetString("TextAboutAudio", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [builtin]. + /// + public static string TextAboutBuiltin { + get { + return ResourceManager.GetString("TextAboutBuiltin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Images. + /// + public static string TextAboutImages { + get { + return ResourceManager.GetString("TextAboutImages", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to License. + /// + public static string TextAboutLicense { + get { + return ResourceManager.GetString("TextAboutLicense", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to About Game Resource browser. + /// + public static string TextAboutTitle { + get { + return ResourceManager.GetString("TextAboutTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All Files. + /// + public static string TextAllFiles { + get { + return ResourceManager.GetString("TextAllFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to as is. + /// + public static string TextAsIs { + get { + return ResourceManager.GetString("TextAsIs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Audio will be converted to either WAV, MP3 or OGG.. + /// + public static string TextAudioConversion { + get { + return ResourceManager.GetString("TextAudioConversion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose archive location. + /// + public static string TextChooseArchive { + get { + return ResourceManager.GetString("TextChooseArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose destination directory. + /// + public static string TextChooseDestDir { + get { + return ResourceManager.GetString("TextChooseDestDir", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm overwrite. + /// + public static string TextConfirmOverwrite { + get { + return ResourceManager.GetString("TextConfirmOverwrite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Convert audio to common format. + /// + public static string TextConvertAudio { + get { + return ResourceManager.GetString("TextConvertAudio", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Media conversion. + /// + public static string TextConvertMedia { + get { + return ResourceManager.GetString("TextConvertMedia", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create archive. + /// + public static string TextCreateArchive { + get { + return ResourceManager.GetString("TextCreateArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archive creation error. + /// + public static string TextCreateArchiveError { + get { + return ResourceManager.GetString("TextCreateArchiveError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete files. + /// + public static string TextDeleteFiles { + get { + return ResourceManager.GetString("TextDeleteFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Text encoding. + /// + public static string TextEncoding { + get { + return ResourceManager.GetString("TextEncoding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error occured while extracting file + ///{0} + ///{1}. + /// + public static string TextErrorExtracting { + get { + return ResourceManager.GetString("TextErrorExtracting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract audio. + /// + public static string TextExtractAudio { + get { + return ResourceManager.GetString("TextExtractAudio", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract images. + /// + public static string TextExtractImages { + get { + return ResourceManager.GetString("TextExtractImages", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract text. + /// + public static string TextExtractText { + get { + return ResourceManager.GetString("TextExtractText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extract from archive. + /// + public static string TextExtractTitle { + get { + return ResourceManager.GetString("TextExtractTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multimedia conversion error. + /// + public static string TextMediaConvertError { + get { + return ResourceManager.GetString("TextMediaConvertError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Archive parameters. + /// + public static string TextParametersTitle { + get { + return ResourceManager.GetString("TextParametersTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save as. + /// + public static string TextSaveAs { + get { + return ResourceManager.GetString("TextSaveAs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save images as. + /// + public static string TextSaveImagesAs { + get { + return ResourceManager.GetString("TextSaveImagesAs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Select files. + /// + public static string TextSelectFiles { + get { + return ResourceManager.GetString("TextSelectFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Game Resource browser. + /// + public static string TextTitle { + get { + return ResourceManager.GetString("TextTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Either WAV, MP3 or OGG. + /// + public static string TooltipAudioFormats { + get { + return ResourceManager.GetString("TooltipAudioFormats", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Back. + /// + public static string TooltipBack { + get { + return ResourceManager.GetString("TooltipBack", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Forward. + /// + public static string TooltipForward { + get { + return ResourceManager.GetString("TooltipForward", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <DIR>. + /// + public static string Type_directory { + get { + return ResourceManager.GetString("Type_directory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string Type_NONE { + get { + return ResourceManager.GetString("Type_NONE", resourceCulture); + } + } + } +} diff --git a/Strings/guiStrings.ko-KR.resx b/GUI/Strings/guiStrings.ko-KR.resx similarity index 100% rename from Strings/guiStrings.ko-KR.resx rename to GUI/Strings/guiStrings.ko-KR.resx diff --git a/Strings/guiStrings.resx b/GUI/Strings/guiStrings.resx similarity index 97% rename from Strings/guiStrings.resx rename to GUI/Strings/guiStrings.resx index 9ed61ce3..270ee6ea 100644 --- a/Strings/guiStrings.resx +++ b/GUI/Strings/guiStrings.resx @@ -1,452 +1,452 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Cancel - - - Extract - - - OK - - - _Close - - - Copy - - - Create archive... - - - Cut - - - _Delete - - - Browse in _Explorer - - - Extract - - - Open - - - Paste - - - Refresh - - - _Rename - - - Sort by - - - Name - - - Size - - - Type - - - Unsorted - - - Name - - - Size - - - Type - - - Archive format - - - Archive name - - - Archive options - - - Extract files from {0} to - - - Extract {0} to - - - About Game Resource browser - - - Deleted {0} - - - directory not found - - - archive is empty - - - Error extracting file - - - Error opening file - - - Extracted {0} into {1} - - - Extracted {0} file - - - Extracting files from {0} - - - Extracting file from {0} - - - Extracting files from {0} to {1} - - - Image {0} x {1} x {2}bpp - - - no files to extract - - - Ready - - - unable to interpret image format - - - Version {0} - - - [builtin] - - - Archives - - - Images - - - About Game Resource browser - - - All Files - - - as is - - - Choose archive location - - - Choose destination directory - - - Create archive - - - Archive creation error - - - <DIR> - - - Text encoding - - - Extract images - - - Extract text - - - Extract from archive - - - Archive parameters - - - Save as - - - Save images as - - - Game Resource browser - - - Back - - - Forward - - - File {0} -already exists. - -Overwrite? - - - Confirm overwrite - - - Creating archive {0} - - - Open... - - - Recent files - - - Choose files to extract - - - E_xit - - - _File - - - _Help - - - Extracted {0} files - - - {0} file - - - {0} files - - - Are you sure you want to delete these files? - - - Delete files - - - Deleted {0} file - - - Deleted {0} files - - - Fit preview _window to image - - - Show/hide main _menu bar - - - Show/hide _status bar - - - Show/hide _toolbar - - - _View - - - Convert multimedia... - - - Convert - - - Choose destination format for images - - - Media conversion - - - Converting file {0} - - - Multimedia conversion error - - - Encoding - - - Convert audio to common format - - - Extract audio - - - Either WAV, MP3 or OGG - - - Audio - - - License - - - unable to interpret audio format - - - No media files selected. - - - Audio will be converted to either WAV, MP3 or OGG. - - - Skip incovertible files. - - - No entries matching "{0}" - - - {0} file added to selection - - - {0} files added to selection - - - Enter wildcard mask - - - Select files - - - Error occured while extracting file -{0} -{1} - - - Assign file type - - - none - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + Extract + + + OK + + + _Close + + + Copy + + + Create archive... + + + Cut + + + _Delete + + + Browse in _Explorer + + + Extract + + + Open + + + Paste + + + Refresh + + + _Rename + + + Sort by + + + Name + + + Size + + + Type + + + Unsorted + + + Name + + + Size + + + Type + + + Archive format + + + Archive name + + + Archive options + + + Extract files from {0} to + + + Extract {0} to + + + About Game Resource browser + + + Deleted {0} + + + directory not found + + + archive is empty + + + Error extracting file + + + Error opening file + + + Extracted {0} into {1} + + + Extracted {0} file + + + Extracting files from {0} + + + Extracting file from {0} + + + Extracting files from {0} to {1} + + + Image {0} x {1} x {2}bpp + + + no files to extract + + + Ready + + + unable to interpret image format + + + Version {0} + + + [builtin] + + + Archives + + + Images + + + About Game Resource browser + + + All Files + + + as is + + + Choose archive location + + + Choose destination directory + + + Create archive + + + Archive creation error + + + <DIR> + + + Text encoding + + + Extract images + + + Extract text + + + Extract from archive + + + Archive parameters + + + Save as + + + Save images as + + + Game Resource browser + + + Back + + + Forward + + + File {0} +already exists. + +Overwrite? + + + Confirm overwrite + + + Creating archive {0} + + + Open... + + + Recent files + + + Choose files to extract + + + E_xit + + + _File + + + _Help + + + Extracted {0} files + + + {0} file + + + {0} files + + + Are you sure you want to delete these files? + + + Delete files + + + Deleted {0} file + + + Deleted {0} files + + + Fit preview _window to image + + + Show/hide main _menu bar + + + Show/hide _status bar + + + Show/hide _toolbar + + + _View + + + Convert multimedia... + + + Convert + + + Choose destination format for images + + + Media conversion + + + Converting file {0} + + + Multimedia conversion error + + + Encoding + + + Convert audio to common format + + + Extract audio + + + Either WAV, MP3 or OGG + + + Audio + + + License + + + unable to interpret audio format + + + No media files selected. + + + Audio will be converted to either WAV, MP3 or OGG. + + + Skip incovertible files. + + + No entries matching "{0}" + + + {0} file added to selection + + + {0} files added to selection + + + Enter wildcard mask + + + Select files + + + Error occured while extracting file +{0} +{1} + + + Assign file type + + + none + \ No newline at end of file diff --git a/Strings/guiStrings.ru-RU.resx b/GUI/Strings/guiStrings.ru-RU.resx similarity index 97% rename from Strings/guiStrings.ru-RU.resx rename to GUI/Strings/guiStrings.ru-RU.resx index 841efeb7..20682e3c 100644 --- a/Strings/guiStrings.ru-RU.resx +++ b/GUI/Strings/guiStrings.ru-RU.resx @@ -1,473 +1,473 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Отмена - - - Извлечь - - - _Закрыть - - - Копировать - - - Создать архив... - - - Вырезать - - - Удалить - - - Просмотр в Explorer - - - Извлечь - - - Открыть - - - Вставить - - - Обновить - - - Переименовать - - - Сортировка - - - по имени - - - по размеру - - - по типу - - - не сортировать - - - Имя - - - Размер - - - Тип - - - Формат архива - - - Имя архива - - - Настройки архивирования - - - Извлечь файлы из {0} в - - - Извлечь {0} в - - - О программе - - - Удалён файл {0} - - - каталог не найден - - - архив пуст - - - Ошибка извлечения файла - - - Ошибка открытия файла - - - {0} извлечён в {1} - - - Извлекаются файлы из {0} - - - Файл извлекается из {0} - - - Извлекаются файлы из {0} в {1} - - - Изображение {0} x {1} x {2}bpp - - - отсутствуют файлы, удовлетворяющие выбранным критериям - - - Готов - - - не удалось интерпретировать формат изображения - - - Версия {0} - - - [встроен] - - - Архивы - - - Изображения - - - Об обозревателе игровых ресурсов - - - Все файлы - - - исходном - - - Выберите месторасположение архива - - - Выберите место извлечения - - - Создать архив - - - Ошибка при создании архива - - - Кодировка текста - - - Извлекать изображения - - - Извлекать текст - - - Извлечь из архива - - - OK - - - Параметры архива - - - Сохранить в формате - - - Сохранить в формате - - - Обозреватель игровых ресурсов - - - Назад - - - Вперёд - - - Файл под именем '{0}' -уже существует. - -Перезаписать? - - - Подтвердите перезапись - - - Создание архива {0} - - - архив - - - изображение - - - сценарий - - - Открыть... - - - Недавние файлы - - - Выберите файлы для извлечения - - - Выход - - - _Файл - - - _Справка - - - Извлечён {0} файл - - - Извлечено {0} файла - - - Извлечено {0} файлов - - - {0} файл - - - {0} файла - - - {0} файлов - - - Вы действительно хотите удалить эти файлы? - - - Удалить файлы - - - Удалён {0} файл - - - Удалено {0} файла - - - Удалено {0} файлов - - - Подогнать размер окна под изображение - - - Вкл/выкл главное меню - - - Вкл/выкл полосу статуса - - - Вкл/выкл панель инструментов - - - Просмотр - - - Конверсия мультимедиа... - - - Преобразовать - - - Формат преобразования изображений - - - Преобразование мультимедиа - - - Преобразование файла {0} - - - Ошибка конверсии мультимедиа - - - Кодировка - - - Преобразовывать аудио в стандартный формат - - - Извлекать аудио - - - WAV, MP3, либо OGG - - - Аудио - - - Лицензия - - - звук - - - не удалось интерпретировать формат аудио - - - Пропускать файлы, не поддавшиеся конверсии. - - - Среди выбранных файлов нет мультимедиа. - - - Аудио-файлы будут преобразованы в WAV, MP3 или OGG. - - - Нет файлов, подходящих под маску "{0}" - - - {0} файл добавлен к выбранным - - - {0} файла добавлено к выбранным - - - {0} файлов добавлено к выбранным - - - Маска для имён файлов - - - Выбрать файлы - - - Произошёл сбой во время извлечения файла -{0} -{1} - - - Задать тип файла - - - без типа - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Отмена + + + Извлечь + + + _Закрыть + + + Копировать + + + Создать архив... + + + Вырезать + + + Удалить + + + Просмотр в Explorer + + + Извлечь + + + Открыть + + + Вставить + + + Обновить + + + Переименовать + + + Сортировка + + + по имени + + + по размеру + + + по типу + + + не сортировать + + + Имя + + + Размер + + + Тип + + + Формат архива + + + Имя архива + + + Настройки архивирования + + + Извлечь файлы из {0} в + + + Извлечь {0} в + + + О программе + + + Удалён файл {0} + + + каталог не найден + + + архив пуст + + + Ошибка извлечения файла + + + Ошибка открытия файла + + + {0} извлечён в {1} + + + Извлекаются файлы из {0} + + + Файл извлекается из {0} + + + Извлекаются файлы из {0} в {1} + + + Изображение {0} x {1} x {2}bpp + + + отсутствуют файлы, удовлетворяющие выбранным критериям + + + Готов + + + не удалось интерпретировать формат изображения + + + Версия {0} + + + [встроен] + + + Архивы + + + Изображения + + + Об обозревателе игровых ресурсов + + + Все файлы + + + исходном + + + Выберите месторасположение архива + + + Выберите место извлечения + + + Создать архив + + + Ошибка при создании архива + + + Кодировка текста + + + Извлекать изображения + + + Извлекать текст + + + Извлечь из архива + + + OK + + + Параметры архива + + + Сохранить в формате + + + Сохранить в формате + + + Обозреватель игровых ресурсов + + + Назад + + + Вперёд + + + Файл под именем '{0}' +уже существует. + +Перезаписать? + + + Подтвердите перезапись + + + Создание архива {0} + + + архив + + + изображение + + + сценарий + + + Открыть... + + + Недавние файлы + + + Выберите файлы для извлечения + + + Выход + + + _Файл + + + _Справка + + + Извлечён {0} файл + + + Извлечено {0} файла + + + Извлечено {0} файлов + + + {0} файл + + + {0} файла + + + {0} файлов + + + Вы действительно хотите удалить эти файлы? + + + Удалить файлы + + + Удалён {0} файл + + + Удалено {0} файла + + + Удалено {0} файлов + + + Подогнать размер окна под изображение + + + Вкл/выкл главное меню + + + Вкл/выкл полосу статуса + + + Вкл/выкл панель инструментов + + + Просмотр + + + Конверсия мультимедиа... + + + Преобразовать + + + Формат преобразования изображений + + + Преобразование мультимедиа + + + Преобразование файла {0} + + + Ошибка конверсии мультимедиа + + + Кодировка + + + Преобразовывать аудио в стандартный формат + + + Извлекать аудио + + + WAV, MP3, либо OGG + + + Аудио + + + Лицензия + + + звук + + + не удалось интерпретировать формат аудио + + + Пропускать файлы, не поддавшиеся конверсии. + + + Среди выбранных файлов нет мультимедиа. + + + Аудио-файлы будут преобразованы в WAV, MP3 или OGG. + + + Нет файлов, подходящих под маску "{0}" + + + {0} файл добавлен к выбранным + + + {0} файла добавлено к выбранным + + + {0} файлов добавлено к выбранным + + + Маска для имён файлов + + + Выбрать файлы + + + Произошёл сбой во время извлечения файла +{0} +{1} + + + Задать тип файла + + + без типа + \ No newline at end of file diff --git a/TextViewer.xaml b/GUI/TextViewer.xaml similarity index 100% rename from TextViewer.xaml rename to GUI/TextViewer.xaml diff --git a/TextViewer.xaml.cs b/GUI/TextViewer.xaml.cs similarity index 100% rename from TextViewer.xaml.cs rename to GUI/TextViewer.xaml.cs diff --git a/Utility.cs b/GUI/Utility.cs similarity index 97% rename from Utility.cs rename to GUI/Utility.cs index 18edbe2c..f289b480 100644 --- a/Utility.cs +++ b/GUI/Utility.cs @@ -1,151 +1,151 @@ -//! \file Utility.cs -//! \date Sun Jul 06 07:40:34 2014 -//! \brief utility classes. -// -// Copyright (C) 2014 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.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Windows.Input; -using GARbro.GUI.Strings; - -namespace GARbro.GUI -{ - internal class NativeMethods - { - [DllImport ("shlwapi.dll", CharSet = CharSet.Unicode)] - internal static extern int StrCmpLogicalW (string psz1, string psz2); - - [DllImport ("gdi32.dll")] - internal static extern int GetDeviceCaps (IntPtr hDc, int nIndex); - - [DllImport ("user32.dll")] - internal static extern IntPtr GetDC (IntPtr hWnd); - - [DllImport ("user32.dll")] - internal static extern int ReleaseDC (IntPtr hWnd, IntPtr hDc); - } - - public static class Desktop - { - public static int DpiX { get { return dpi_x; } } - public static int DpiY { get { return dpi_y; } } - - public const int LOGPIXELSX = 88; - public const int LOGPIXELSY = 90; - - private static int dpi_x = GetCaps (LOGPIXELSX); - private static int dpi_y = GetCaps (LOGPIXELSY); - - public static int GetCaps (int cap) - { - IntPtr hdc = NativeMethods.GetDC (IntPtr.Zero); - if (hdc == IntPtr.Zero) - return 96; - int dpi = NativeMethods.GetDeviceCaps (hdc, cap); - NativeMethods.ReleaseDC (IntPtr.Zero, hdc); - return dpi; - } - } - - public sealed class NumericStringComparer : IComparer - { - public int Compare (string a, string b) - { - return NativeMethods.StrCmpLogicalW (a, b); - } - } - - public class WaitCursor : IDisposable - { - private Cursor m_previousCursor; - - public WaitCursor() - { - m_previousCursor = Mouse.OverrideCursor; - Mouse.OverrideCursor = Cursors.Wait; - } - - #region IDisposable Members - bool disposed = false; - public void Dispose() - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (!disposed) - { - Mouse.OverrideCursor = m_previousCursor; - disposed = true; - } - } - #endregion - } - - public static class Localization - { - public static string Plural (int n, string msg_id) - { - string suffix; - if (CultureInfo.CurrentUICulture.Name == "ru-RU") - { - suffix = (n%10==1 && n%100!=11 ? "1" : n%10>=2 && n% 10<=4 && (n%100<10 || n%100>=20) ? "2" : "3"); - } - else // assume en-EN - { - suffix = 1 == n ? "1" : "2"; - } - try - { - var res = guiStrings.ResourceManager.GetString (msg_id+suffix); - if (null == res) - { - Trace.WriteLine (string.Format ("Missing string resource for '{0}' token", msg_id+suffix)); - if (suffix != "1") - res = guiStrings.ResourceManager.GetString (msg_id+"1"); - if (null == res) - res = guiStrings.ResourceManager.GetString (msg_id); - } - return res ?? msg_id; - } - catch (Exception X) - { - Trace.WriteLine (X.Message, "Localization.Plural"); - return msg_id; - } - } - - public static string Format (string msg_id, int n) - { - return string.Format (Plural (n, msg_id), n); - } - - // Localization.Format ("{0:file:files} copied", count); -// public static string Format (string format, params object[] args); - } -} +//! \file Utility.cs +//! \date Sun Jul 06 07:40:34 2014 +//! \brief utility classes. +// +// Copyright (C) 2014 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.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Windows.Input; +using GARbro.GUI.Strings; + +namespace GARbro.GUI +{ + internal class NativeMethods + { + [DllImport ("shlwapi.dll", CharSet = CharSet.Unicode)] + internal static extern int StrCmpLogicalW (string psz1, string psz2); + + [DllImport ("gdi32.dll")] + internal static extern int GetDeviceCaps (IntPtr hDc, int nIndex); + + [DllImport ("user32.dll")] + internal static extern IntPtr GetDC (IntPtr hWnd); + + [DllImport ("user32.dll")] + internal static extern int ReleaseDC (IntPtr hWnd, IntPtr hDc); + } + + public static class Desktop + { + public static int DpiX { get { return dpi_x; } } + public static int DpiY { get { return dpi_y; } } + + public const int LOGPIXELSX = 88; + public const int LOGPIXELSY = 90; + + private static int dpi_x = GetCaps (LOGPIXELSX); + private static int dpi_y = GetCaps (LOGPIXELSY); + + public static int GetCaps (int cap) + { + IntPtr hdc = NativeMethods.GetDC (IntPtr.Zero); + if (hdc == IntPtr.Zero) + return 96; + int dpi = NativeMethods.GetDeviceCaps (hdc, cap); + NativeMethods.ReleaseDC (IntPtr.Zero, hdc); + return dpi; + } + } + + public sealed class NumericStringComparer : IComparer + { + public int Compare (string a, string b) + { + return NativeMethods.StrCmpLogicalW (a, b); + } + } + + public class WaitCursor : IDisposable + { + private Cursor m_previousCursor; + + public WaitCursor() + { + m_previousCursor = Mouse.OverrideCursor; + Mouse.OverrideCursor = Cursors.Wait; + } + + #region IDisposable Members + bool disposed = false; + public void Dispose() + { + Dispose (true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose (bool disposing) + { + if (!disposed) + { + Mouse.OverrideCursor = m_previousCursor; + disposed = true; + } + } + #endregion + } + + public static class Localization + { + public static string Plural (int n, string msg_id) + { + string suffix; + if (CultureInfo.CurrentUICulture.Name == "ru-RU") + { + suffix = (n%10==1 && n%100!=11 ? "1" : n%10>=2 && n% 10<=4 && (n%100<10 || n%100>=20) ? "2" : "3"); + } + else // assume en-EN + { + suffix = 1 == n ? "1" : "2"; + } + try + { + var res = guiStrings.ResourceManager.GetString (msg_id+suffix); + if (null == res) + { + Trace.WriteLine (string.Format ("Missing string resource for '{0}' token", msg_id+suffix)); + if (suffix != "1") + res = guiStrings.ResourceManager.GetString (msg_id+"1"); + if (null == res) + res = guiStrings.ResourceManager.GetString (msg_id); + } + return res ?? msg_id; + } + catch (Exception X) + { + Trace.WriteLine (X.Message, "Localization.Plural"); + return msg_id; + } + } + + public static string Format (string msg_id, int n) + { + return string.Format (Plural (n, msg_id), n); + } + + // Localization.Format ("{0:file:files} copied", count); +// public static string Format (string format, params object[] args); + } +} diff --git a/ViewModel.cs b/GUI/ViewModel.cs similarity index 97% rename from ViewModel.cs rename to GUI/ViewModel.cs index 2baed350..10dc8690 100644 --- a/ViewModel.cs +++ b/GUI/ViewModel.cs @@ -1,230 +1,230 @@ -//! \file ViewModel.cs -//! \date Wed Jul 02 07:29:11 2014 -//! \brief GARbro directory list. -// -// Copyright (C) 2014 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.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Text.RegularExpressions; -using System.Globalization; -using System.Windows.Data; -using GameRes; -using GARbro.GUI.Strings; - -namespace GARbro.GUI -{ - public class DirectoryViewModel : ObservableCollection - { - public IReadOnlyList Path { get; private set; } - public IEnumerable Source { get; private set; } - public bool IsArchive { get; private set; } - - public DirectoryViewModel (IEnumerable path, IEnumerable filelist, bool is_archive) - { - Path = path.ToList(); - Source = filelist; - IsArchive = is_archive; - ImportFromSource(); - } - - protected void ImportFromSource () - { - var last_dir = Path.Last(); - if (IsArchive || !string.IsNullOrEmpty (last_dir) && null != Directory.GetParent (last_dir)) - { - Add (new EntryViewModel (new SubDirEntry (".."), -2)); - } - foreach (var entry in Source) - { - int prio = entry is SubDirEntry ? -1 : 0; - Add (new EntryViewModel (entry, prio)); - } - } - - public EntryViewModel Find (string name) - { - return this.FirstOrDefault (e => e.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase)); - } - } - - public class EntryViewModel : INotifyPropertyChanged - { - public EntryViewModel (Entry entry, int priority) - { - Source = entry; - Name = Path.GetFileName (entry.Name); - Priority = priority; - } - - public event PropertyChangedEventHandler PropertyChanged; - - public Entry Source { get; private set; } - - public string Name { get; private set; } - public string Type - { - get { return Source.Type; } - set - { - if (Source.Type != value) - { - Source.Type = value; - OnPropertyChanged ("Type"); - } - } - } - public uint? Size { get { return IsDirectory ? null : (uint?)Source.Size; } } - public int Priority { get; private set; } - public bool IsDirectory { get { return Priority < 0; } } - - private void OnPropertyChanged (string property = "") - { - if (PropertyChanged != null) - { - PropertyChanged (this, new PropertyChangedEventArgs (property)); - } - } - } - - public sealed class FileSystemComparer : IComparer - { - private string m_property; - private int m_direction; - private static Comparer s_default_comparer = new Comparer (CultureInfo.CurrentUICulture); - - public FileSystemComparer (string property, ListSortDirection direction) - { - m_property = property; - m_direction = direction == ListSortDirection.Ascending ? 1 : -1; - } - - public int Compare (object a, object b) - { - var v_a = a as EntryViewModel; - var v_b = b as EntryViewModel; - if (null == v_a || null == v_b) - return s_default_comparer.Compare (a, b) * m_direction; - - if (v_a.Priority < v_b.Priority) - return -1; - if (v_a.Priority > v_b.Priority) - return 1; - if (string.IsNullOrEmpty (m_property)) - return 0; - int order; - if (m_property != "Name") - { - if ("Type" == m_property) - { - // empty strings placed in the end - if (string.IsNullOrEmpty (v_a.Type)) - order = string.IsNullOrEmpty (v_b.Type) ? 0 : m_direction; - else if (string.IsNullOrEmpty (v_b.Type)) - order = -m_direction; - else - order = string.Compare (v_a.Type, v_b.Type, true) * m_direction; - } - else - { - var prop_a = a.GetType ().GetProperty (m_property).GetValue (a); - var prop_b = b.GetType ().GetProperty (m_property).GetValue (b); - order = s_default_comparer.Compare (prop_a, prop_b) * m_direction; - } - if (0 == order) - order = CompareNames (v_a.Name, v_b.Name); - } - else - order = CompareNames (v_a.Name, v_b.Name) * m_direction; - return order; - } - - static int CompareNames (string a, string b) - { -// return NativeMethods.StrCmpLogicalW (a, b); - return string.Compare (a, b, StringComparison.CurrentCultureIgnoreCase); - } - } - - /// - /// Image format model for formats drop-down list widgets. - /// - public class ImageFormatModel - { - public ImageFormat Source { get; private set; } - public string Tag { - get { return null != Source ? Source.Tag : guiStrings.TextAsIs; } - } - - public ImageFormatModel (ImageFormat impl = null) - { - Source = impl; - } - } - - /// - /// Stores current position within directory view model. - /// - public class DirectoryPosition - { - public IEnumerable Path { get; set; } - public string Item { get; set; } - - public DirectoryPosition (DirectoryViewModel vm, EntryViewModel item) - { - Path = vm.Path; - Item = null != item ? item.Name : null; - } - - public DirectoryPosition (string filename) - { - Path = new string[] { System.IO.Path.GetDirectoryName (filename) }; - Item = System.IO.Path.GetFileName (filename); - } - } - - public class EntryTypeConverter : IValueConverter - { - public object Convert (object value, Type targetType, object parameter, CultureInfo culture) - { - var type = value as string; - if (!string.IsNullOrEmpty (type)) - { - var translation = guiStrings.ResourceManager.GetString ("Type_"+type, guiStrings.Culture); - if (!string.IsNullOrEmpty (translation)) - return translation; - } - return value; - } - - public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} +//! \file ViewModel.cs +//! \date Wed Jul 02 07:29:11 2014 +//! \brief GARbro directory list. +// +// Copyright (C) 2014 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.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Text.RegularExpressions; +using System.Globalization; +using System.Windows.Data; +using GameRes; +using GARbro.GUI.Strings; + +namespace GARbro.GUI +{ + public class DirectoryViewModel : ObservableCollection + { + public IReadOnlyList Path { get; private set; } + public IEnumerable Source { get; private set; } + public bool IsArchive { get; private set; } + + public DirectoryViewModel (IEnumerable path, IEnumerable filelist, bool is_archive) + { + Path = path.ToList(); + Source = filelist; + IsArchive = is_archive; + ImportFromSource(); + } + + protected void ImportFromSource () + { + var last_dir = Path.Last(); + if (IsArchive || !string.IsNullOrEmpty (last_dir) && null != Directory.GetParent (last_dir)) + { + Add (new EntryViewModel (new SubDirEntry (".."), -2)); + } + foreach (var entry in Source) + { + int prio = entry is SubDirEntry ? -1 : 0; + Add (new EntryViewModel (entry, prio)); + } + } + + public EntryViewModel Find (string name) + { + return this.FirstOrDefault (e => e.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase)); + } + } + + public class EntryViewModel : INotifyPropertyChanged + { + public EntryViewModel (Entry entry, int priority) + { + Source = entry; + Name = Path.GetFileName (entry.Name); + Priority = priority; + } + + public event PropertyChangedEventHandler PropertyChanged; + + public Entry Source { get; private set; } + + public string Name { get; private set; } + public string Type + { + get { return Source.Type; } + set + { + if (Source.Type != value) + { + Source.Type = value; + OnPropertyChanged ("Type"); + } + } + } + public uint? Size { get { return IsDirectory ? null : (uint?)Source.Size; } } + public int Priority { get; private set; } + public bool IsDirectory { get { return Priority < 0; } } + + private void OnPropertyChanged (string property = "") + { + if (PropertyChanged != null) + { + PropertyChanged (this, new PropertyChangedEventArgs (property)); + } + } + } + + public sealed class FileSystemComparer : IComparer + { + private string m_property; + private int m_direction; + private static Comparer s_default_comparer = new Comparer (CultureInfo.CurrentUICulture); + + public FileSystemComparer (string property, ListSortDirection direction) + { + m_property = property; + m_direction = direction == ListSortDirection.Ascending ? 1 : -1; + } + + public int Compare (object a, object b) + { + var v_a = a as EntryViewModel; + var v_b = b as EntryViewModel; + if (null == v_a || null == v_b) + return s_default_comparer.Compare (a, b) * m_direction; + + if (v_a.Priority < v_b.Priority) + return -1; + if (v_a.Priority > v_b.Priority) + return 1; + if (string.IsNullOrEmpty (m_property)) + return 0; + int order; + if (m_property != "Name") + { + if ("Type" == m_property) + { + // empty strings placed in the end + if (string.IsNullOrEmpty (v_a.Type)) + order = string.IsNullOrEmpty (v_b.Type) ? 0 : m_direction; + else if (string.IsNullOrEmpty (v_b.Type)) + order = -m_direction; + else + order = string.Compare (v_a.Type, v_b.Type, true) * m_direction; + } + else + { + var prop_a = a.GetType ().GetProperty (m_property).GetValue (a); + var prop_b = b.GetType ().GetProperty (m_property).GetValue (b); + order = s_default_comparer.Compare (prop_a, prop_b) * m_direction; + } + if (0 == order) + order = CompareNames (v_a.Name, v_b.Name); + } + else + order = CompareNames (v_a.Name, v_b.Name) * m_direction; + return order; + } + + static int CompareNames (string a, string b) + { +// return NativeMethods.StrCmpLogicalW (a, b); + return string.Compare (a, b, StringComparison.CurrentCultureIgnoreCase); + } + } + + /// + /// Image format model for formats drop-down list widgets. + /// + public class ImageFormatModel + { + public ImageFormat Source { get; private set; } + public string Tag { + get { return null != Source ? Source.Tag : guiStrings.TextAsIs; } + } + + public ImageFormatModel (ImageFormat impl = null) + { + Source = impl; + } + } + + /// + /// Stores current position within directory view model. + /// + public class DirectoryPosition + { + public IEnumerable Path { get; set; } + public string Item { get; set; } + + public DirectoryPosition (DirectoryViewModel vm, EntryViewModel item) + { + Path = vm.Path; + Item = null != item ? item.Name : null; + } + + public DirectoryPosition (string filename) + { + Path = new string[] { System.IO.Path.GetDirectoryName (filename) }; + Item = System.IO.Path.GetFileName (filename); + } + } + + public class EntryTypeConverter : IValueConverter + { + public object Convert (object value, Type targetType, object parameter, CultureInfo culture) + { + var type = value as string; + if (!string.IsNullOrEmpty (type)) + { + var translation = guiStrings.ResourceManager.GetString ("Type_"+type, guiStrings.Culture); + if (!string.IsNullOrEmpty (translation)) + return translation; + } + return value; + } + + public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/packages.config b/GUI/packages.config similarity index 96% rename from packages.config rename to GUI/packages.config index 38cd96bb..d8e6610d 100644 --- a/packages.config +++ b/GUI/packages.config @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/Images/32x32/back button.png b/Images/32x32/back button.png deleted file mode 100644 index 3c0c2310..00000000 Binary files a/Images/32x32/back button.png and /dev/null differ diff --git a/Images/32x32/forward button.png b/Images/32x32/forward button.png deleted file mode 100644 index 26e02c0c..00000000 Binary files a/Images/32x32/forward button.png and /dev/null differ diff --git a/Images/32x32/help.png b/Images/32x32/help.png deleted file mode 100644 index 9b190d88..00000000 Binary files a/Images/32x32/help.png and /dev/null differ diff --git a/Images/48x48/refresh.png b/Images/48x48/refresh.png deleted file mode 100644 index d96b6138..00000000 Binary files a/Images/48x48/refresh.png and /dev/null differ diff --git a/Images/64x64/info.png b/Images/64x64/info.png deleted file mode 100644 index cbb766aa..00000000 Binary files a/Images/64x64/info.png and /dev/null differ diff --git a/Images/sample.ico b/Images/sample.ico deleted file mode 100644 index 435cca24..00000000 Binary files a/Images/sample.ico and /dev/null differ diff --git a/Images/search4files.ico b/Images/search4files.ico deleted file mode 100644 index 27aff3ed..00000000 Binary files a/Images/search4files.ico and /dev/null differ diff --git a/Images/splashscreen.png b/Images/splashscreen.png deleted file mode 100644 index d0f1688f..00000000 Binary files a/Images/splashscreen.png and /dev/null differ diff --git a/packages/repositories.config b/packages/repositories.config deleted file mode 100644 index 1a5dce06..00000000 --- a/packages/repositories.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file