diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs index 2e62c48e6..52719ec46 100644 --- a/Artemis/Artemis/ArtemisBootstrapper.cs +++ b/Artemis/Artemis/ArtemisBootstrapper.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Forms; @@ -27,6 +25,8 @@ namespace Artemis BindSpecialValues(); } + public Mutex Mutex { get; set; } + private void BindSpecialValues() { MessageBinder.SpecialValues.Add("$scaledmousex", ctx => @@ -109,8 +109,9 @@ namespace Artemis private void CheckDuplicateInstances() { - if (Process.GetProcesses().Count(p => p.ProcessName.Contains(Assembly.GetExecutingAssembly() - .FullName.Split(',')[0]) && !p.Modules[0].FileName.Contains("vshost")) < 2) + bool aIsNewInstance; + Mutex = new Mutex(true, "ArtemisMutex", out aIsNewInstance); + if (aIsNewInstance) return; MessageBox.Show("An instance of Artemis is already running (check your system tray).", diff --git a/Artemis/Artemis/Models/Profiles/Properties/DynamicPropertiesModel.cs b/Artemis/Artemis/Models/Profiles/Properties/DynamicPropertiesModel.cs index 186d70878..1986b5a83 100644 --- a/Artemis/Artemis/Models/Profiles/Properties/DynamicPropertiesModel.cs +++ b/Artemis/Artemis/Models/Profiles/Properties/DynamicPropertiesModel.cs @@ -1,5 +1,4 @@ -using System; -using System.ComponentModel; +using System.ComponentModel; using Artemis.Models.Interfaces; using Artemis.Utilities; using static System.Decimal; @@ -32,7 +31,12 @@ namespace Artemis.Models.Profiles.Properties /// Type of property /// public LayerPropertyType LayerPropertyType { get; set; } - + + /// + /// Extra options on top of the selected properties + /// + public LayerPropertyOptions LayerPropertyOptions { get; set; } + internal void ApplyProperty(IGameDataModel dataModel, KeyboardPropertiesModel properties) { if (LayerPropertyType == LayerPropertyType.PercentageOf) @@ -53,7 +57,7 @@ namespace Artemis.Models.Profiles.Properties return; var percentage = ToDouble(gameProperty)/percentageSource; - var appliedValue = percentage*(double)layerProp.GetValue(properties); + var appliedValue = percentage*(double) layerProp.GetValue(properties); // Opacity requires some special treatment as it causes an exception if it's < 0.0 or > 1.0 if (LayerProperty == "Opacity") @@ -81,4 +85,12 @@ namespace Artemis.Models.Profiles.Properties [Description("% of")] PercentageOf, [Description("% of property")] PercentageOfProperty } + + public enum LayerPropertyOptions + { + [Description("Left to right")] LeftToRight, + [Description("Right to left")] RightToLeft, + [Description("Downwards")] Downwards, + [Description("Upwards")] Upwards + } } \ No newline at end of file