diff --git a/DockerForm/DockerForm.csproj b/DockerForm/DockerForm.csproj index 9957359..d50086c 100644 --- a/DockerForm/DockerForm.csproj +++ b/DockerForm/DockerForm.csproj @@ -249,7 +249,7 @@ - Always + PreserveNewest diff --git a/DockerForm/Form1.cs b/DockerForm/Form1.cs index f3a60c3..82eb1d3 100644 --- a/DockerForm/Form1.cs +++ b/DockerForm/Form1.cs @@ -115,12 +115,12 @@ private void OnPowerModeChanged(object s, PowerModeChangedEventArgs e) private static bool CanRunProfile(PowerProfile profile, bool IsFirstBoot) { - bool isOnBattery = (profile.ApplyMask & (byte)ProfileMask.OnBattery) == (byte)ProfileMask.OnBattery; - bool isPluggedIn = (profile.ApplyMask & (byte)ProfileMask.PluggedIn) == (byte)ProfileMask.PluggedIn; - bool isExtGPU = (profile.ApplyMask & (byte)ProfileMask.ExternalGPU) == (byte)ProfileMask.ExternalGPU; - bool isOnBoot = (profile.ApplyMask & (byte)ProfileMask.OnStartup) == (byte)ProfileMask.OnStartup; - bool isOnStatusChange = (profile.ApplyMask & (byte)ProfileMask.OnStatusChange) == (byte)ProfileMask.OnStatusChange; - bool isOnScreen = (profile.ApplyMask & (byte)ProfileMask.ExternalScreen) == (byte)ProfileMask.ExternalScreen; + bool isOnBattery = profile._ApplyMask.HasFlag(ProfileMask.OnBattery); + bool isPluggedIn = profile._ApplyMask.HasFlag(ProfileMask.PluggedIn); + bool isExtGPU = profile._ApplyMask.HasFlag(ProfileMask.ExternalGPU); + bool isOnBoot = profile._ApplyMask.HasFlag(ProfileMask.OnStartup); + bool isOnStatusChange = profile._ApplyMask.HasFlag(ProfileMask.OnStatusChange); + bool isOnScreen = profile._ApplyMask.HasFlag(ProfileMask.ExternalScreen); if (IsFirstBoot && !isOnBoot) return false; @@ -586,7 +586,7 @@ public void InsertOrUpdateGameItem(DockerGame game, bool auto) public void UpdateGameList() { - // Read all the game files (xml) + // Read all the game files (dat) string[] fileEntries = Directory.GetFiles(path_database, "*.dat"); foreach (string filename in fileEntries) { @@ -809,7 +809,7 @@ public Form1() } // update MCHBAR - string command = "/Min /Nologo /Stdout /command=\"Delay 1000;rpci32 0 0 0 0x48;rwexit\""; + string command = "/Min /Nologo /Stdout /command=\"Delay 1000;rpci32 0 0 0 0x48;Delay 1000;rwexit\""; var proc = new Process { StartInfo = new ProcessStartInfo @@ -834,6 +834,7 @@ public Form1() MCHBAR = MCHBAR.Substring(0, 6) + "59"; break; } + proc.Dispose(); /* string ProcessorID = GetProcessorID(); switch (ProcessorID.Substring(ProcessorID.Length - 5)) diff --git a/DockerForm/PowerProfile.cs b/DockerForm/PowerProfile.cs index 3234952..b21e945 100644 --- a/DockerForm/PowerProfile.cs +++ b/DockerForm/PowerProfile.cs @@ -9,12 +9,14 @@ namespace DockerForm [Flags] public enum ProfileMask { - OnBattery = 0x01, // 0000 0000 0000 0001 - PluggedIn = 0x02, // 0000 0000 0000 0010 - ExternalGPU = 0x04, // 0000 0000 0000 0100 - OnStartup = 0x08, // 0000 0000 0000 1000 - ExternalScreen = 0x16, // 0000 0000 0001 0000 - OnStatusChange = 0x32, // 0000 0000 0010 0000 + None = 0, + OnBattery = 1, + PluggedIn = 2, + ExternalGPU = 4, + OnStartup = 8, + ExternalScreen = 16, + OnStatusChange = 32, + All = OnBattery | PluggedIn | ExternalGPU | OnStartup | ExternalScreen | OnStatusChange } public static class StringExtension @@ -40,7 +42,13 @@ public class PowerProfile : IDisposable public string CPUCore, IntelGPU, CPUCache, SystemAgent; public string PowerBalanceCPU, PowerBalanceGPU; public string ProfileName = ""; - public byte ApplyMask = 0; + [XmlIgnore] + public ProfileMask _ApplyMask = ProfileMask.None; + public int ApplyMask + { + get { return (int)_ApplyMask; } + set { _ApplyMask = (ProfileMask)value; } + } public int ApplyPriority = 0; [NonSerialized()] public bool RunMe; diff --git a/DockerForm/Properties/AssemblyInfo.cs b/DockerForm/Properties/AssemblyInfo.cs index 0967fc9..5dba336 100644 --- a/DockerForm/Properties/AssemblyInfo.cs +++ b/DockerForm/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.0.1")] -[assembly: AssemblyFileVersion("0.1.0.1")] +[assembly: AssemblyVersion("0.1.0.3")] +[assembly: AssemblyFileVersion("0.1.0.3")] diff --git a/DockerForm/Settings.cs b/DockerForm/Settings.cs index f6760dc..813dc13 100644 --- a/DockerForm/Settings.cs +++ b/DockerForm/Settings.cs @@ -109,10 +109,13 @@ public Settings(Form1 form, DockerGame game) foreach (PowerProfile profile in Form1.ProfileDB.Values) { - bool isOnBattery = (profile.ApplyMask & (byte)ProfileMask.OnBattery) == (byte)ProfileMask.OnBattery; - bool isPluggedIn = (profile.ApplyMask & (byte)ProfileMask.PluggedIn) == (byte)ProfileMask.PluggedIn; - bool isExtGPU = (profile.ApplyMask & (byte)ProfileMask.ExternalGPU) == (byte)ProfileMask.ExternalGPU; - bool isOnScreen = (profile.ApplyMask & (byte)ProfileMask.ExternalScreen) == (byte)ProfileMask.ExternalScreen; + bool isOnBattery = profile._ApplyMask.HasFlag(ProfileMask.OnBattery); + bool isPluggedIn = profile._ApplyMask.HasFlag(ProfileMask.PluggedIn); + bool isExtGPU = profile._ApplyMask.HasFlag(ProfileMask.ExternalGPU); + bool isOnBoot = profile._ApplyMask.HasFlag(ProfileMask.OnStartup); + bool isOnStatusChange = profile._ApplyMask.HasFlag(ProfileMask.OnStatusChange); + bool isOnScreen = profile._ApplyMask.HasFlag(ProfileMask.ExternalScreen); + ListViewItem newProfile = new ListViewItem(new string[] { profile.ProfileName, isOnBattery.ToString(), isPluggedIn.ToString(), isExtGPU.ToString(), isOnScreen.ToString() }, profile.ProfileName); // skip default