diff --git a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs index 805b477..8760539 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs @@ -161,7 +161,7 @@ namespace PersistentWindows.Common private static Dictionary windowProcessName = new Dictionary(); private Process process; - private ProcessPriorityClass processPriority; + public ProcessPriorityClass processPriority; private string appDataFolder; public bool redirectAppDataFolder = false; @@ -594,8 +594,6 @@ namespace PersistentWindows.Common public bool Start(bool auto_restore_from_db, bool auto_restore_last_capture_at_startup) { process = Process.GetCurrentProcess(); - processPriority = process.PriorityClass; - string productName = System.Windows.Forms.Application.ProductName; appDataFolder = redirectAppDataFolder ? "." : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), productName); diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs index 909c6d8..73168a9 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs @@ -48,15 +48,6 @@ if not errorlevel 1 goto wait_to_finish"; [STAThread] static void Main(string[] args) { - var process = Process.GetCurrentProcess(); - var process_priority = process.PriorityClass; - process.PriorityClass = ProcessPriorityClass.High; - var timer = new System.Threading.Timer(state => - { - process.PriorityClass = process_priority; - }); - timer.Change(10000, System.Threading.Timeout.Infinite); - Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); @@ -65,6 +56,15 @@ if not errorlevel 1 goto wait_to_finish"; pwp = new PersistentWindowProcessor(); + var process = Process.GetCurrentProcess(); + pwp.processPriority = process.PriorityClass; + process.PriorityClass = ProcessPriorityClass.High; + var timer = new System.Threading.Timer(state => + { + process.PriorityClass = pwp.processPriority; + }); + timer.Change(10000, System.Threading.Timeout.Infinite); + bool splash = true; int delay_restart = 0; int relaunch_delay = 0;