Пример #1
0
        private void SetAssocBox(string name, CheckBox box)
        {
            if ((bool)box.Tag == box.Checked)
            {
                return;
            }

            FileAssociation assoc = new FileAssociation("." + name.ToLower());
            FileType        t     = new FileType("SSBB." + name.ToUpper());

            if (box.Checked)
            {
                assoc.FileType = t;
                t.SetShellCommand("open", String.Format("\"{0}\" \"%1\"", Application.ExecutablePath));
                //t.DefaultIcon = String.Format("\"{0}\",1", Application.ExecutablePath);
            }
            else
            {
                t.Delete();
                assoc.Delete();
            }

            box.Tag = box.Checked;
        }