From 5f948af97d86e25ee8627907cd24a974768ce018 Mon Sep 17 00:00:00 2001 From: Anders Malmgren Date: Wed, 22 Mar 2023 15:42:56 +0100 Subject: [PATCH] Moved deprecated attribute to contracts so that Plugins can use them. Deprecated a few members on window plugin --- FreePIE.Core.Contracts/Deprecated.cs | 15 +++++++++++++++ .../FreePIE.Core.Contracts.csproj | 1 + FreePIE.Core.Contracts/Properties/AssemblyInfo.cs | 4 ++-- FreePIE.Core.Plugins/WindowPlugin.cs | 10 ++++++++-- .../Globals/ScriptHelpers/IScriptHelper.cs | 11 ----------- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 FreePIE.Core.Contracts/Deprecated.cs diff --git a/FreePIE.Core.Contracts/Deprecated.cs b/FreePIE.Core.Contracts/Deprecated.cs new file mode 100644 index 00000000..6ae5efaf --- /dev/null +++ b/FreePIE.Core.Contracts/Deprecated.cs @@ -0,0 +1,15 @@ +using System; + +namespace FreePIE.Core.Contracts +{ + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)] + public class Deprecated : Attribute + { + public string ReplacedWith { get; private set; } + + public Deprecated(string replacedWith) + { + ReplacedWith = replacedWith; + } + } +} diff --git a/FreePIE.Core.Contracts/FreePIE.Core.Contracts.csproj b/FreePIE.Core.Contracts/FreePIE.Core.Contracts.csproj index f7a10956..4272c6c2 100644 --- a/FreePIE.Core.Contracts/FreePIE.Core.Contracts.csproj +++ b/FreePIE.Core.Contracts/FreePIE.Core.Contracts.csproj @@ -39,6 +39,7 @@ + diff --git a/FreePIE.Core.Contracts/Properties/AssemblyInfo.cs b/FreePIE.Core.Contracts/Properties/AssemblyInfo.cs index d863321d..85c3dbba 100644 --- a/FreePIE.Core.Contracts/Properties/AssemblyInfo.cs +++ b/FreePIE.Core.Contracts/Properties/AssemblyInfo.cs @@ -31,5 +31,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.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/FreePIE.Core.Plugins/WindowPlugin.cs b/FreePIE.Core.Plugins/WindowPlugin.cs index 96cc4a40..d4488dc8 100644 --- a/FreePIE.Core.Plugins/WindowPlugin.cs +++ b/FreePIE.Core.Plugins/WindowPlugin.cs @@ -100,16 +100,22 @@ public bool isActive(string processName) return plugin.IsActive(processName); } + [Deprecated("activate")] public bool setActive(string processName) { return plugin.Activate(processName); } - public string getActive + public bool activate(string processName) { - get { return plugin.GetActiveWindowProcessName(); } + return plugin.Activate(processName); } + [Deprecated("active")] public string getActive => active; + + public string active => plugin.GetActiveWindowProcessName(); + + public int pollingInterval { set { plugin.PollingInterval = value; } diff --git a/FreePIE.Core/ScriptEngine/Globals/ScriptHelpers/IScriptHelper.cs b/FreePIE.Core/ScriptEngine/Globals/ScriptHelpers/IScriptHelper.cs index 3c0fdaff..7b72aea8 100644 --- a/FreePIE.Core/ScriptEngine/Globals/ScriptHelpers/IScriptHelper.cs +++ b/FreePIE.Core/ScriptEngine/Globals/ScriptHelpers/IScriptHelper.cs @@ -5,16 +5,5 @@ namespace FreePIE.Core.ScriptEngine.Globals.ScriptHelpers [AttributeUsage(AttributeTargets.Method)] public class NeedIndexer : Attribute { } - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)] - public class Deprecated : Attribute - { - public string ReplacedWith { get; private set; } - - public Deprecated(string replacedWith) - { - ReplacedWith = replacedWith; - } - } - public interface IScriptHelper { } } \ No newline at end of file