diff --git a/GmodAddonCompressor/App.config b/GmodAddonCompressor/App.config new file mode 100644 index 0000000..eed98ff --- /dev/null +++ b/GmodAddonCompressor/App.config @@ -0,0 +1,75 @@ + + + + +
+ + + + + + 10 + + + 10 + + + False + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + False + + + True + + + True + + + False + + + 0 + + + 0 + + + 22050 + + + 0 + + + 0 + + + + \ No newline at end of file diff --git a/GmodAddonCompressor/DataContexts/MainWindowContext.cs b/GmodAddonCompressor/DataContexts/MainWindowContext.cs index 583c9b5..c0960cb 100644 --- a/GmodAddonCompressor/DataContexts/MainWindowContext.cs +++ b/GmodAddonCompressor/DataContexts/MainWindowContext.cs @@ -1,36 +1,38 @@ using System.ComponentModel; using System.Runtime.CompilerServices; +using GmodAddonCompressor.Properties; namespace GmodAddonCompressor.DataContexts { internal class MainWindowContext : INotifyPropertyChanged { + private static Settings Set => Settings.Default; private string _addonDirectoryPath = string.Empty; private string _progressBarText = string.Empty; private int _progressBarMinValue = 0; private int _progressBarMaxValue = 100; private int _progressBarValue = 0; - private bool _unlockedUI = true; - private bool _compressVTF = true; - private bool _compressWAV = true; - private bool _compressMP3 = true; - private bool _compressOGG = true; - private bool _compressJPG = true; - private bool _compressPNG = true; - private bool _compressLUA = false; - private bool _useFFMpegForCompress = false; - private bool _changeOriginalCodeToMinimalistic = false; - private bool _reduceExactlyToLimits = false; - private bool _reduceExactlyToResolution = true; - private bool _keepImageAspectRatio = true; - private bool _imageMagickVTFCompress = false; - private uint _imageSkipWidth = 0; - private uint _imageSkipHeight = 0; - private int _wavRate = 22050; - private int _wavRateListIndex = 0; - private int _imageReducingResolutionListIndex = 0; - private int _imageWidthLimitIndex = 10; - private int _imageHeightLimitIndex = 10; + private bool _unlockedUI = Set._unlockedUI; + private bool _compressVTF = Set._compressVTF; + private bool _compressWAV = Set._compressWAV; + private bool _compressMP3 = Set._compressMP3; + private bool _compressOGG = Set._compressOGG; + private bool _compressJPG = Set._compressJPG; + private bool _compressPNG = Set._compressPNG; + private bool _compressLUA = Set._compressLUA; + private bool _useFFMpegForCompress = Set._useFFMpegForCompress; + private bool _changeOriginalCodeToMinimalistic = Set._changeOriginalCodeToMinimalistic; + private bool _reduceExactlyToLimits = Set._reduceExactlyToLimits; + private bool _reduceExactlyToResolution = Set._reduceExactlyToResolution; + private bool _keepImageAspectRatio = Set._keepImageAspectRatio; + private bool _imageMagickVTFCompress = Set._imageMagickVTFCompress; + private uint _imageSkipWidth = Set._imageSkipWidth; + private uint _imageSkipHeight = Set._imageSkipHeight; + private int _wavRate = Set._wavRate; + private int _wavRateListIndex = Set._wavRateListIndex; + private int _imageReducingResolutionListIndex = Set._imageReducingResolutionListIndex; + private int _imageWidthLimitIndex = Set._imageWidthLimitIndex; + private int _imageHeightLimitIndex = Set._imageHeightLimitIndex; private int[] _imageReducingResolutionList = new int[] { 2, @@ -69,6 +71,7 @@ public uint ImageSkipHeight set { _imageSkipHeight = value; + Set._imageSkipHeight = value; OnPropertyChanged(); } } @@ -79,6 +82,7 @@ public uint ImageSkipWidth set { _imageSkipWidth = value; + Set._imageSkipWidth = value; OnPropertyChanged(); } } @@ -99,6 +103,7 @@ public int ImageWidthLimitIndex set { _imageWidthLimitIndex = value; + Set._imageWidthLimitIndex = value; OnPropertyChanged(); } } @@ -109,6 +114,7 @@ public int ImageHeightLimitIndex set { _imageHeightLimitIndex = value; + Set._imageHeightLimitIndex = value; OnPropertyChanged(); } } @@ -119,6 +125,7 @@ public int ImageReducingResolutionListIndex set { _imageReducingResolutionListIndex = value; + Set._imageReducingResolutionListIndex = value; OnPropertyChanged(); } } @@ -139,6 +146,7 @@ public int WavRateListIndex set { _wavRateListIndex = value; + Set._wavRateListIndex = value; OnPropertyChanged(); } } @@ -159,6 +167,7 @@ public int WavRate set { _wavRate = value; + Set._wavRate = value; OnPropertyChanged(); } } @@ -169,6 +178,7 @@ public bool ImageMagickVTFCompress set { _imageMagickVTFCompress = value; + Set._imageMagickVTFCompress = value; OnPropertyChanged(); } } @@ -179,6 +189,7 @@ public bool KeepImageAspectRatio set { _keepImageAspectRatio = value; + Set._keepImageAspectRatio = value; OnPropertyChanged(); } } @@ -189,6 +200,7 @@ public bool ReduceExactlyToResolution set { _reduceExactlyToResolution = value; + Set._reduceExactlyToResolution = value; OnPropertyChanged(); } } @@ -199,6 +211,7 @@ public bool ReduceExactlyToLimits set { _reduceExactlyToLimits = value; + Set._reduceExactlyToLimits = value; ReduceExactlyToResolution = !_reduceExactlyToLimits; OnPropertyChanged(); } @@ -210,6 +223,7 @@ public bool ChangeOriginalCodeToMinimalistic set { _changeOriginalCodeToMinimalistic = value; + Set._changeOriginalCodeToMinimalistic = value; OnPropertyChanged(); } } @@ -220,6 +234,7 @@ public bool UseFFMpegForCompress set { _useFFMpegForCompress = value; + Set._useFFMpegForCompress = value; OnPropertyChanged(); } } @@ -230,6 +245,7 @@ public bool CompressLUA set { _compressLUA = value; + Set._compressLUA = value; OnPropertyChanged(); } } @@ -240,6 +256,7 @@ public bool CompressPNG set { _compressPNG = value; + Set._compressPNG = value; OnPropertyChanged(); } } @@ -250,6 +267,7 @@ public bool CompressJPG set { _compressJPG = value; + Set._compressJPG = value; OnPropertyChanged(); } } @@ -260,6 +278,7 @@ public bool CompressVTF set { _compressVTF = value; + Set._compressVTF = value; OnPropertyChanged(); } } @@ -270,6 +289,7 @@ public bool CompressOGG set { _compressOGG = value; + Set._compressOGG = value; OnPropertyChanged(); } } @@ -280,6 +300,7 @@ public bool CompressMP3 set { _compressMP3 = value; + Set._compressMP3 = value; OnPropertyChanged(); } } @@ -290,6 +311,7 @@ public bool CompressWAV set { _compressWAV = value; + Set._compressWAV = value; OnPropertyChanged(); } } @@ -300,6 +322,7 @@ public bool UnlockedUI set { _unlockedUI = value; + Set._unlockedUI = value; OnPropertyChanged(); } } @@ -359,6 +382,7 @@ public void OnPropertyChanged([CallerMemberName] string? propertyName = null) { if (PropertyChanged != null && propertyName != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + Set.Save(); } } } diff --git a/GmodAddonCompressor/GmodAddonCompressor.csproj b/GmodAddonCompressor/GmodAddonCompressor.csproj index 7327fe2..3385f48 100644 --- a/GmodAddonCompressor/GmodAddonCompressor.csproj +++ b/GmodAddonCompressor/GmodAddonCompressor.csproj @@ -31,6 +31,11 @@ True Resources.resx + + True + True + Settings.settings + @@ -40,4 +45,11 @@ + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + diff --git a/GmodAddonCompressor/Properties/Settings.Designer.cs b/GmodAddonCompressor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..2fa0960 --- /dev/null +++ b/GmodAddonCompressor/Properties/Settings.Designer.cs @@ -0,0 +1,278 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GmodAddonCompressor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.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("10")] + public int _imageWidthLimitIndex { + get { + return ((int)(this["_imageWidthLimitIndex"])); + } + set { + this["_imageWidthLimitIndex"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("10")] + public int _imageHeightLimitIndex { + get { + return ((int)(this["_imageHeightLimitIndex"])); + } + set { + this["_imageHeightLimitIndex"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool _useFFMpegForCompress { + get { + return ((bool)(this["_useFFMpegForCompress"])); + } + set { + this["_useFFMpegForCompress"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _unlockedUI { + get { + return ((bool)(this["_unlockedUI"])); + } + set { + this["_unlockedUI"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressVTF { + get { + return ((bool)(this["_compressVTF"])); + } + set { + this["_compressVTF"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressWAV { + get { + return ((bool)(this["_compressWAV"])); + } + set { + this["_compressWAV"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressMP3 { + get { + return ((bool)(this["_compressMP3"])); + } + set { + this["_compressMP3"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressOGG { + get { + return ((bool)(this["_compressOGG"])); + } + set { + this["_compressOGG"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressJPG { + get { + return ((bool)(this["_compressJPG"])); + } + set { + this["_compressJPG"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _compressPNG { + get { + return ((bool)(this["_compressPNG"])); + } + set { + this["_compressPNG"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool _compressLUA { + get { + return ((bool)(this["_compressLUA"])); + } + set { + this["_compressLUA"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool _changeOriginalCodeToMinimalistic { + get { + return ((bool)(this["_changeOriginalCodeToMinimalistic"])); + } + set { + this["_changeOriginalCodeToMinimalistic"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool _reduceExactlyToLimits { + get { + return ((bool)(this["_reduceExactlyToLimits"])); + } + set { + this["_reduceExactlyToLimits"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _reduceExactlyToResolution { + get { + return ((bool)(this["_reduceExactlyToResolution"])); + } + set { + this["_reduceExactlyToResolution"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool _keepImageAspectRatio { + get { + return ((bool)(this["_keepImageAspectRatio"])); + } + set { + this["_keepImageAspectRatio"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool _imageMagickVTFCompress { + get { + return ((bool)(this["_imageMagickVTFCompress"])); + } + set { + this["_imageMagickVTFCompress"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public uint _imageSkipWidth { + get { + return ((uint)(this["_imageSkipWidth"])); + } + set { + this["_imageSkipWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public uint _imageSkipHeight { + get { + return ((uint)(this["_imageSkipHeight"])); + } + set { + this["_imageSkipHeight"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("22050")] + public int _wavRate { + get { + return ((int)(this["_wavRate"])); + } + set { + this["_wavRate"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int _wavRateListIndex { + get { + return ((int)(this["_wavRateListIndex"])); + } + set { + this["_wavRateListIndex"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int _imageReducingResolutionListIndex { + get { + return ((int)(this["_imageReducingResolutionListIndex"])); + } + set { + this["_imageReducingResolutionListIndex"] = value; + } + } + } +} diff --git a/GmodAddonCompressor/Properties/Settings.settings b/GmodAddonCompressor/Properties/Settings.settings new file mode 100644 index 0000000..91a38ec --- /dev/null +++ b/GmodAddonCompressor/Properties/Settings.settings @@ -0,0 +1,69 @@ + + + + + + 10 + + + 10 + + + False + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + False + + + True + + + True + + + False + + + 0 + + + 0 + + + 22050 + + + 0 + + + 0 + + + \ No newline at end of file