diff --git a/.editorconfig b/.editorconfig index 92da776..aaee4ed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,7 +15,7 @@ indent_style = space [*.xml] [*.xaml] -indent_size = 2 +indent_size = 4 indent_style = space [*.{cs,vb}] diff --git a/ConfuserEx/ConfuserEx.csproj b/ConfuserEx/ConfuserEx.csproj index 935bdaf..69623f6 100644 --- a/ConfuserEx/ConfuserEx.csproj +++ b/ConfuserEx/ConfuserEx.csproj @@ -67,6 +67,7 @@ Properties\GlobalAssemblyInfo.cs + CompComboBox.xaml diff --git a/ConfuserEx/EmptyToBoolConverter.cs b/ConfuserEx/EmptyToBoolConverter.cs new file mode 100644 index 0000000..9fed4ca --- /dev/null +++ b/ConfuserEx/EmptyToBoolConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace ConfuserEx { + [ValueConversion(typeof(string), typeof(bool), ParameterType = typeof(bool))] + [ValueConversion(typeof(string), typeof(bool), ParameterType = typeof(string))] + public class EmptyToBoolConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + bool stateIfEmpty = true; + switch (parameter) { + case bool boolParameter: + stateIfEmpty = boolParameter; + break; + case string strParameter when bool.TryParse(strParameter, out var parsedStrParameter): + stateIfEmpty = parsedStrParameter; + break; + } + + if (value == null) return stateIfEmpty; + if (!(value is string strValue)) return stateIfEmpty; + + return string.IsNullOrEmpty(strValue) ? stateIfEmpty : !stateIfEmpty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => + throw new NotSupportedException(); + } +} diff --git a/ConfuserEx/ViewModel/Project/ProjectModuleVM.cs b/ConfuserEx/ViewModel/Project/ProjectModuleVM.cs index 04473ea..35ced9f 100644 --- a/ConfuserEx/ViewModel/Project/ProjectModuleVM.cs +++ b/ConfuserEx/ViewModel/Project/ProjectModuleVM.cs @@ -73,6 +73,46 @@ namespace ConfuserEx.ViewModel { } } + public string SNSigKeyPath { + get { return module.SNSigKeyPath; } + set { + if (SetProperty(module.SNSigKeyPath != value, val => module.SNSigKeyPath = val, value, "SNSigKeyPath")) + parent.IsModified = true; + } + } + + public string SNSigKeyPassword { + get { return module.SNSigKeyPassword; } + set { + if (SetProperty(module.SNSigKeyPassword != value, val => module.SNSigKeyPassword = val, value, "SNSigKeyPassword")) + parent.IsModified = true; + } + } + + public string SNPubKeyPath { + get { return module.SNPubKeyPath; } + set { + if (SetProperty(module.SNPubKeyPath != value, val => module.SNPubKeyPath = val, value, "SNPubKeyPath")) + parent.IsModified = true; + } + } + + public string SNPubSigKeyPath { + get { return module.SNPubSigKeyPath; } + set { + if (SetProperty(module.SNPubSigKeyPath != value, val => module.SNPubSigKeyPath = val, value, "SNPubSigKeyPath")) + parent.IsModified = true; + } + } + + public bool SNDelaySig { + get { return module.SNDelaySig; } + set { + if (SetProperty(module.SNDelaySig != value, val => module.SNDelaySig = val, value, "SNDelaySig")) + parent.IsModified = true; + } + } + public IList Rules { get; private set; } ProjectModule IViewModel.Model { @@ -95,4 +135,4 @@ namespace ConfuserEx.ViewModel { }); } } -} \ No newline at end of file +} diff --git a/ConfuserEx/Views/ProjectModuleView.xaml b/ConfuserEx/Views/ProjectModuleView.xaml index 6ae201b..ba27634 100644 --- a/ConfuserEx/Views/ProjectModuleView.xaml +++ b/ConfuserEx/Views/ProjectModuleView.xaml @@ -2,14 +2,56 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ConfuserEx" + xmlns:vm="clr-namespace:ConfuserEx.ViewModel" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="{Binding Path, StringFormat=Edit module \'{0}\'...}" Style="{StaticResource DarkWindow}" - SizeToContent="WidthAndHeight" ShowInTaskbar="False" ResizeMode="NoResize"> + SizeToContent="WidthAndHeight" ShowInTaskbar="False" ResizeMode="NoResize" + d:DataContext="{d:DesignInstance vm:ProjectModuleVM}"> + + + + + + + + + + + + + + @@ -17,30 +59,63 @@ -