Skip to content

Commit

Permalink
Update for latest IDE.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrapivin committed Aug 15, 2021
1 parent f4078ed commit cb650cb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
4 changes: 2 additions & 2 deletions ZplBackupPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
14 changes: 6 additions & 8 deletions ZplBackupPlugin/ZplBackupPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="CoreResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=83c29ed24e39e35e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\CoreResources.dll</HintPath>
<Reference Include="CoreResources">
<HintPath>..\..\..\..\Progs\GameMakerStudio\23\IDE\CoreResources.dll</HintPath>
</Reference>
<Reference Include="IDE">
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\IDE.dll</HintPath>
<HintPath>..\..\..\..\Progs\GameMakerStudio\23\IDE\IDE.dll</HintPath>
</Reference>
<Reference Include="OSCore, Version=2.3.2.560, Culture=neutral, PublicKeyToken=83c29ed24e39e35e, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\OSCore.dll</HintPath>
<Reference Include="OSCore">
<HintPath>..\..\..\..\Progs\GameMakerStudio\23\IDE\OSCore.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Utils">
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\GameMaker Studio 2 Desktop\Utils.dll</HintPath>
<HintPath>..\..\..\..\Progs\GameMakerStudio\23\IDE\Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion ZplBackupPlugin/ZplBackupPluginCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
using YoYoStudio.Resources;
using YoYoStudio.Core.Utils.SourceControl;
using YoYoStudio.GUI;
using YoYoStudio.Plugins.Attributes;

namespace YoYoStudio
{
namespace Plugins
{
namespace ZplBackupPlugin
{
[ModuleName("BackupCommand", "Handles project backup")]
public class ZplBackupPluginCommand : IModule, IDisposable
{
public bool Stop { get; set; }
Expand Down Expand Up @@ -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;
}
}
Expand Down
21 changes: 14 additions & 7 deletions ZplBackupPlugin/ZplBackupPluginPreferences.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using YoYoStudio.Core.Utils.Preferences;

Expand All @@ -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()
{
Expand All @@ -28,10 +29,16 @@ public ZplBackupPluginPreferences()
BackupFolderPath = "";
}

private void SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = "")
private void SetPropertyIfChanged<T>(ref T property, T value, [CallerMemberName] string propertyName = "")
{
property = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
var isEqual = property != null && ((IEquatable<T>)property).Equals(value);

// only update if value is not equal to property.
if (!isEqual)
{
property = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
Expand Down

0 comments on commit cb650cb

Please sign in to comment.