diff --git a/DisplayMagician/Program.cs b/DisplayMagician/Program.cs index e184db0..c9f17b8 100644 --- a/DisplayMagician/Program.cs +++ b/DisplayMagician/Program.cs @@ -468,7 +468,7 @@ namespace DisplayMagician { if (File.Exists(oldv22ShortcutsFile)) { logger.Info($"Program/Main: Upgrading v2.2 shortcut file {oldv2ShortcutsFile} to latest shortcut file {targetShortcutsFile}."); - File.Copy(oldv2ShortcutsFile, targetShortcutsFile); + File.Copy(oldv22ShortcutsFile, targetShortcutsFile); } else if (File.Exists(oldv2ShortcutsFile)) { @@ -481,6 +481,11 @@ namespace DisplayMagician { File.Copy(oldv1ShortcutsFile, targetShortcutsFile); } + // Load the Shortcuts so that they get populated with default values as part of the upgrade + ShortcutRepository.LoadShortcuts(); + // Now save the shortcuts so the new default values get written to disk + ShortcutRepository.SaveShortcuts(); + } else { diff --git a/DisplayMagician/ProgramSettings.cs b/DisplayMagician/ProgramSettings.cs index 7b0e825..c0dffe2 100644 --- a/DisplayMagician/ProgramSettings.cs +++ b/DisplayMagician/ProgramSettings.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Reflection; using System.Text; @@ -41,6 +42,7 @@ namespace DisplayMagician #endregion #region Class Properties + [DefaultValue(0)] public string DisplayMagicianVersion { get @@ -56,6 +58,8 @@ namespace DisplayMagician _displayMagicianVersion = value; } } + + [DefaultValue(false)] public bool StartOnBootUp { get @@ -68,6 +72,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool ShowSplashScreen { get @@ -80,6 +85,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool ShowMinimiseMessageInActionCenter { get @@ -92,6 +98,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool ShowStatusMessageInActionCenter { get @@ -104,6 +111,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool UpgradeToPreReleases { get @@ -116,6 +124,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool UpgradeEnabled { get @@ -128,6 +137,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool MinimiseOnStart { get { @@ -139,6 +149,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool InstalledDesktopContextMenu { get @@ -151,6 +162,7 @@ namespace DisplayMagician } } + [DefaultValue(0)] public int LastMessageIdRead { get @@ -163,6 +175,7 @@ namespace DisplayMagician } } + [DefaultValue(default(List))] public List MessagesToMonitor { get @@ -175,6 +188,7 @@ namespace DisplayMagician } } + [DefaultValue("Trace")] public string LogLevel { get @@ -212,6 +226,7 @@ namespace DisplayMagician } } + [DefaultValue(Keys.None)] public Keys HotkeyMainWindow { get @@ -224,6 +239,7 @@ namespace DisplayMagician } } + [DefaultValue(Keys.None)] public Keys HotkeyDisplayProfileWindow { get @@ -236,6 +252,7 @@ namespace DisplayMagician } } + [DefaultValue(Keys.None)] public Keys HotkeyShortcutLibraryWindow { get diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs index b97cf74..aac4b18 100644 --- a/DisplayMagician/Properties/AssemblyInfo.cs +++ b/DisplayMagician/Properties/AssemblyInfo.cs @@ -26,8 +26,8 @@ using System.Resources; [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")] // Version information -[assembly: AssemblyVersion("2.5.0.76")] -[assembly: AssemblyFileVersion("2.5.0.76")] +[assembly: AssemblyVersion("2.5.0.81")] +[assembly: AssemblyFileVersion("2.5.0.81")] [assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: CLSCompliant(true)] diff --git a/DisplayMagician/ShortcutItem.cs b/DisplayMagician/ShortcutItem.cs index 1b48ce7..e34d76d 100644 --- a/DisplayMagician/ShortcutItem.cs +++ b/DisplayMagician/ShortcutItem.cs @@ -16,6 +16,7 @@ using IWshRuntimeLibrary; using AudioSwitcher.AudioApi.CoreAudio; using AudioSwitcher.AudioApi; using TsudaKageyu; +using System.ComponentModel; namespace DisplayMagician { @@ -195,10 +196,7 @@ namespace DisplayMagician // If Autoname is on, and then lets autoname it! // That populates all the right things AutoSuggestShortcutName(); - } - - //RefreshValidity(); - + } } public static Version Version @@ -206,7 +204,7 @@ namespace DisplayMagician get => new Version(1, 0); } - + [DefaultValue("")] public string UUID { get @@ -222,6 +220,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string Name { get @@ -234,6 +233,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool AutoName { get @@ -269,6 +269,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string ProfileUUID { get { @@ -287,6 +288,7 @@ namespace DisplayMagician } } + [DefaultValue(ShortcutPermanence.Temporary)] public ShortcutPermanence DisplayPermanence { get @@ -300,6 +302,7 @@ namespace DisplayMagician } } + [DefaultValue(ShortcutPermanence.Temporary)] public ShortcutPermanence AudioPermanence { get @@ -313,6 +316,7 @@ namespace DisplayMagician } } + [DefaultValue(ShortcutPermanence.Temporary)] public ShortcutPermanence CapturePermanence { get @@ -326,6 +330,7 @@ namespace DisplayMagician } } + [DefaultValue(ShortcutCategory.Game)] public ShortcutCategory Category { get @@ -339,6 +344,7 @@ namespace DisplayMagician } } + [DefaultValue(ProcessPriority.Normal)] public ProcessPriority ProcessPriority { get @@ -352,6 +358,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string DifferentExecutableToMonitor { get @@ -365,6 +372,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string ExecutableNameAndPath { get @@ -384,6 +392,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string ExecutableArguments { get @@ -397,6 +406,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool ExecutableArgumentsRequired { get @@ -410,6 +420,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool RunExeAsAdministrator { get @@ -423,6 +434,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool ProcessNameToMonitorUsesExecutable { get @@ -436,6 +448,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string GameAppId { get @@ -449,6 +462,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string GameName { get @@ -462,6 +476,7 @@ namespace DisplayMagician } } + [DefaultValue(SupportedGameLibraryType.Unknown)] public SupportedGameLibraryType GameLibrary { get @@ -476,6 +491,7 @@ namespace DisplayMagician } #pragma warning disable CS3003 // Type is not CLS-compliant + [DefaultValue(Keys.None)] public Keys Hotkey #pragma warning restore CS3003 // Type is not CLS-compliant { @@ -489,6 +505,7 @@ namespace DisplayMagician } } + [DefaultValue(20)] public int StartTimeout { get @@ -502,6 +519,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string GameArguments { get @@ -528,6 +546,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string DifferentGameExeToMonitor { get @@ -554,7 +573,7 @@ namespace DisplayMagician } } - + [DefaultValue("")] public string AudioDevice { get @@ -568,6 +587,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool ChangeAudioDevice { get @@ -581,7 +601,7 @@ namespace DisplayMagician } } - + [DefaultValue(true)] public bool UseAsCommsAudioDevice { get @@ -593,8 +613,9 @@ namespace DisplayMagician { _useAsCommsAudioDevice = value; } - } + } + [DefaultValue(50)] public decimal AudioVolume { get @@ -608,6 +629,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool SetAudioVolume { get @@ -621,6 +643,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string CaptureDevice { get @@ -634,6 +657,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool ChangeCaptureDevice { get @@ -647,6 +671,7 @@ namespace DisplayMagician } } + [DefaultValue(true)] public bool UseAsCommsCaptureDevice { get @@ -660,6 +685,7 @@ namespace DisplayMagician } } + [DefaultValue(50)] public decimal CaptureVolume { get @@ -673,6 +699,7 @@ namespace DisplayMagician } } + [DefaultValue(false)] public bool SetCaptureVolume { get @@ -686,6 +713,7 @@ namespace DisplayMagician } } + [DefaultValue(default(List))] public List StartPrograms { get @@ -699,6 +727,7 @@ namespace DisplayMagician } } + [DefaultValue(default(List))] public List StopPrograms { get @@ -712,7 +741,7 @@ namespace DisplayMagician } } - + [DefaultValue("")] public string OriginalIconPath { get { @@ -728,6 +757,7 @@ namespace DisplayMagician } } + [DefaultValue(default(Bitmap))] [JsonConverter(typeof(CustomBitmapConverter))] public Bitmap OriginalLargeBitmap { @@ -747,6 +777,7 @@ namespace DisplayMagician } } + [DefaultValue(default(Bitmap))] [JsonConverter(typeof(CustomBitmapConverter))] public Bitmap ShortcutBitmap { @@ -761,6 +792,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public string SavedShortcutIconCacheFilename { get @@ -800,6 +832,7 @@ namespace DisplayMagician } } + [DefaultValue("")] public ShortcutBitmap SelectedImage { get @@ -814,6 +847,7 @@ namespace DisplayMagician } } + [DefaultValue(default(List))] public List AvailableImages { get diff --git a/DisplayMagician/ShortcutRepository.cs b/DisplayMagician/ShortcutRepository.cs index f274b2f..0c78760 100644 --- a/DisplayMagician/ShortcutRepository.cs +++ b/DisplayMagician/ShortcutRepository.cs @@ -406,7 +406,7 @@ namespace DisplayMagician } } - private static bool LoadShortcuts() + public static bool LoadShortcuts() { logger.Debug($"ShortcutRepository/LoadShortcuts: Loading shortcuts from {_shortcutStorageJsonFileName} into the Shortcut Repository"); diff --git a/DisplayMagicianShared/ProfileItem.cs b/DisplayMagicianShared/ProfileItem.cs index 608a904..2ebe810 100644 --- a/DisplayMagicianShared/ProfileItem.cs +++ b/DisplayMagicianShared/ProfileItem.cs @@ -14,6 +14,7 @@ using DisplayMagicianShared.AMD; using DisplayMagicianShared.NVIDIA; using DisplayMagicianShared.Windows; using System.Runtime.InteropServices; +using System.ComponentModel; namespace DisplayMagicianShared { @@ -155,6 +156,8 @@ namespace DisplayMagicianShared #region Instance Properties + [DefaultValue("")] + public string UUID { get @@ -199,8 +202,11 @@ namespace DisplayMagicianShared } } + [DefaultValue(VIDEO_MODE.WINDOWS)] + public virtual VIDEO_MODE VideoMode { get; set; } = VIDEO_MODE.WINDOWS; + [DefaultValue(Keys.None)] public Keys Hotkey { get { @@ -212,9 +218,11 @@ namespace DisplayMagicianShared } } + [DefaultValue("")] + public virtual string Name { get; set; } - [JsonRequired] + [JsonRequired] public NVIDIA_DISPLAY_CONFIG NVIDIADisplayConfig { get @@ -291,13 +299,16 @@ namespace DisplayMagicianShared } } + [DefaultValue("")] public string SavedProfileIconCacheFilename { get; set; } - + [DefaultValue(Wallpaper.Mode.DoNothing)] public Wallpaper.Mode WallpaperMode { get; set; } + [DefaultValue(Wallpaper.Style.Fill)] public Wallpaper.Style WallpaperStyle { get; set; } + [DefaultValue("")] public string WallpaperBitmapFilename{ get { @@ -309,6 +320,7 @@ namespace DisplayMagicianShared } } + [DefaultValue(default(List))] public virtual List ProfileDisplayIdentifiers { get @@ -326,6 +338,7 @@ namespace DisplayMagicianShared } } + [DefaultValue(default(Bitmap))] [JsonConverter(typeof(CustomBitmapConverter))] public virtual Bitmap ProfileBitmap { @@ -346,6 +359,7 @@ namespace DisplayMagicianShared } + [DefaultValue(default(Bitmap))] [JsonConverter(typeof(CustomBitmapConverter))] public virtual Bitmap ProfileTightestBitmap { diff --git a/DisplayMagicianShared/ProfileRepository.cs b/DisplayMagicianShared/ProfileRepository.cs index 33d5c23..082d719 100644 --- a/DisplayMagicianShared/ProfileRepository.cs +++ b/DisplayMagicianShared/ProfileRepository.cs @@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; +using System.ComponentModel; namespace DisplayMagicianShared {