added "Set file type" command.

This commit is contained in:
morkt 2015-08-23 07:35:05 +04:00
parent 31842bdea5
commit ab19d0b0e3
8 changed files with 90 additions and 6 deletions

View File

@ -80,6 +80,16 @@
<MenuItem Header="{x:Static s:guiStrings.CtxMenuExtract}" InputGestureText="F4"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource booleanToCollapsedVisibilityConverter}}"
Command="{x:Static local:Commands.ExtractItem}" />
<MenuItem Header="{x:Static s:guiStrings.CtxMenuFileType}">
<MenuItem DataContext="image" Header="{Binding Converter={StaticResource entryTypeConverter}}"
Command="{x:Static local:Commands.SetFileType}" CommandParameter="{Binding}"/>
<MenuItem DataContext="audio" Header="{Binding Converter={StaticResource entryTypeConverter}}"
Command="{x:Static local:Commands.SetFileType}" CommandParameter="{Binding}"/>
<MenuItem DataContext="script" Header="{Binding Converter={StaticResource entryTypeConverter}}"
Command="{x:Static local:Commands.SetFileType}" CommandParameter="{Binding}"/>
<MenuItem Header="{x:Static s:guiStrings.Type_NONE}"
Command="{x:Static local:Commands.SetFileType}" CommandParameter=""/>
</MenuItem>
<MenuItem Header="{x:Static s:guiStrings.CtxMenuExplorer}" InputGestureText="Ctrl+E"
Command="{x:Static local:Commands.ExploreItem}"/>
<MenuItem Header="{x:Static s:guiStrings.CtxMenuDelete}" InputGestureText="Del"
@ -372,6 +382,7 @@
<CommandBinding Command="{x:Static local:Commands.ExploreItem}" Executed="ExploreItemExec" CanExecute="CanExecuteInDirectory" />
<CommandBinding Command="{x:Static local:Commands.ConvertMedia}" Executed="ConvertMediaExec" CanExecute="CanExecuteConvertMedia" />
<CommandBinding Command="{x:Static local:Commands.SortBy}" Executed="SortByExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.SetFileType}" Executed="SetFileTypeExec" CanExecute="CanExecuteOnSelected"/>
<CommandBinding Command="{x:Static local:Commands.GoBack}" Executed="GoBackExec" CanExecute="CanExecuteGoBack"/>
<CommandBinding Command="{x:Static local:Commands.GoForward}" Executed="GoForwardExec" CanExecute="CanExecuteGoForward"/>
<CommandBinding Command="{x:Static local:Commands.Refresh}" Executed="RefreshExec" CanExecute="CanExecuteAlways"/>

View File

@ -526,6 +526,21 @@ namespace GARbro.GUI
lv_SetSortMode (sort_by, ListSortDirection.Ascending);
}
/// <summary>
/// Handle "Set file type" commands.
/// </summary>
private void SetFileTypeExec (object sender, ExecutedRoutedEventArgs e)
{
var selected = CurrentDirectory.SelectedItems.Cast<EntryViewModel>().Where (x => !x.IsDirectory);
if (!selected.Any())
return;
string type = e.Parameter as string;
foreach (var entry in selected)
{
entry.Type = type;
}
}
/// <summary>
/// Event handler for keys pressed in the directory view pane
/// </summary>
@ -1314,5 +1329,6 @@ namespace GARbro.GUI
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();
}
}

View File

@ -51,5 +51,5 @@ using System.Windows;
// 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.1.5.24")]
[assembly: AssemblyFileVersion ("1.1.5.24")]
[assembly: AssemblyVersion ("1.1.5.636")]
[assembly: AssemblyFileVersion ("1.1.5.636")]

View File

@ -168,6 +168,15 @@ namespace GARbro.GUI.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to Set file type.
/// </summary>
public static string CtxMenuFileType {
get {
return ResourceManager.GetString("CtxMenuFileType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open.
/// </summary>
@ -1036,5 +1045,14 @@ namespace GARbro.GUI.Strings {
return ResourceManager.GetString("Type_directory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to none.
/// </summary>
public static string Type_NONE {
get {
return ResourceManager.GetString("Type_NONE", resourceCulture);
}
}
}
}

View File

@ -446,4 +446,10 @@ Overwrite?</value>
{0}
{1}</value>
</data>
<data name="CtxMenuFileType" xml:space="preserve">
<value>Set file type</value>
</data>
<data name="Type_NONE" xml:space="preserve">
<value>none</value>
</data>
</root>

View File

@ -467,4 +467,10 @@
{0}
{1}</value>
</data>
<data name="CtxMenuFileType" xml:space="preserve">
<value>Изменить тип файла</value>
</data>
<data name="Type_NONE" xml:space="preserve">
<value>без типа</value>
</data>
</root>

View File

@ -213,7 +213,7 @@ namespace GARbro.GUI
}
}
public class EntryViewModel
public class EntryViewModel : INotifyPropertyChanged
{
public EntryViewModel (Entry entry, int priority)
{
@ -222,13 +222,34 @@ namespace GARbro.GUI
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; } }
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

View File

@ -21,7 +21,10 @@ tr.odd td { background-color: #eee }
<tr><td>*.afs</td><td><tt>AFS</tt></td><td>No</td><td rowspan="2">PlayStation 2</td><td rowspan="2">Remember11</td></tr>
<tr><td>*.bip</td><td>-</td><td>No</td></tr>
<tr class="odd"><td>data.ami</td><td><tt>AMI</tt></td><td>Yes</td><td>-</td><td>Muv-Luv Amaterasu Translation data files</td></tr>
<tr><td>*.arc</td><td><tt>PackFile</tt></td><td>No</td><td>BGI/Ethornell</td><td>Chou Dengeki Stryker</td></tr>
<tr><td>*.arc</td><td><tt>PackFile</tt></td><td>No</td><td>BGI/Ethornell</td><td>
Chou Dengeki Stryker<br/>
H2O -Footprints in the Sand-<br/>
</td></tr>
<tr class="odd"><td>*</td><td>-<br/><tt>SM2MPX10</tt></td><td>No</td><td rowspan="4">DRS</td><td rowspan="4">
Anata no Osanazuma<br/>
Ecchi na Bunny-san wa Kirai?<br/>
@ -103,7 +106,10 @@ Tsukihime<br/>
Umineko<br/>
</td></tr>
<tr><td>*.pac</td><td><tt>PAC</tt></td><td>No</td><td>NeXAS</td><td>Maji de Watashi ni Koishinasai!</td></tr>
<tr class="odd"><td>*.pac</td><td><tt>PAC1</tt></td><td>No</td><td rowspan="2">Riddle Soft</td><td rowspan="2">Hana Hiraku</td></tr>
<tr class="odd"><td>*.pac</td><td><tt>PAC1</tt></td><td>No</td><td rowspan="2">Riddle Soft</td><td rowspan="2">
Hana Hiraku<br/>
Iinari<br/>
</td></tr>
<tr class="odd"><td>*.gcp</td><td><tt>CMP1</tt></td><td>No</td></tr>
<tr><td>*.pd</td><td><tt>PackOnly</tt><br/><tt>PackPlus</tt><br/><tt>FlyingShinePDFile</tt></td><td>Yes</td><td>Flying Shine</td><td>Cross†Channel</td></tr>
<tr class="odd"><td>*.rpa</td><td><tt>RPA-3.0</tt></td><td>Yes</td><td>Ren'Py</td><td>Katawa Shoujo</td></tr>