示例#1
0
 private void OpenFromRegion(Region region)
 {
     if (folderBrowserDialog.ShowDialog(this) == DialogResult.OK)
     {
         filename = MemoryStickUtilities.GetSavePath(folderBrowserDialog.SelectedPath, region);
         if (filename == string.Empty)
         {
             MessageBox.Show(this,
                             "Selected path is not a Memory Stick.",
                             "Invalid path",
                             MessageBoxButtons.OK);
         }
         else if (!File.Exists(filename))
         {
             filename = string.Empty;
             MessageBox.Show(this,
                             string.Format("{0} file not found!", region),
                             "File not found",
                             MessageBoxButtons.OK);
         }
         else
         {
             LoadFile(filename);
         }
     }
 }
示例#2
0
        private void InstallPlugin()
        {
            bool success = false;
            bool cancel  = false;

            while ((!success) && (!cancel))
            {
                DialogResult result = folderBrowserDialog.ShowDialog(this);
                if (result == DialogResult.OK)
                {
                    string path = folderBrowserDialog.SelectedPath;

                    switch (MemoryStickUtilities.InstallPlugin(path))
                    {
                    case MemoryStickUtilities.InstallResult.Failure:
                        MessageBox.Show(this, "Installation failed", "Failed", MessageBoxButtons.OK);
                        cancel = true;
                        break;

                    case MemoryStickUtilities.InstallResult.NotMemoryStickRoot:
                        if (MessageBox.Show(this,
                                            "Selected path is not a Memory Stick.",
                                            "Invalid path",
                                            MessageBoxButtons.RetryCancel) == DialogResult.Cancel)
                        {
                            cancel = true;
                        }
                        break;

                    case MemoryStickUtilities.InstallResult.Success:
                        MessageBox.Show(this,
                                        "Plugin successfully installed!\nRemember to enable the plugin in the Recovery Menu",
                                        "Success",
                                        MessageBoxButtons.OK);
                        success = true;
                        break;
                    }
                }
                else
                {
                    cancel = true;
                }
            }
        }