C#???????????????????????????
?????WinterFish ???????[ 2016/8/31 11:07:05 ] ????????.NET C# ????
???????????????????????????????.test
?????????????????????????????????????
????1???????
????2?????????????????????
????3??????????????????????????????
????????????????????????????????
//???????·??
string toolPath = System.Windows.Forms.Application.StartupPath + "\???С????.exe";
string extension = SptdConst.FileExtension;
string fileType = "Email File";
string fileContent = "text/plain";
//??????
Microsoft.Win32.RegistryKey registryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(extension);
if (registryKey != null && registryKey.OpenSubKey("shell") != null && registryKey.OpenSubKey("shell").OpenSubKey("open") != null &&
registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command") != null)
{
var varSub = registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command");
var varValue = varSub.GetValue("");
if (Object.Equals(varValue?? toolPath + " %1"))
{
return;
}
}
//???
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKeyTree(extension?? false);
//??????
registryKey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(extension);
registryKey.SetValue("???????"?? fileType);
registryKey.SetValue("Content Type"?? fileContent);
//??????????
Microsoft.Win32.RegistryKey iconKey = registryKey.CreateSubKey("DefaultIcon");
iconKey.SetValue(""?? System.Windows.Forms.Application.StartupPath + "\logo.ico");
//????????????·??
registryKey = registryKey.CreateSubKey("shell\open\command");
registryKey.SetValue(""?? toolPath + " %1");
//???
registryKey.Close();
??????????????????????????????????????????????????в?????
//????????
//??????·???д????????????????
if (e.Args.Length > 0)
{
string filePath = String.Join(" "?? e.Args.ToArray());
FileInfo file = new FileInfo(filePath);
if (file.Exists)
{
EmailToolConst.DoubleClickSptdFilePath = file.FullName;
}
}
??????????????????loaded?????У??ж?DoubleClickSptdFilePath ????????????У?????·???μ????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11