Пример #1
0
        private void cmMenu_Click(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem cmSender = sender as ToolStripMenuItem;
                TransmitMii_Associations.Extension thisExt;

                //CopyIcon();

                switch (cmSender.Name)
                {
                case "cmElf":
                    thisExt = TransmitMii_Associations.Extension.ELF;
                    break;

                case "cmWad":
                    thisExt = TransmitMii_Associations.Extension.WAD;
                    break;

                default:
                    thisExt = TransmitMii_Associations.Extension.DOL;
                    break;
                }

                if (cmSender.Checked == false)
                {
                    if (TransmitMii_Associations.AddAssociation(thisExt, true, Application.ExecutablePath, false))
                    {
                        MessageBox.Show("Extension linked!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        ErrorBox("An error occured!");
                    }
                }
                else
                {
                    if (TransmitMii_Associations.DeleteAssociation(thisExt))
                    {
                        MessageBox.Show("Extension unlinked!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        ErrorBox("An error occured!");
                    }
                }
            }
            catch (Exception ex) { ErrorBox(ex.Message); }
        }
Пример #2
0
        private void ExtensionCheck()
        {
            string oldPath = TransmitMii_Associations.AssociationPath().ToLower();
            string newPath = Application.ExecutablePath.ToLower();

            if (!string.IsNullOrEmpty(oldPath) && !string.IsNullOrEmpty(newPath))
            {
                if (oldPath != newPath)
                {
                    if (TransmitMii_Associations.CheckAssociation(TransmitMii_Associations.Extension.DOL))
                    {
                        TransmitMii_Associations.AddAssociation(TransmitMii_Associations.Extension.DOL, true, newPath, false);
                    }
                    if (TransmitMii_Associations.CheckAssociation(TransmitMii_Associations.Extension.ELF))
                    {
                        TransmitMii_Associations.AddAssociation(TransmitMii_Associations.Extension.ELF, true, newPath, false);
                    }
                }
            }
        }
Пример #3
0
        private void llbLinkExtension_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ContextMenuStrip cmMenu = new ContextMenuStrip();

            ToolStripMenuItem cmDol = new ToolStripMenuItem("DOL");

            cmDol.Name   = "cmDol";
            cmDol.Click += new EventHandler(cmMenu_Click);
            if (TransmitMii_Associations.CheckAssociation(TransmitMii_Associations.Extension.DOL))
            {
                cmDol.Checked = true;
            }

            ToolStripMenuItem cmElf = new ToolStripMenuItem("ELF");

            cmElf.Name   = "cmElf";
            cmElf.Click += new EventHandler(cmMenu_Click);
            if (TransmitMii_Associations.CheckAssociation(TransmitMii_Associations.Extension.ELF))
            {
                cmElf.Checked = true;
            }

            ToolStripMenuItem cmWad = new ToolStripMenuItem("WAD");

            cmWad.Name   = "cmWad";
            cmWad.Click += new EventHandler(cmMenu_Click);
            if (TransmitMii_Associations.CheckAssociation(TransmitMii_Associations.Extension.WAD))
            {
                cmWad.Checked = true;
            }

            cmMenu.Items.Add(cmDol);
            cmMenu.Items.Add(cmElf);
            cmMenu.Items.Add(cmWad);

            cmMenu.Show(MousePosition);
        }