diff --git a/src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs b/src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs index 150446c..857bce6 100644 --- a/src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs +++ b/src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs @@ -93,7 +93,6 @@ - \ No newline at end of file diff --git a/src/Lithnet.Miiserver.AutoSync.Setup/Product.wxs b/src/Lithnet.Miiserver.AutoSync.Setup/Product.wxs index 9391871..2967374 100644 --- a/src/Lithnet.Miiserver.AutoSync.Setup/Product.wxs +++ b/src/Lithnet.Miiserver.AutoSync.Setup/Product.wxs @@ -4,7 +4,7 @@ diff --git a/src/Lithnet.Miiserver.AutoSync/MAExecutor.cs b/src/Lithnet.Miiserver.AutoSync/MAExecutor.cs index 50b3217..2829c57 100644 --- a/src/Lithnet.Miiserver.AutoSync/MAExecutor.cs +++ b/src/Lithnet.Miiserver.AutoSync/MAExecutor.cs @@ -555,6 +555,8 @@ private void Init() try { this.ExecutingRunProfile = action.RunProfileName; + + this.SetExclusiveMode(action); if (this.IsSyncStepOrFimMADeltaImport(action.RunProfileName)) { @@ -579,9 +581,25 @@ private void Init() } } + private void SetExclusiveMode(ExecutionParameters action) + { + // If the debug flags for running serial sync operations are set, then mark the operation as exclusive + if (Settings.RunAllExclusive) + { + action.Exclusive = true; + } + else if (Settings.RunSyncExclusive) + { + if (this.IsSyncStep(action.RunProfileName)) + { + action.Exclusive = true; + } + } + } + private bool IsSyncStepOrFimMADeltaImport(string runProfileName) { - if (this.ma.RunProfiles[runProfileName].RunSteps.Any(t => t.IsSyncStep)) + if (this.IsSyncStep(runProfileName)) { return true; } @@ -597,6 +615,11 @@ private bool IsSyncStepOrFimMADeltaImport(string runProfileName) return false; } + private bool IsSyncStep(string runProfileName) + { + return this.ma.RunProfiles[runProfileName].RunSteps.Any(t => t.IsSyncStep); + } + private void CheckAndQueueUnmanagedChanges() { this.localOperationLock.WaitOne(); diff --git a/src/Lithnet.Miiserver.AutoSync/Settings.cs b/src/Lithnet.Miiserver.AutoSync/Settings.cs index 07b27ab..0b7d8f6 100644 --- a/src/Lithnet.Miiserver.AutoSync/Settings.cs +++ b/src/Lithnet.Miiserver.AutoSync/Settings.cs @@ -139,6 +139,12 @@ public static int MailServerPort } } + + public static bool RunSyncExclusive => Settings.BaseKey.GetValue("ExclusiveSync") as string == "1"; + + public static bool RunAllExclusive => Settings.BaseKey.GetValue("ExclusiveAll") as string == "1"; + + public static bool MailSendOncePerStateChange => Settings.BaseKey.GetValue("MailSendOncePerStateChange") as string != "0"; public static bool RunHistorySave => Settings.BaseKey.GetValue("RunHistorySave") as string == "1";