I'm using BrendanGrant.Helpers.FileAssociation;
(a NuGet package) to create file-associations for my application. It works fine so far. However, I have a problem with the ProgramVerb
s:
When I create a ProgramAssociation and add verbs to it like this:
var pai = new ProgramAssociationInfo(fai.ProgID);
pai.Create(
"App name",
new[]
{
new ProgramVerb("Öffnen", Assembly.GetEntryAssembly().Location + " \"%1\""),
new ProgramVerb("Bearbeiten", Assembly.GetEntryAssembly().Location + " \"%1\"")
});
}
The Bearbeiten and Öffnen (edit and open) keywords are lowercase in the contextmenu of windows explorer:
I named the 2nd entry WAAAA to test if its something only changing the first character, but apparently its not.
What do I have to change, so that my Bearbeiten and Öffnen is uppercase in the context menu?
I checked this library and it seems that you have no influence on this behavior.
This is the line that changes to lowercase:
RegistryKey subKey2 = subKey1.CreateSubKey(verb.Name.ToLower());
_
protected void SetVerbs(ProgramVerb[] verbs)
{
if (!this.Exists)
throw new Exception("Extension does not exist");
RegistryKey registryKey = RegistryHelper.AssociationsRoot.OpenSubKey(this.progId, true);
if (registryKey.OpenSubKey("shell", true) != null)
registryKey.DeleteSubKeyTree("shell");
RegistryKey subKey1 = registryKey.CreateSubKey("shell");
foreach (ProgramVerb verb in verbs)
{
RegistryKey subKey2 = subKey1.CreateSubKey(verb.Name.ToLower());
RegistryKey subKey3 = subKey2.CreateSubKey("command");
subKey3.SetValue(string.Empty, (object) verb.Command, RegistryValueKind.ExpandString);
subKey3.Close();
subKey2.Close();
}
ShellNotification.NotifyOfChange();
}
Instead of collection assignment you should use AddVerb(ProgramVerb verb) method and then uppercase should be kept:
pai.Create("App name", new ProgramVerb[0]);
pai.AddVerb(new ProgramVerb("Öffnen", Assembly.GetEntryAssembly().Location + " \"%1\""));
pai.AddVerb(new ProgramVerb("Bearbeiten", Assembly.GetEntryAssembly().Location + " \"%1\""));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With