Пример #1
0
        private static void checkWYZFileAssociation()
        {
            if (Properties.Settings.Default.CheckFileAssociation)
            {
                FileAssociationInfo fai = new FileAssociationInfo(".wyz");

                bool refreshAssociation = !fai.Exists;
                if (!refreshAssociation)
                {
                    ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);
                    refreshAssociation = (!pai.Exists ||
                                          pai.Verbs.Length == 0 ||
                                          !pai.Verbs[0].Command.ToLower().Contains(Application.ExecutablePath.ToLower()));
                }

                if (refreshAssociation)
                {
                    DlgFileAssociationCheck dlgFileAssocCheck = new DlgFileAssociationCheck();
                    if (dlgFileAssocCheck.ShowDialog() == DialogResult.Yes)
                    {
                        Process newProcess = new Process();
                        newProcess.StartInfo.FileName  = Application.ExecutablePath;
                        newProcess.StartInfo.Verb      = "runas";
                        newProcess.StartInfo.Arguments = CREATE_ASSOC_PARAM;
                        newProcess.Start();
                        newProcess.WaitForExit();
                    }
                }
            }
        }
Пример #2
0
        private static void createWYZFileAssociation()
        {
            FileAssociationInfo fai = new FileAssociationInfo(".wyz");

            if (!fai.Exists)
            {
                fai.Create("WYZTracker");
                fai.ContentType  = "application/wyz-song-file";
                fai.OpenWithList = new string[] {
                    "WYZTracker.exe"
                };
            }

            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!pai.Exists ||
                pai.Verbs.Length == 0 ||
                !pai.Verbs[0].Command.ToLower().Contains(Application.ExecutablePath.ToLower()))
            {
                pai.Create(
                    WYZTracker.Properties.Resources.WYZFileDesc,
                    new ProgramVerb(
                        WYZTracker.Properties.Resources.OpenVerb,
                        string.Format("\"{0}\" \"%1\"", Application.ExecutablePath)
                        )
                    );
                pai.DefaultIcon = new ProgramIcon(Application.ExecutablePath);
            }
        }
Пример #3
0
    public static void Main()
    {
        FileAssociationInfo fa = new FileAssociationInfo(".txt");

        Console.WriteLine("{0} files are handled by '{1}'", fa.Extension, fa.Open);
        fa.Dispose();
    }
Пример #4
0
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //run with admin - set file assoc
            FileAssociationInfo fai = new FileAssociationInfo(".zpaq");

            if (!fai.Exists)
            {
                fai.Create("zpaq_gui");
                //fai.ContentType = "application/zpaq"; //MIME type (is optional)
                fai.OpenWithList = new string[] { "zpaq-gui.exe" };
            }
            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!pai.Exists)
            {
                pai.Create
                (
                    //Description of program/file type
                    ".zpaq compression",

                    new ProgramVerb
                    (
                        //Verb name
                        "Open",
                        //Path and arguments to use

                        System.Reflection.Assembly.GetEntryAssembly().Location
                    )
                );

                //optional
                pai.DefaultIcon = new ProgramIcon(@"C:\SomePath\SomeIcon.ico");
            }
        }
Пример #5
0
        //Wipes out existing open with list and replaces them with provided list
        private void addOpenWith_Click(object sender, EventArgs e)
        {
            string extension = (string)extensionsListBox.SelectedItem;

            FileAssociationInfo fa = new FileAssociationInfo(extension);

            if (!fa.Exists)
            {
                return;
            }

            AddOpenWithDialog f = new AddOpenWithDialog();

            if (f.ShowDialog() == DialogResult.OK)
            {
                List <string> l = new List <string>();

                l.AddRange(fa.OpenWithList);
                if (!l.Contains(f.ProgramName))
                {
                    l.Add(f.ProgramName);
                    fa.OpenWithList = l.ToArray();

                    refreshExtensionsButton_Click(null, null);
                    extensionsListBox.SelectedItem = extension;
                }
            }
        }
Пример #6
0
        //Update values related to extension that have changed
        private void extensionUpdateButton_Click(object sender, EventArgs e)
        {
            string extension = (string)extensionsListBox.SelectedItem;

            FileAssociationInfo fa = new FileAssociationInfo(extension);

            if (programIdTextBox.Text != (string)programIdTextBox.Tag)
            {
                fa.ProgID = programIdTextBox.Text;
            }

            if (contentTypeTextBox.Text != (string)contentTypeTextBox.Tag)
            {
                fa.ContentType = contentTypeTextBox.Text;
            }

            if (PerceivedTypeComboBox.SelectedIndex != (int)PerceivedTypeComboBox.Tag)
            {
                fa.PerceivedType = (PerceivedTypes)PerceivedTypeComboBox.SelectedIndex;
            }

            if (persistentHandlerTextBox.Text != (string)persistentHandlerTextBox.Tag)
            {
                fa.PersistentHandler = new Guid(persistentHandlerTextBox.Text);
            }

            refreshExtensionsButton_Click(null, null);
            extensionsListBox.SelectedItem = extension;
        }
Пример #7
0
        //Wipes out existing open with list and replaces them with provided list
        private void removeOpenWith_Click(object sender, EventArgs e)
        {
            string extension = (string)extensionsListBox.SelectedItem;

            FileAssociationInfo fa = new FileAssociationInfo(extension);

            if (!fa.Exists)
            {
                return;
            }

            List <string> l = new List <string>();

            l.AddRange(fa.OpenWithList);


            if (l.Contains(openWithListBox.SelectedItem.ToString()))
            {
                l.Remove(openWithListBox.SelectedItem.ToString());
                fa.OpenWithList = l.ToArray();

                refreshExtensionsButton_Click(null, null);
                extensionsListBox.SelectedItem = extension;
            }
        }
Пример #8
0
        private static void RegisterFileType(string extensionType)
        {
            string id = "ilSFV-" + extensionType.ToUpper();
            FileAssociationInfo fai = new FileAssociationInfo("." + extensionType.ToLower());

            if (fai.Exists)
            {
                fai.Delete();
            }
            fai.Create(id);

            string path = Assembly.GetExecutingAssembly().Location;

            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (pai.Exists)
            {
                pai.Delete();
            }

            pai.Create
            (
                string.Format("{0} File", extensionType.ToUpper()),
                new ProgramVerb("Open", path + " \"%1\"")
            );

            /*RegistryWrapper reg = new RegistryWrapper();
             * reg.Write(string.Format(@"{0}\shell\ilSFV", id), "MUIVerb", "ilSFV");
             * reg.Write(string.Format(@"{0}\shell\ilSFV", id), "MultiSelectModel", "Single");
             * reg.Write(string.Format(@"{0}\shell\ilSFV", id), "SubCommands", "ilsfv.verify");*/
        }
Пример #9
0
        /// <summary>
        /// Opens the given file path in the default program.
        /// </summary>
        /// <param name="file">The file to open.</param>
        public static void OpenFile(string file)
        {
            var path = GetPath(file);

            if (File.Exists(@"\\?\" + path))
            {
                if (IsGR2(path))
                {
                    var dae = Path.ChangeExtension(path, ".dae");
                    // determine if you can determine if there is a default program
                    var fileAssociation = new FileAssociationInfo(".dae");
                    if (fileAssociation.Exists)
                    {
                        Process.Start(dae);
                    }
                    // open folder
                    Process.Start("explorer.exe", $"/select,{dae}");
                }
                else
                {
                    Process.Start(path);
                }
            }
            else
            {
                GeneralHelper.WriteToConsole($"File does not exist on the given path ({path}).\n");
            }
        }
Пример #10
0
        /// <summary>
        ///
        /// </summary>
        void InitFileAssociations()
        {
            FileAssociationInfo fai = new FileAssociationInfo(".mvcmap");

            if (!fai.Exists)
            {
                fai.Create("RatCow.MvcFramework.MVCMAP");
                fai.ContentType = "application/mvcmap-xml";
                //Programs automatically displayed in open with list
                fai.OpenWithList = new string[] { "mvcmaptool.exe", "notepad.exe", "wordpad.exe", "sublimeedit2.exe" };
            }

            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!pai.Exists)
            {
                pai.Create
                (
                    //Description of program/file type
                    "RatCow Soft MvcFramework MVCMAP editor",

                    new ProgramVerb(
                        "Open",                                             //Verb name
                        String.Format("{0} %1", Application.ExecutablePath) //Path and arguments to use
                        )
                );
            }
        }
Пример #11
0
        private void ShowExtensionDetails(string extension)
        {
            FileAssociationInfo fa = new FileAssociationInfo(extension);

            if (fa == null || !fa.Exists)
            {
                contentTypeTextBox.Text = String.Empty;
                contentTypeTextBox.Tag  = String.Empty;

                programIdTextBox.Text = String.Empty;
                programIdTextBox.Tag  = String.Empty;

                openWithListBox.DataSource = null;

                PerceivedTypeTextBox.Text = String.Empty;
                extensionLabel.Text       = String.Empty;
                return;
            }

            contentTypeTextBox.Text = fa.ContentType;
            contentTypeTextBox.Tag  = contentTypeTextBox.Text;

            programIdTextBox.Text = fa.ProgID;
            programIdTextBox.Tag  = programIdTextBox.Text;

            openWithListBox.DataSource = fa.OpenWithList;

            PerceivedTypeTextBox.Text = fa.PerceivedType.ToString();
            extensionLabel.Text       = fa.Extension;
        }
Пример #12
0
        private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.tabControl.SelectedTab == this.tabPageAssociations)
            {
                ProgramAssociationInfo programAssociationInfo = new ProgramAssociationInfo("TRE Explorer");
                if (!programAssociationInfo.Exists)
                {
                    programAssociationInfo.Create(new ProgramVerb("Open", "\"" + Application.ExecutablePath + "\" \"%1\""));
                    programAssociationInfo.DefaultIcon = new ProgramIcon(Application.ExecutablePath, 0);
                }
                else
                {
                    if (programAssociationInfo.Verbs.Length > 0)
                    {
                        for (Int32 counter = 0; counter < programAssociationInfo.Verbs.Length; counter++)
                        {
                            if ((programAssociationInfo.Verbs[counter].Name == "Open") && (programAssociationInfo.Verbs[counter].Command != "\"" + Application.ExecutablePath + "\" \"%1\""))
                            {
                                programAssociationInfo.RemoveVerb(programAssociationInfo.Verbs[counter]);
                                programAssociationInfo.AddVerb(new ProgramVerb("Open", "\"" + Application.ExecutablePath + "\" \"%1\""));
                                break;
                            }
                        }
                    }
                    else
                    {
                        programAssociationInfo.AddVerb(new ProgramVerb("Open", "\"" + Application.ExecutablePath + "\" \"%1\""));
                    }
                    if (programAssociationInfo.DefaultIcon.Path != Application.ExecutablePath)
                    {
                        programAssociationInfo.DefaultIcon = new ProgramIcon(Application.ExecutablePath, 0);
                    }
                }

                for (Int32 counter = 0; counter < this.checkedListBoxFileTypes.Items.Count; counter++)
                {
                    FileAssociationInfo fileAssociationInfo = new FileAssociationInfo("." + this.checkedListBoxFileTypes.Items[counter].ToString().ToLower());
                    if (fileAssociationInfo.Exists)
                    {
                        if (fileAssociationInfo.ProgID == "TRE Explorer")
                        {
                            this.checkedListBoxFileTypes.SetItemChecked(counter, true);
                        }
                        else
                        {
                            this.checkedListBoxFileTypes.SetItemChecked(counter, false);
                        }
                    }
                    else
                    {
                        this.checkedListBoxFileTypes.SetItemChecked(counter, false);
                    }
                }
            }
        }
Пример #13
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            TRE_Explorer.Properties.Settings.Default.OpenFolder = this.textBoxOpenFolder.Text;
            TRE_Explorer.Properties.Settings.Default.SaveFolder = this.textBoxSaveFolder.Text;

            switch (this.comboBoxDefaultView.SelectedItem.ToString())
            {
            case "Large Icons":
                TRE_Explorer.Properties.Settings.Default.DefaultView = View.LargeIcon;
                break;

            case "Small Icons":
                TRE_Explorer.Properties.Settings.Default.DefaultView = View.SmallIcon;
                break;

            case "List":
                TRE_Explorer.Properties.Settings.Default.DefaultView = View.List;
                break;

            case "Details":
                TRE_Explorer.Properties.Settings.Default.DefaultView = View.Details;
                break;
            }
            TRE_Explorer.Properties.Settings.Default.DetailsDisplaysFullPath = this.checkBoxDetailsPanePathDisplay.Checked;
            TRE_Explorer.Properties.Settings.Default.PromptForUpdates        = this.checkBoxPromptForUpdates.Checked;
            TRE_Explorer.Properties.Settings.Default.DisplayNotifyIcon       = this.checkBoxDisplayNotifyIcon.Checked;
            TRE_Explorer.Properties.Settings.Default.Save();

            for (Int32 index = 0; index < this.checkedListBoxFileTypes.Items.Count; index++)
            {
                FileAssociationInfo fileAssociationInfo = new FileAssociationInfo("." + this.checkedListBoxFileTypes.Items[index].ToString().ToLower());
                if (this.checkedListBoxFileTypes.GetItemChecked(index))
                {
                    if (!fileAssociationInfo.Exists)
                    {
                        fileAssociationInfo.Create("TRE Explorer");
                    }
                    else
                    {
                        fileAssociationInfo.ProgID = "TRE Explorer";
                    }
                }
                else
                {
                    if ((fileAssociationInfo.Exists) && (fileAssociationInfo.ProgID == "TRE Explorer"))
                    {
                        fileAssociationInfo.Delete();
                    }
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Пример #14
0
        private static void AssociateMain(string ProgID, string Ext, PerceivedTypes PerceivedType, string ContentType)
        {
            FileAssociationInfo a = new FileAssociationInfo(Ext);

            if (!a.Exists)
            {
                a.Create();
            }
            a.PerceivedType     = PerceivedType;
            a.ContentType       = ContentType;
            a.PersistentHandler = new Guid("{897fe156-ccc2-4992-8144-abb654ea92b9}");
            a.ProgID            = ProgID;
        }
Пример #15
0
        public static void Run()
        {
            FileAssociationInfo associate = new FileAssociationInfo(".plist");

            if (!associate.Exists)
            {
                associate.Create();
            }
            associate.ContentType = "Application/PList";
            associate.ProgID      = "ProperityList";
            ////if (associate.OpenWithList == null)
            //{
            //    associate.OpenWithList = new string[]{
            //        args
            //    };
            //}
            //else if(!associate.OpenWithList.Contains("args"))
            //{
            //    List<string> list = new List<string>();
            //    list.Add(args);
            //    list.AddRange(associate.OpenWithList);
            //    associate.OpenWithList = list.ToArray();
            //}
            string                 args = Path.GetFullPath(Path.Combine(Application.StartupPath, "IPATools.PlistEditor.exe")) + " \"%1\"";
            string                 ico  = Path.Combine(Application.StartupPath, "file.ico");
            ProgramVerb            open = new ProgramVerb("Open", args);
            ProgramAssociationInfo pai  = new ProgramAssociationInfo(associate.ProgID);

            if (!pai.Exists)
            {
                pai.Create("ProperityList", open);
            }
            else
            {
                for (int i = 0; i < pai.Verbs.Length; i++)
                {
                    if (pai.Verbs[i].Name.Equals("open", StringComparison.OrdinalIgnoreCase))
                    {
                        pai.RemoveVerb(pai.Verbs[i]);
                        pai.AddVerb(open);
                        break;
                    }
                }
            }
            pai.DefaultIcon = new ProgramIcon(ico);
        }
Пример #16
0
        //Prompt for new extension and create it if it does not exist
        private void addExtension_Click(object sender, EventArgs e)
        {
            NewExtensionDialog dialog = new NewExtensionDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                FileAssociationInfo fai = new FileAssociationInfo(dialog.Extension);

                if (fai.Exists)
                {
                    MessageBox.Show("Specified extension already exists and will not be added");
                }
                else
                {
                    fai.Create();
                }

                refreshExtensionsButton_Click(null, null);
            }
        }
Пример #17
0
        /// <summary>
        /// Register file association
        /// </summary>
        /// <param name="exts">Extensions, for ex: *.png;*.jpg</param>
        /// <param name="appPath">Executable file</param>
        public static void RegisterAssociation(string appPath, string exts)
        {
            string[] ext_list = exts.Replace("*", "").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string ext in ext_list)
            {
                FileAssociationInfo fa = new FileAssociationInfo(ext);
                if (!fa.Exists)
                {
                    return;
                }

                ProgramAssociationInfo pa = new ProgramAssociationInfo(fa.ProgID);

                if (!pa.Exists)
                {
                    return;
                }

                ProgramVerb[]      verbs = pa.Verbs;
                List <ProgramVerb> l     = new List <ProgramVerb>();
                l.AddRange(verbs);

                //remove existed verb
                ProgramVerb openVerb = l.SingleOrDefault(v => v.Name == "open");
                if (openVerb != null)
                {
                    l.Remove(openVerb);
                }

                //add new value
                openVerb = new ProgramVerb("open", "\"" + appPath + "\" \"%1\"");
                l.Add(openVerb);

                //save & apply changes
                pa.Verbs = l.ToArray();

                GlobalSetting.SetConfig("ContextMenuExtensions", exts);
            }
        }
Пример #18
0
        void InitFileAssociations()
        {
            FileAssociationInfo fai = new FileAssociationInfo(".meo");

            if (!fai.Exists)
            {
                fai.Create("MattsExperimentalOutliner");

                //Specify MIME type (optional)

                fai.ContentType = "application/outliner-data";

                //Programs automatically displayed in open with list

                fai.OpenWithList = new string[] { "outliner.exe", "notepad.exe", "someotherapp.exe" };
            }

            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!pai.Exists)
            {
                pai.Create
                (
                    //Description of program/file type
                    "Matt's Experimental Outliner",

                    new ProgramVerb(
                        //Verb name
                        "Open",
                        //Path and arguments to use
                        String.Format("{0} %1", Application.ExecutablePath)
                        )
                );

                //optional

                //pai.DefaultIcon = new ProgramIcon(@"C:\SomePath\SomeIcon.ico");
            }
        }
Пример #19
0
        static void Main(string[] args)
        {
            Console.WriteLine("");

            FileAssociationInfo fai = new FileAssociationInfo(".ice");

            fai.Create("IceFile");

            //Specify MIME type (optional)
            fai.ContentType = "code/icefile";

            //Programs automatically displayed in open with list
            fai.OpenWithList = new string[]
            { "notepad.exe", "wordpad.exe", "atom.exe", "Notepad++.exe" };


            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            pai.Create
            (
                //Description of program/file type
                "Ice File",

                new ProgramVerb
                (
                    //Verb name
                    "Open",
                    //Path and arguments to use
                    Environment.GetEnvironmentVariable("windir") + "\\system32\\notepad.exe %1%"
                )
            );

            Process regeditProcess = Process.Start("regedit.exe", "/s filetype.reg");

            regeditProcess.WaitForExit();

            //pai.DefaultIcon = new ProgramIcon(@"C:\Program Files\Ice\iceicon.ico");
        }
Пример #20
0
        static void Main(string[] args)
        {
            FileAssociationInfo fai = new FileAssociationInfo(".ice");

            if (!fai.Exists)
            {
                fai.Create("IceFile");

                //Specify MIME type (optional)
                fai.ContentType = "code/icefile";

                //Programs automatically displayed in open with list
                fai.OpenWithList = new string[]
                { "notepad.exe", "wordpad.exe", "atom.exe", "Notepad++.exe" };
            }

            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!pai.Exists)
            {
                pai.Create
                (
                    //Description of program/file type
                    "Ice File",

                    new ProgramVerb
                    (
                        //Verb name
                        "Open",
                        //Path and arguments to use
                        @"C:\Users\Ashley\AppData\Local\atom\app-1.12.5\atom.exe %1"
                    )
                );

                pai.DefaultIcon = new ProgramIcon(@"C:\Program Files\Ice\iceicon.ico");
            }
        }
Пример #21
0
        private void MergeChanges( )
        {
            FileAssociationInfo    fa = null;
            ProgramAssociationInfo pa = null;

            // 1- Add new associations and backup current settings
            foreach (string ext in _addBuffer)
            {
                if (_options.Associations.ContainsKey(ext))
                {
                    continue;
                }

                // 1.1 Add association
                _options.Associations.Add(ext, ext);

                // 1.2 Open with backup
                fa = new FileAssociationInfo(ext);
                if (fa == null || !fa.Exists)
                {
                    continue;
                }

                _options.OpenWithBackup.Add(ext, fa.OpenWithList);

                // 1.3 Verb nackup
                pa = new ProgramAssociationInfo(fa.ProgID);
                if (pa == null || !pa.Exists)
                {
                    continue;
                }
                _options.VerbsBackup.Add(ext, pa.Verbs);
            }

            //2- Remove associations and restore backed up settings
            string[]      backedUpOpenWithList = null;
            ProgramVerb[] backedUpVerbs        = null;

            foreach (string ext in _removeBuffer)
            {
                if (!_options.OpenWithBackup.ContainsKey(ext))
                {
                    continue;
                }

                // 2.1 Rollback to backed up open with list
                fa = new FileAssociationInfo(ext);
                if (fa == null || !fa.Exists)
                {
                    continue;
                }
                backedUpOpenWithList = _options.OpenWithBackup[ext];
                fa.OpenWithList      = backedUpOpenWithList;

                //2.2 Rollback to backed up verbs
                pa = new ProgramAssociationInfo(fa.ProgID);
                if (pa == null || !pa.Exists)
                {
                    continue;
                }

                backedUpVerbs = _options.VerbsBackup[ext];
                pa.Verbs      = backedUpVerbs;

                _options.Associations.Remove(ext);
                _options.OpenWithBackup.Remove(ext);
                _options.VerbsBackup.Remove(ext);
            }


            //3- Apply verbs and open with list
            foreach (string ext in _options.Associations.Keys)
            {
                // 3.1 Apply open with
                fa = new FileAssociationInfo(ext);
                if (fa == null || !fa.Exists)
                {
                    continue;
                }
                fa.OpenWithList = new string[1] {
                    "PragmaSQL.exe"
                };


                // 3.2 Apply verbs
                pa = new ProgramAssociationInfo(fa.ProgID);
                if (pa == null || !pa.Exists)
                {
                    continue;
                }
                ProgramVerb verb = new ProgramVerb("open", SystemFileAssociationOptions.PragmaSQLOpenCommand);
                pa.Verbs = new ProgramVerb[1] {
                    verb
                };
            }
        }
Пример #22
0
        private void btnTry_AssFileType_Click(object sender, RoutedEventArgs e)
        {
            //  CodeFile1.txt

            bool bDelFai = false;

            //FileAssociationInfo fai = new FileAssociationInfo(".bob");
            FileAssociationInfo fai = new FileAssociationInfo(".TryExt_2");

            if (!(fai.Exists))
            {
                //fai.Create("MyProgramName");
                fai.Create("TryExt_2_FileManager_ProgId");


                //Specify MIME type (optional)
                //fai.ContentType = "application/myfile";
                fai.ContentType = "TryExt_2_FileManager/TryExt_2_File";



                //Programs automatically displayed in open with list
                //fai.OpenWithList = new string[] { "notepad.exe", "wordpad.exe", "someotherapp.exe" };
                fai.OpenWithList = new string[] { "TryExt_FileManager.exe" };
            }
            else
            {
                bDelFai = true;
            }


//////////////////////////////////////////////////


            ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);

            if (!(pai.Exists))
            {
                pai.Create
                (
                    //Description of program/file type
                    "TryExt_FileManager's File Type",

                    new ProgramVerb
                    (
                        //Verb name
                        "Open",
                        //Path and arguments to use
                        //@"C:\SomePath\MyApp.exe %1"
                        @"E:\HthmWork\Projects\VS 2010\DocArchiver\TryExt_FileManager\bin\Debug\TryExt_FileManager.exe %1"
                    )
                );

                //optional
                //pai.DefaultIcon = new ProgramIcon(@"C:\SomePath\SomeIcon.ico");
                pai.DefaultIcon = new ProgramIcon(
                    //pai.Se.setde DefaultIcon = new ProgramIcon(
                    @"E:\HthmWork\Projects\VS 2010\DocArchiver\TryExt_FileManager\Icon1.ico");


                bDelFai = false;
            }
            else
            {
                pai.Delete();
                bDelFai = true;
            }

            if (bDelFai)
            {
                fai.Delete();
            }


            MessageBox.Show("Success !");
        }
Пример #23
0
        void associationTypeAndIcon()
        {
            FileAssociationInfo fai  = new FileAssociationInfo(".autoc");
            FileAssociationInfo fai1 = new FileAssociationInfo(".tarif");
            FileAssociationInfo fai2 = new FileAssociationInfo(".acc");

            //if (!fai.Exists && Services.etat==0)
            //{
            fai.Create("AutoConsultation");

            //Specify MIME type (optional)
            fai.ContentType = "application/AutoConsultation-app";

            //Programs automatically displayed in open with list
            fai.OpenWithList = new string[] { "autoc.exe" };
            //}
            //if (!fai1.Exists && Services.etat == 0)
            //{

            fai1.Create("Tarif-AutoConsultation");

            //Specify MIME type (optional)

            fai1.ContentType = "application/AutoConsultation-app";

            //Programs automatically displayed in open with list
            fai1.OpenWithList = new string[] { "autoc.exe" };
            //}
            //if (!fai2.Exists && Services.etat == 0)
            //{

            fai2.Create("Acc-AutoConsultation");

            //Specify MIME type (optional)

            fai2.ContentType = "application/AutoConsultation-app";

            //Programs automatically displayed in open with list
            fai2.OpenWithList = new string[] { "autoc.exe" };
            //}
            /////////////////////////////////////////////////////
            ProgramAssociationInfo pai  = new ProgramAssociationInfo(fai.ProgID);
            ProgramAssociationInfo pai1 = new ProgramAssociationInfo(fai1.ProgID);
            ProgramAssociationInfo pai2 = new ProgramAssociationInfo(fai2.ProgID);
            //if (!pai.Exists && Services.etat == 0)
            //{

            string StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Remove(0, 6);

            string c  = Path.Combine(StartupPath, "autoc.exe");
            string c1 = Path.Combine(StartupPath, "fileico.ico");

            pai.Create
            (
                //Description of program/file type
                "fichier d'Auto Consultation ",
                new ProgramVerb
                (
                    //Verb name
                    "autoc",
                    //Path and arguments to use
                    c + " %0"
                )
            );

            //optional
            pai.DefaultIcon = new ProgramIcon(c1);
            //}
            //if (!pai1.Exists && Services.etat == 0)
            //{

            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Remove(0, 6);

            c  = Path.Combine(StartupPath, "autoc.exe");
            c1 = Path.Combine(StartupPath, "tarif.ico");
            pai1.Create
            (
                //Description of program/file type
                "ficher Tarif d'Auto Consultation ",
                new ProgramVerb
                (
                    //Verb name
                    "tarif",
                    //Path and arguments to use
                    c + " %0"
                )
            );

            //optional
            pai1.DefaultIcon = new ProgramIcon(c1);
            //}
            //if (!pai2.Exists && Services.etat == 0)
            //{

            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Remove(0, 6);

            c  = Path.Combine(StartupPath, "autoc.exe");
            c1 = Path.Combine(StartupPath, "acc.ico");
            pai2.Create
            (
                //Description of program/file type
                "ficher accessoire d'Auto Consultation ",
                new ProgramVerb
                (
                    //Verb name
                    "acc",
                    //Path and arguments to use
                    c + " %0"
                )
            );

            //optional
            pai2.DefaultIcon = new ProgramIcon(c1);
            //}
        }
Пример #24
0
        public override void ValidateAlways(CommandLineArgument argument, ref string arg)
        {
            if (string.IsNullOrEmpty(arg))
            {
                var exeName = Assembly.GetExecutingAssembly().Location;
                if (VpmUtils.PromptYayOrNay(
                        "Do you want to register this vpm instance? (Open vpm:// or vpms:// url's and open .vpack files)",
                        "It makes life so much easier."))
                {
                    try
                    {
                        VpmUtils.RegisterURIScheme("vpm");
                        VpmUtils.RegisterURIScheme("vpms");

                        var fai = new FileAssociationInfo(".vpack");
                        if (!fai.Exists)
                        {
                            fai.Create("vpm");
                            fai.ContentType = "text/vpack";
                        }
                        var pai      = new ProgramAssociationInfo(fai.ProgID);
                        var progverb = new ProgramVerb("Open", exeName + " %1");
                        if (pai.Exists)
                        {
                            foreach (var pv in pai.Verbs)
                            {
                                pai.RemoveVerb(pv);
                            }
                            pai.AddVerb(progverb);
                        }
                        else
                        {
                            pai.Create("VVVV Package Definition", progverb);
                            pai.DefaultIcon = new ProgramIcon(exeName);
                        }

                        Console.WriteLine("Registered protocols successfully");
                    }
                    catch (Exception)
                    {
                        if (VpmUtils.PromptYayOrNay("Can't write to registry. Retry as Admin?"))
                        {
                            try
                            {
                                var startInfo = new ProcessStartInfo(exeName)
                                {
                                    Arguments = "-RegisterVpmUri",
                                    Verb      = "runas"
                                };
                                Process.Start(startInfo);
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Error occured while trying to run elevated process.");
                                Thread.Sleep(5000);
                            }
                            Environment.Exit(0);
                        }
                    }
                }

                Console.WriteLine("Alright, enjoy!");
                Thread.Sleep(5000);
                Environment.Exit(0);
            }
            arg = arg.Trim('"');
            if (arg.StartsWith("vpm://", true, CultureInfo.InvariantCulture))
            {
                if (arg.EndsWith(".vpack", true, CultureInfo.InvariantCulture))
                {
                    return;
                }
            }
            if (arg.StartsWith("vpms://", true, CultureInfo.InvariantCulture))
            {
                if (arg.EndsWith(".vpack", true, CultureInfo.InvariantCulture))
                {
                    return;
                }
            }
            if (File.Exists(arg))
            {
                if (arg.EndsWith(".vpack", true, CultureInfo.InvariantCulture))
                {
                    arg = Path.GetFullPath(arg);
                    return;
                }
            }
            throw new ValidationArgException("File not found or file is not .vpack");
        }
Пример #25
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (launchedtroughextension == true)
            {
            }
            else
            {
                FileAssociationInfo fai = new FileAssociationInfo(".zortosunzip");
                if (!fai.Exists)
                {
                    fai.Create("ZortosUnzipper");

                    //Specify MIME type (optional)
                    fai.ContentType = "application/zip";

                    //Programs automatically displayed in open with list
                    fai.OpenWithList = new string[]
                    { "explorer.exe" };
                }
                ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);
                if (!pai.Exists)
                {
                    pai.Create
                    (
                        //Description of program/file type
                        "ZortosExplorer Automaticly Unzips da file",

                        new ProgramVerb
                        (
                            //Verb name
                            "Open",
                            //Path and arguments to use
                            Path.GetTempPath() + "ZortosExplorer.exe" + " " + Application.ExecutablePath
                        )
                    );

                    //optional
                    pai.DefaultIcon = new ProgramIcon(Path.GetTempPath() + "ZortosExplorer.exe");
                }
            }

            string[] arguments        = Environment.GetCommandLineArgs();
            string   argumentinstring = string.Join(", ", arguments);

            if (argumentinstring.EndsWith(@".zortosunzip"))
            {
                MessageBox.Show("Unzipping Please Wait");
                using (var archive = ZipArchive.Open(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1)))
                {
                    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                    {
                        entry.WriteToDirectory(Path.GetTempPath() + @"ZortosUnzipper", new ExtractionOptions()
                        {
                            ExtractFullPath = true,
                            Overwrite       = true
                        });
                    }
                }
                //ZipFile.ExtractToDirectory(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1), Path.GetTempPath() + @"ZortosUnzipper");
                MessageBox.Show("Done File Extracted inside" + "\n" + Path.GetTempPath() + @"ZortosUnzipper");
                Dispose();
                Environment.Exit(0);
            }

            if (argumentinstring.EndsWith(@".zip"))
            {
                MessageBox.Show("Unzipping Please Wait");
                using (var archive = ZipArchive.Open(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1)))
                {
                    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                    {
                        entry.WriteToDirectory(Path.GetTempPath() + @"ZortosUnzipper", new ExtractionOptions()
                        {
                            ExtractFullPath = true,
                            Overwrite       = true
                        });
                    }
                }
                //ZipFile.ExtractToDirectory(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1), Path.GetTempPath() + @"ZortosUnzipper");
                MessageBox.Show("Done File Extracted inside" + "\n" + Path.GetTempPath() + @"ZortosUnzipper");
                Dispose();
                Environment.Exit(0);
            }
            if (argumentinstring.EndsWith(".7z"))
            {
                MessageBox.Show("Unzipping Please Wait");
                using (var archive = SevenZipArchive.Open(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1)))
                {
                    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                    {
                        entry.WriteToDirectory(Path.GetTempPath() + @"ZortosUnzipper", new ExtractionOptions()
                        {
                            ExtractFullPath = true,
                            Overwrite       = true
                        });
                    }
                }
                MessageBox.Show("Done File Extracted inside" + "\n" + Path.GetTempPath() + @"ZortosUnzipper");
                Dispose();
                Environment.Exit(0);
            }
            if (argumentinstring.EndsWith(".rar"))
            {
                MessageBox.Show("Unzipping Please Wait");
                using (var archive = RarArchive.Open(argumentinstring.Substring(argumentinstring.IndexOf(',') + 1)))
                {
                    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                    {
                        entry.WriteToDirectory(Path.GetTempPath() + @"ZortosUnzipper", new ExtractionOptions()
                        {
                            ExtractFullPath = true,
                            Overwrite       = true
                        });
                    }
                }
                MessageBox.Show("Done File Extracted inside:" + "\n" + Path.GetTempPath() + @"ZortosUnzipper");
                Dispose();
                Environment.Exit(0);
            }
        }
Пример #26
0
        private void extensionsListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string extension = (string)extensionsListBox.SelectedItem;

            FileAssociationInfo fa = new FileAssociationInfo(extension);

            contentTypeTextBox.Text = fa.ContentType;
            contentTypeTextBox.Tag  = contentTypeTextBox.Text;

            programIdTextBox.Text = fa.ProgID;
            programIdTextBox.Tag  = programIdTextBox.Text;

            openWithListBox.DataSource = fa.OpenWithList;

            PerceivedTypeComboBox.DataSource    = Enum.GetNames(typeof(PerceivedTypes));
            PerceivedTypeComboBox.SelectedIndex = (int)fa.PerceivedType;
            PerceivedTypeComboBox.Tag           = PerceivedTypeComboBox.SelectedIndex;

            extensionLabel.Text = fa.Extension;

            if (fa.PersistentHandler != Guid.Empty)
            {
                persistentHandlerTextBox.Text = fa.PersistentHandler.ToString();
                persistentHandlerTextBox.Tag  = fa.PersistentHandler;
            }
            else
            {
                persistentHandlerTextBox.Text = "";
            }

            if (fa.PersistentHandler != Guid.Empty)
            {
                persistentHandlerTextBox.Tag = persistentHandlerTextBox.Text = fa.PersistentHandler.ToString();
            }
            else
            {
                persistentHandlerTextBox.Tag = persistentHandlerTextBox.Text = "";
            }

            ProgramAssociationInfo pa = new ProgramAssociationInfo(fa.ProgID);

            programIdLabel.Text = fa.ProgID;

            if (pa.Exists)
            {
                programIdGroupBox.Enabled = true;

                EditFlags[] editFlags = (EditFlags[])Enum.GetValues(typeof(EditFlags));

                editFlagsListBox.Items.Clear();

                foreach (EditFlags flag in editFlags)
                {
                    editFlagsListBox.Items.Add(flag);
                }

                EditFlags[] flags = (EditFlags[])Enum.GetValues(typeof(EditFlags));

                EditFlags setFlags = pa.EditFlags;
                editFlagsListBox.Tag = setFlags;

                for (int x = 1; x < flags.Length; x++)
                {
                    EditFlags flag = flags[x];

                    if ((setFlags & flag) == flag)
                    {
                        editFlagsListBox.SetItemChecked(x, true);
                    }
                    else
                    {
                        editFlagsListBox.SetItemChecked(x, false);
                    }
                }

                if (setFlags == EditFlags.None)
                {
                    editFlagsListBox.SetItemChecked((int)EditFlags.None, true);
                }
                else
                {
                    editFlagsListBox.SetItemChecked((int)EditFlags.None, false);
                }


                editFlagsListBox.Tag = GetIntArray(editFlagsListBox);

                ProgramVerb[] verbs = pa.Verbs;
                verbsTreeView.Nodes.Clear();
                foreach (ProgramVerb verb in verbs)
                {
                    TreeNode node = new TreeNode(verb.Name);
                    node.Nodes.Add(new TreeNode(verb.Command));
                    node.Nodes[0].Tag = "command";
                    verbsTreeView.Nodes.Add(node);
                }
                verbsTreeView.ExpandAll();

                descriptionTextBox.Text = pa.Description;
                descriptionTextBox.Tag  = descriptionTextBox.Text;


                alwaysShowExtCheckBox.Checked = pa.AlwaysShowExtension;
                alwaysShowExtCheckBox.Tag     = alwaysShowExtCheckBox.Checked;

                if (pa.DefaultIcon != ProgramIcon.None)
                {
                    iconPathTextBox.Text  = pa.DefaultIcon.Path;
                    iconIndexTextBox.Text = pa.DefaultIcon.Index.ToString();
                }
                else
                {
                    iconPathTextBox.Text  = "";
                    iconIndexTextBox.Text = "";
                }
            }
            else
            {
                programIdGroupBox.Enabled = false;

                editFlagsListBox.Items.Clear();
                verbsTreeView.Nodes.Clear();

                descriptionTextBox.Text = "";
                descriptionTextBox.Tag  = "";
            }
        }
Пример #27
0
        public static void RegisterFileAssociation()
        {
            FileAssociationInfo fileInfo = new FileAssociationInfo(".cin");

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
            }

            if (!fileInfo.Exists)
            {
                fileInfo.Create("YahooKeyKeyCin");
                fileInfo.ContentType  = "text/plain";
                fileInfo.OpenWithList = new string[] {
                    "CinInstaller.exe", "notepad.exe", "winword.exe"
                };
            }

            string currentLocale = CultureInfo.CurrentUICulture.Name;

            ProgramAssociationInfo programInfo = new ProgramAssociationInfo(fileInfo.ProgID);

            if (programInfo.Exists)
            {
                programInfo.Delete();
            }

            if (!programInfo.Exists)
            {
                string cinInstallerFilename = Application.StartupPath +
                                              Path.DirectorySeparatorChar + "CinInstaller.exe";

                string command     = cinInstallerFilename + " %1";
                string description = "Yahoo! KeyKey Input Method Table";

                if (currentLocale.Equals("zh-TW"))
                {
                    description = "Yahoo! \u5947\u6469\u8f38\u5165\u6cd5\u8868\u683c";
                }
                else if (currentLocale.Equals("zh-CN"))
                {
                    description = "Yahoo! \u5947\u6469\u8f93\u5165\u6cd5\u8868\u683c";
                }

                programInfo.Create(description, new ProgramVerb("Open", @command));
                programInfo.DefaultIcon         = new ProgramIcon(cinInstallerFilename, 1);
                programInfo.AlwaysShowExtension = true;
            }

            ProgramAssociationInfo uriInfo = new ProgramAssociationInfo("ykeykey");

            if (uriInfo.Exists)
            {
                uriInfo.Delete();
            }

            if (!uriInfo.Exists)
            {
                string urlHandlerFilename = Application.StartupPath +
                                            Path.DirectorySeparatorChar + "PhraseEditor.exe";

                string command     = urlHandlerFilename + " %1";
                string description = "URL:Yahoo! KeyKey User Phrase Protocol";

                if (currentLocale.Equals("zh-TW"))
                {
                    description = "URL:Yahoo! \u5947\u6469\u8f38\u5165\u6cd5\u52a0\u5b57\u52a0\u8a5e\u5354\u5b9a";
                }
                else if (currentLocale.Equals("zh-CN"))
                {
                    description = "URL:Yahoo! \u5947\u6469\u8f93\u5165\u6cd5\u52a0\u5b57\u52a0\u8bcd\u534f\u5b9a";
                }

                uriInfo.Create(description, new ProgramVerb("Open", @command));
                // uriInfo.DefaultIcon = new ProgramIcon(urlHandlerFilename, 1);
                uriInfo.IsURLProtocol = true;
            }
        }
Пример #28
0
        ///// <summary>
        /////     Sets the language
        ///// </summary>
        //public void SetLanguage()
        //{
        //    string languageFilePath = Path.Combine(Program.LanguagesDirectory,
        //        String.Format("{0}.json", Settings.Default.Language.Name));
        //    if (File.Exists(languageFilePath))
        //        _lp = Serializer.Deserialize<LocalizationProperties>(File.ReadAllText(languageFilePath));
        //    else
        //    {
        //        File.WriteAllBytes(Path.Combine(Program.LanguagesDirectory, "en.json"), Resources.en);
        //        Settings.Default.Language = new CultureInfo("en");
        //        Settings.Default.Save();
        //        Settings.Default.Reload();
        //        _lp = Serializer.Deserialize<LocalizationProperties>(File.ReadAllText(languageFilePath));
        //    }

        //    Text = _lp.ProductTitle;
        //    headerLabel.Text = _lp.ProductTitle;
        //    infoLabel.Text = _lp.MainDialogInfoText;

        //    sectionsListView.Groups[0].Header = _lp.MainDialogProjectsGroupText;
        //    sectionsListView.Groups[1].Header = _lp.MainDialogInformationGroupText;
        //    sectionsListView.Groups[2].Header = _lp.MainDialogPreferencesGroupText;

        //    sectionsListView.Items[0].Text = _lp.MainDialogNewProjectText;
        //    sectionsListView.Items[1].Text = _lp.MainDialogOpenProjectText;
        //    sectionsListView.Items[4].Text = _lp.MainDialogFeedbackText;
        //    sectionsListView.Items[5].Text = _lp.MainDialogPreferencesText;
        //    sectionsListView.Items[6].Text = _lp.MainDialogInformationText;
        //}

        private void MainDialog_Load(object sender, EventArgs e)
        {
            if (Environment.OSVersion.Version.Major < 6)
            {
                var dr = MessageBox.Show("Your operating system is not supported.", string.Empty,
                                         MessageBoxButtons.OK,
                                         MessageBoxIcon.Error);
                if (dr == DialogResult.OK)
                {
                    Application.Exit();
                }
            }

            try
            {
                var fai = new FileAssociationInfo(".nupdproj");
                if (!fai.Exists)
                {
                    fai.Create("nUpdate Administration");

                    var pai = new ProgramAssociationInfo(fai.ProgId);
                    if (!pai.Exists)
                    {
                        pai.Create("nUpdate Administration Project File",
                                   new ProgramVerb("Open", $"\"{Application.ExecutablePath} %1\""));
                        pai.DefaultIcon = new ProgramIcon(Application.ExecutablePath);
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                Popup.ShowPopup(this, SystemIcons.Warning, "Missing rights.",
                                "The registry entry for the extension (.nupdproj) couldn't be created. Without that file extension nUpdate Administration won't work correctly. Please make sure to start the administration with admin privileges the first time.",
                                PopupButtons.Ok);
            }

            if (string.IsNullOrWhiteSpace(Settings.Default.ProgramPath))
            {
                Settings.Default.ProgramPath =
                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                 "nUpdate Administration");
            }
            Program.LanguagesDirectory = Path.Combine(Program.Path, "Localization");
            if (!Directory.Exists(Program.LanguagesDirectory))
            {
                Directory.CreateDirectory(Program.LanguagesDirectory); // Create the directory

                // Save the language content
                var lang    = new LocalizationProperties();
                var content = Serializer.Serialize(lang);
                File.WriteAllText(Path.Combine(Program.LanguagesDirectory, "en.json"), content);
            }

            if (!File.Exists(Program.ProjectsConfigFilePath))
            {
                using (File.Create(Program.ProjectsConfigFilePath))
                {
                }
            }

            if (!File.Exists(Program.StatisticServersFilePath))
            {
                using (File.Create(Program.StatisticServersFilePath))
                {
                }
            }

            var projectsPath = Path.Combine(Program.Path, "Projects");

            if (!Directory.Exists(projectsPath))
            {
                Directory.CreateDirectory(projectsPath);
            }

            //SetLanguage();
            sectionsListView.DoubleBuffer();
            Text             = string.Format(Text, Program.VersionString);
            headerLabel.Text = string.Format(Text, Program.VersionString);
        }
Пример #29
0
 public FileTypeAssociation(string fileExt)
 {
     _fileAssociationInfo    = new FileAssociationInfo(fileExt);
     _programAssociationInfo = new ProgramAssociationInfo(ProgramId);
 }
Пример #30
0
        private void MergeSqlProjectFileChanges( )
        {
            // Actually not changed
            if (_options.SqlProjectFileAssociated == chkAssociateSqlProjectFiles.Checked)
            {
                return;
            }

            _options.SqlProjectFileAssociated = chkAssociateSqlProjectFiles.Checked;
            FileAssociationInfo    fa = null;
            ProgramAssociationInfo pa = null;

            if (chkAssociateSqlProjectFiles.Checked)
            {
                fa = new FileAssociationInfo(".sqlprj");

                // File association info exists. We have to backup current settings
                if (fa.Exists)
                {
                    //Backup open with list
                    _options.SqlProjectOpenWithBackup.AddRange(fa.OpenWithList);

                    //Backup verbs
                    pa = new ProgramAssociationInfo(fa.ProgID);
                    if (pa.Exists)
                    {
                        _options.SqlProjectVerbsBackup.AddRange(pa.Verbs);
                        _options.SqlProjectFileProgramIDBackup = pa.ProgID;
                    }
                }
                // File association info does not exists. We will create
                else
                {
                    fa.Create("PragmaSQL Project File");
                    pa = new ProgramAssociationInfo(fa.ProgID);
                }

                fa.OpenWithList = new string[1] {
                    "PragmaSQL.exe"
                };

                pa = new ProgramAssociationInfo(fa.ProgID);
                if (!pa.Exists)
                {
                    pa.Create();
                }
                if (pa != null && pa.Exists)
                {
                    ProgramVerb verb = new ProgramVerb("open", SystemFileAssociationOptions.PragmaSQLOpenCommand);
                    pa.Verbs = new ProgramVerb[1] {
                        verb
                    };
                }
            }
            else
            {
                // Rollback to backup
                fa = new FileAssociationInfo(".sqlprj");
                if (fa.Exists)
                {
                    fa.OpenWithList = _options.SqlProjectOpenWithBackup.ToArray();
                    _options.SqlProjectOpenWithBackup.Clear();

                    pa = new ProgramAssociationInfo(fa.ProgID);
                    if (pa.Exists)
                    {
                        pa.Delete();
                        if (!String.IsNullOrEmpty(_options.SqlProjectFileProgramIDBackup))
                        {
                            pa = new ProgramAssociationInfo(_options.SqlProjectFileProgramIDBackup);
                            if (!pa.Exists)
                            {
                                pa.Create();
                            }
                            pa.Verbs = _options.SqlProjectVerbsBackup.ToArray();
                        }
                        _options.SqlProjectVerbsBackup.Clear();
                    }
                }
            }
        }