コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Jorch72/CS-Patchy
        private static void AssociateTorrents(string installationPath)
        {
            var path    = Path.Combine(installationPath, "Patchy.exe");
            var startup = string.Format("\"{0}\" \"%1\"", path);

            using (var torrent = Registry.ClassesRoot.CreateSubKey(".torrent"))
            {
                torrent.SetValue(null, "Patchy.exe");
                torrent.SetValue("Content Type", "application/x-bittorrent");
            }
            using (var patchy = Registry.ClassesRoot.CreateSubKey("Patchy.exe"))
            {
                patchy.SetValue(null, "BitTorrent File");
                patchy.SetValue("DefaultIcon", path + ",0");
                using (var shell = patchy.CreateSubKey("shell"))
                    using (var open = shell.CreateSubKey("open"))
                        using (var command = open.CreateSubKey("command"))
                            command.SetValue(null, startup);
            }
            ShellNotification.NotifyOfChange();
        }
コード例 #2
0
 public static void NotifyShellOfChange()
 {
     ShellNotification.NotifyOfChange();
 }