Exemplo n.º 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); }
        }
Exemplo n.º 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);
                    }
                }
            }
        }