From cb650cb8ca568bfe3f8ec3f606d4016b5aeb299d Mon Sep 17 00:00:00 2001 From: Nikita Krapivin Date: Sun, 15 Aug 2021 20:47:59 +0500 Subject: [PATCH] Update for latest IDE. --- ZplBackupPlugin/Properties/AssemblyInfo.cs | 4 ++-- ZplBackupPlugin/ZplBackupPlugin.csproj | 14 ++++++------- ZplBackupPlugin/ZplBackupPluginCommand.cs | 5 ++++- ZplBackupPlugin/ZplBackupPluginPreferences.cs | 21 ++++++++++++------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ZplBackupPlugin/Properties/AssemblyInfo.cs b/ZplBackupPlugin/Properties/AssemblyInfo.cs index 1c37e08..e74d284 100644 --- a/ZplBackupPlugin/Properties/AssemblyInfo.cs +++ b/ZplBackupPlugin/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 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.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/ZplBackupPlugin/ZplBackupPlugin.csproj b/ZplBackupPlugin/ZplBackupPlugin.csproj index d94eca1..fb2ae86 100644 --- a/ZplBackupPlugin/ZplBackupPlugin.csproj +++ b/ZplBackupPlugin/ZplBackupPlugin.csproj @@ -49,20 +49,18 @@ MinimumRecommendedRules.ruleset - - False - ..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\CoreResources.dll + + ..\..\..\..\Progs\GameMakerStudio\23\IDE\CoreResources.dll - ..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\IDE.dll + ..\..\..\..\Progs\GameMakerStudio\23\IDE\IDE.dll - - False - ..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\OSCore.dll + + ..\..\..\..\Progs\GameMakerStudio\23\IDE\OSCore.dll - ..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\Utils.dll + ..\..\..\..\Progs\GameMakerStudio\23\IDE\Utils.dll diff --git a/ZplBackupPlugin/ZplBackupPluginCommand.cs b/ZplBackupPlugin/ZplBackupPluginCommand.cs index 2d5d1e4..62b55f2 100644 --- a/ZplBackupPlugin/ZplBackupPluginCommand.cs +++ b/ZplBackupPlugin/ZplBackupPluginCommand.cs @@ -13,6 +13,7 @@ using YoYoStudio.Resources; using YoYoStudio.Core.Utils.SourceControl; using YoYoStudio.GUI; +using YoYoStudio.Plugins.Attributes; namespace YoYoStudio { @@ -20,6 +21,7 @@ namespace Plugins { namespace ZplBackupPlugin { + [ModuleName("BackupCommand", "Handles project backup")] public class ZplBackupPluginCommand : IModule, IDisposable { public bool Stop { get; set; } @@ -258,7 +260,8 @@ protected virtual void Dispose(bool disposing) // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. - + IdeInterface = null; + Numbers = null; disposed = true; } } diff --git a/ZplBackupPlugin/ZplBackupPluginPreferences.cs b/ZplBackupPlugin/ZplBackupPluginPreferences.cs index cd3b38c..b3eeb5b 100644 --- a/ZplBackupPlugin/ZplBackupPluginPreferences.cs +++ b/ZplBackupPlugin/ZplBackupPluginPreferences.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using YoYoStudio.Core.Utils.Preferences; @@ -15,11 +16,11 @@ public class ZplBackupPluginPreferences : INotifyPropertyChanged private int _AmountOfBackups; private string _BackupFolderPath; - [Prefs("machine.Plugins.ZplBackup.AmountOfBackups", 0, "Amount of backup files produced", "ZPLB_AmountOfBackups", ePrefType.text_int, new object[] { /* minimum value */ 0, /* maximum value */ 1000, /* tooltip:[tooltip CSV id] */ "tooltip:ZPLB_AmountOfBackups_tooltip" })] - public int AmountOfBackups { get { return _AmountOfBackups; } set { SetProperty(ref _AmountOfBackups, value); } } + [Prefs("machine.Plugins.ZplBackup.AmountOfBackups", 0, "Amount of backup files produced", "ZPLB_AmountOfBackups", ePrefType.text_int, new object[] { /* minimum value */ 0, /* maximum value */ 9000, /* tooltip:[tooltip CSV id] */ "tooltip:ZPLB_AmountOfBackups_tooltip" })] + public int AmountOfBackups { get { return _AmountOfBackups; } set { SetPropertyIfChanged(ref _AmountOfBackups, value); } } [Prefs("machine.Plugins.ZplBackup.BackupFolderPath", 10, "Where to place the backups", "ZPLB_BackupFolderPath", ePrefType.text_path, new object[] { /* gadget mode */ "selectFolder" })] - public string BackupFolderPath { get { return _BackupFolderPath; } set { SetProperty(ref _BackupFolderPath, value); } } + public string BackupFolderPath { get { return _BackupFolderPath; } set { SetPropertyIfChanged(ref _BackupFolderPath, value); } } public ZplBackupPluginPreferences() { @@ -28,10 +29,16 @@ public ZplBackupPluginPreferences() BackupFolderPath = ""; } - private void SetProperty(ref T property, T value, [CallerMemberName] string propertyName = "") + private void SetPropertyIfChanged(ref T property, T value, [CallerMemberName] string propertyName = "") { - property = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + var isEqual = property != null && ((IEquatable)property).Equals(value); + + // only update if value is not equal to property. + if (!isEqual) + { + property = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } }