mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Updated shell ext to createprofile
This commit is contained in:
parent
7e43cd99ef
commit
45e2c32c30
@ -226,13 +226,13 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_7E279826AED3D503C2B7F7DB69F2C6E7"
|
||||
"OwnerKey" = "8:_60AA7260CBB14B2DA5A5237FEBBA6E3B"
|
||||
"OwnerKey" = "8:_3427114400C346E681DEA717B5D9A237"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_7E279826AED3D503C2B7F7DB69F2C6E7"
|
||||
"OwnerKey" = "8:_3427114400C346E681DEA717B5D9A237"
|
||||
"OwnerKey" = "8:_60AA7260CBB14B2DA5A5237FEBBA6E3B"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
@ -394,7 +394,13 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_3427114400C346E681DEA717B5D9A237"
|
||||
"OwnerKey" = "8:_65F5D368273B99C7FE49B20D33031A7B"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_6F55062F4B8FDA7C720DAA94953D9E90"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
@ -406,6 +412,12 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_3427114400C346E681DEA717B5D9A237"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_7E279826AED3D503C2B7F7DB69F2C6E7"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
@ -583,18 +595,6 @@
|
||||
"OwnerKey" = "8:_90FC8214331F53FD9474FAE9E83D2C2C"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_65F5D368273B99C7FE49B20D33031A7B"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_6F55062F4B8FDA7C720DAA94953D9E90"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
"Configurations"
|
||||
{
|
||||
@ -678,7 +678,7 @@
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_703939FB_1800_4C54_9228_AE37F541938E"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"InstallerClass" = "11:FALSE"
|
||||
"CustomActionData" = "8:"
|
||||
"Run64Bit" = "11:TRUE"
|
||||
}
|
||||
@ -693,7 +693,7 @@
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_4CB63466_63BE_413E_AFD3_98040D42F4F1"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"InstallerClass" = "11:FALSE"
|
||||
"CustomActionData" = "8:"
|
||||
"Run64Bit" = "11:TRUE"
|
||||
}
|
||||
@ -1034,7 +1034,7 @@
|
||||
{
|
||||
"AssemblyRegister" = "3:1"
|
||||
"AssemblyIsInGAC" = "11:FALSE"
|
||||
"AssemblyAsmDisplayName" = "8:DisplayMagician.ShellExtension, Version=0.1.0.41963, Culture=neutral, PublicKeyToken=23a864d3136391eb, processorArchitecture=MSIL"
|
||||
"AssemblyAsmDisplayName" = "8:DisplayMagician.ShellExtension, Version=0.1.0.37800, Culture=neutral, PublicKeyToken=23a864d3136391eb, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_3427114400C346E681DEA717B5D9A237"
|
||||
@ -1542,7 +1542,7 @@
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:TRUE"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:TRUE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
@ -1581,7 +1581,7 @@
|
||||
{
|
||||
"AssemblyRegister" = "3:1"
|
||||
"AssemblyIsInGAC" = "11:FALSE"
|
||||
"AssemblyAsmDisplayName" = "8:DisplayMagician.Shared, Version=0.9.5.40335, Culture=neutral, processorArchitecture=MSIL"
|
||||
"AssemblyAsmDisplayName" = "8:DisplayMagician.Shared, Version=0.9.5.36656, Culture=neutral, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_CF2B5512697D3444DA5C7C187AE26988"
|
||||
@ -1892,15 +1892,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:DisplayMagician"
|
||||
"ProductCode" = "8:{78BBD2D7-BE5D-4C74-B612-091C756EF26B}"
|
||||
"PackageCode" = "8:{2712909A-C2E7-4E3C-907A-CEF66D9B7438}"
|
||||
"ProductCode" = "8:{65098CF0-9B4F-4078-9DCA-3EB25C8497B7}"
|
||||
"PackageCode" = "8:{7C3CC1F3-8872-45A6-A688-90E6938B88DC}"
|
||||
"UpgradeCode" = "8:{48CB9401-ADED-4D62-B779-8317C7D069E1}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:FALSE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:TRUE"
|
||||
"ProductVersion" = "8:0.9.0"
|
||||
"ProductVersion" = "8:0.1.0"
|
||||
"Manufacturer" = "8:Terry MacDonald"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
@ -4,6 +4,7 @@
|
||||
{
|
||||
RunShortcut,
|
||||
ChangeProfile,
|
||||
CreateProfile,
|
||||
StartUpNormally
|
||||
}
|
||||
}
|
@ -15,22 +15,23 @@ using Microsoft.Win32;
|
||||
namespace DisplayMagician.ShellExtension
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("de271cd7-fa82-439f-b128-202d473bb51e")]
|
||||
[RegistrationName("DisplayMagician.ShellExtension")]
|
||||
[COMServerAssociation(AssociationType.DesktopBackground)]
|
||||
[Guid("592dcbe6-3052-47bb-b962-101abb5e0ce8")]
|
||||
public class HeliosDesktopMenuExtension : SharpContextMenu
|
||||
public class DisplayMagicianDesktopMenuExtension : SharpContextMenu
|
||||
{
|
||||
// Other constants that are useful
|
||||
internal static Version _version = new Version(1, 0, 0);
|
||||
internal static Version _version = new Version(0, 1, 0);
|
||||
internal static string AlternateAppHomePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DisplayMagician");
|
||||
internal static string AppDataPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
|
||||
private static string AppProfileStoragePath = System.IO.Path.Combine(AppDataPath, $"Profiles");
|
||||
private static string _profileStorageJsonFileName = System.IO.Path.Combine(AppProfileStoragePath, $"DisplayProfiles_{_version.ToString(2)}.json");
|
||||
private static string _profileStorageJsonFileName = System.IO.Path.Combine(AppProfileStoragePath, $"DisplayProfiles_1.0.json");
|
||||
internal static string registryDisplayMagician = @"SOFTWARE\DisplayMagician";
|
||||
string DisplayMagicianFullname = "";
|
||||
string DisplayMagicianInstallDir = "";
|
||||
Process DisplayMagicianProcess = null;
|
||||
|
||||
public HeliosDesktopMenuExtension()
|
||||
public DisplayMagicianDesktopMenuExtension()
|
||||
{ }
|
||||
|
||||
protected override bool CanShowMenu()
|
||||
@ -70,54 +71,65 @@ namespace DisplayMagician.ShellExtension
|
||||
//Logging.Log($"Starting CreateMenu");
|
||||
var explorerMenuStrip = new ContextMenuStrip();
|
||||
|
||||
if (File.Exists(DisplayMagicianFullname))
|
||||
Dictionary<string, string> profiles = new Dictionary<string, string>();
|
||||
|
||||
if (File.Exists(_profileStorageJsonFileName))
|
||||
{
|
||||
//Logging.Log($"{_profileStorageJsonFileName} file exists");
|
||||
MatchCollection mc;
|
||||
string uuid = "";
|
||||
string profileName = "";
|
||||
|
||||
var extensionMenu = new ToolStripMenuItem("DisplayMagician: Change display profiles...", Properties.Resources.DisplayMagicianMenuImage);
|
||||
explorerMenuStrip.Items.Add(extensionMenu);
|
||||
|
||||
Dictionary<string, string> profiles = new Dictionary<string, string>();
|
||||
|
||||
if (File.Exists(_profileStorageJsonFileName))
|
||||
foreach (string aLine in File.ReadLines(_profileStorageJsonFileName, Encoding.Unicode))
|
||||
{
|
||||
MatchCollection mc;
|
||||
string uuid = "";
|
||||
string profileName = "";
|
||||
|
||||
foreach (string aLine in File.ReadLines(_profileStorageJsonFileName, Encoding.Unicode))
|
||||
//Logging.Log($"Processing line: {_profileStorageJsonFileName}");
|
||||
string lineToProcess = aLine;
|
||||
if (lineToProcess.StartsWith(" \"UUID\""))
|
||||
{
|
||||
string lineToProcess = aLine;
|
||||
if (lineToProcess.StartsWith(" \"UUID\""))
|
||||
{
|
||||
mc = Regex.Matches(lineToProcess, " \"UUID\": \"(.*)\"");
|
||||
uuid = mc[0].Groups[1].ToString();
|
||||
}
|
||||
else if (lineToProcess.StartsWith(" \"Name\""))
|
||||
{
|
||||
mc = Regex.Matches(lineToProcess, " \"Name\": \"(.*)\"");
|
||||
profileName = mc[0].Groups[1].ToString();
|
||||
if (!uuid.Equals(""))
|
||||
profiles.Add(profileName, uuid);
|
||||
}
|
||||
|
||||
//Logging.Log($"Line starts with 4 spaces and UUID");
|
||||
mc = Regex.Matches(lineToProcess, " \"UUID\": \"(.*)\"");
|
||||
uuid = mc[0].Groups[1].ToString();
|
||||
}
|
||||
else if (lineToProcess.StartsWith(" \"Name\""))
|
||||
{
|
||||
//Logging.Log($"Line starts with 4 spaces and Name");
|
||||
mc = Regex.Matches(lineToProcess, " \"Name\": \"(.*)\"");
|
||||
profileName = mc[0].Groups[1].ToString();
|
||||
if (!uuid.Equals(""))
|
||||
profiles.Add(profileName, uuid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (profiles.Count > 0)
|
||||
{
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> pair in profiles.OrderBy(key => key.Key))
|
||||
{
|
||||
extensionMenu.DropDownItems.Add(new ToolStripMenuItem(pair.Key, null,
|
||||
(sender, args) =>
|
||||
{
|
||||
Logging.Log(DisplayMagicianFullname + $" ChangeProfile \"{pair.Value}\"");
|
||||
DisplayMagicianProcess = Process.Start(DisplayMagicianFullname,$"ChangeProfile \"{pair.Value}\"");
|
||||
Logging.Log(DisplayMagicianProcess.ToString());
|
||||
}
|
||||
));
|
||||
}
|
||||
var extensionMenu = new ToolStripMenuItem("DisplayMagician: Change display profiles...", Properties.Resources.DisplayMagicianMenuImage);
|
||||
explorerMenuStrip.Items.Add(extensionMenu);
|
||||
|
||||
// Add the first menu to create a new Displaay Profile
|
||||
extensionMenu.DropDownItems.Add(new ToolStripMenuItem("Create a new display profile", null,
|
||||
(sender, args) =>
|
||||
{
|
||||
//Logging.Log(DisplayMagicianFullname + $" CreateProfile");
|
||||
DisplayMagicianProcess = Process.Start(DisplayMagicianFullname, $"CreateProfile");
|
||||
//Logging.Log(DisplayMagicianProcess.ToString());
|
||||
}
|
||||
));
|
||||
|
||||
if (profiles.Count > 0)
|
||||
{
|
||||
extensionMenu.DropDownItems.Add(new ToolStripSeparator());
|
||||
|
||||
foreach (KeyValuePair<string, string> pair in profiles.OrderBy(key => key.Key))
|
||||
{
|
||||
extensionMenu.DropDownItems.Add(new ToolStripMenuItem(pair.Key, null,
|
||||
(sender, args) =>
|
||||
{
|
||||
//Logging.Log(DisplayMagicianFullname + $" ChangeProfile \"{pair.Value}\"");
|
||||
DisplayMagicianProcess = Process.Start(DisplayMagicianFullname,$"ChangeProfile \"{pair.Value}\"");
|
||||
//Logging.Log(DisplayMagicianProcess.ToString());
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly: Guid("592dcbe6-3052-47bb-b962-101abb5e0ce8")]
|
||||
[assembly: Guid("592ecbe6-3052-47bb-b962-101abb5e0ce9")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
|
@ -129,6 +129,32 @@ namespace DisplayMagician {
|
||||
});
|
||||
});
|
||||
|
||||
// This is the CreateProfile command
|
||||
app.Command(DisplayMagicianStartupAction.CreateProfile.ToString(), (createProfileCmd) =>
|
||||
{
|
||||
var argumentProfile = runProfileCmd.Argument("\"Profile_UUID\"", "(required) The UUID of the profile to run from those stored in the profile file.").IsRequired();
|
||||
argumentProfile.Validators.Add(new ProfileMustExistValidator());
|
||||
|
||||
//description and help text of the command.
|
||||
createProfileCmd.Description = "Use this command to go directly to the create display profile screen.";
|
||||
|
||||
createProfileCmd.OnExecute(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Lookup the profile
|
||||
ProfileItem profileToUse = ProfileRepository.AllProfiles.Where(p => p.UUID.Equals(argumentProfile.Value)).First();
|
||||
|
||||
ApplyProfile(profileToUse);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.OnExecute(() =>
|
||||
{
|
||||
|
||||
|
@ -1,16 +1,12 @@
|
||||
using AudioSwitcher.AudioApi.CoreAudio;
|
||||
using DisplayMagician.GameLibraries;
|
||||
using DisplayMagician.InterProcess;
|
||||
using DisplayMagician.Resources;
|
||||
using DisplayMagician.Shared;
|
||||
using Newtonsoft.Json;
|
||||
using NvAPIWrapper.Mosaic;
|
||||
using NvAPIWrapper.Native.Mosaic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.IconLib;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
Loading…
Reference in New Issue
Block a user