???????????????????????????????.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 ????????????У?????·???μ????????????????