System.Windows.Forms.MessageBox.Show(string, string, System.Windows.Forms.MessageBoxButtons)

Here are the examples of the csharp api System.Windows.Forms.MessageBox.Show(string, string, System.Windows.Forms.MessageBoxButtons) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

564 Examples 7

19 View Source File : QuickCommandManageForm.cs
License : Apache License 2.0
Project Creator : 214175590

private void skinDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int row = e.RowIndex;
            int cell = e.ColumnIndex;
            if (row >= 0)
            {
                button1.Enabled = true;
                if (cell == 3)
                { // 删除

                    DataGridViewCell indexCell = currRow.Cells[0];
                    if (null != indexCell)
                    {
                        int index = (int)indexCell.Value;
                        DialogResult dr = MessageBox.Show("确认删除此项吗?", "提示", MessageBoxButtons.OKCancel);
                        if (dr == DialogResult.OK)
                        {
                            //用户选择确认的操作
                            DefaultConfig.RemoveShellLisreplacedem(config.ShellList, index);
                            skinDataGridView1.Rows.RemoveAt(row);
                        }
                    }
                }
                else if (cell == 2)
                {
                    DataGridViewCell indexCell = currRow.Cells[0];
                    if (null != indexCell)
                    {
                        DataGridViewTextBoxCell textCell = (DataGridViewTextBoxCell) currRow.Cells[1];
                        string cmd = (string)textCell.Value;
                        int index = (int)indexCell.Value;                        
                        DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)skinDataGridView1.Rows[row].Cells[cell];
                        if (null != checkCell)
                        {
                            bool isChecked = Convert.ToBoolean(checkCell.EditedFormattedValue);
                            if(isChecked){
                                cmd += "\n";
                            }
                            DefaultConfig.UpdateShellLisreplacedem(config.ShellList, index, cmd);
                        }
                    }
                }
            }
            else
            {
                button1.Enabled = false;
            }
        }

19 View Source File : QuickCommandManageForm.cs
License : Apache License 2.0
Project Creator : 214175590

private void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataGridViewCell indexCell = currRow.Cells[0];
            if (null != indexCell)
            {
                int index = (int)indexCell.Value;
                DialogResult dr = MessageBox.Show("确认删除此项吗?", "提示", MessageBoxButtons.OKCancel);
                if (dr == DialogResult.OK)
                {
                    //用户选择确认的操作
                    DefaultConfig.RemoveShellLisreplacedem(config.ShellList, index);
                    skinDataGridView1.Rows.Remove(currRow);
                    currRow = null;
                }
            }
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n

private void button1_Click(object sender, EventArgs e)
        {
            if (MODE) //极简模式
            {
                if (textBox1.Text.Contains(":"))
                {
                    string ip = textBox1.Text.Split(':')[0];
                    string port = textBox1.Text.Split(':')[1];
                    saveFileDialog1.Filter = "可执行文件|*.exe";
                    if ((saveFileDialog1.ShowDialog() == DialogResult.OK) && (saveFileDialog1.FileName != ""))
                    {
                        string savepath = saveFileDialog1.FileName;
                        if (Core.Generate_1_IP(comboBox3.Text, ip, port, savepath))
                        {
                            if (MessageBox.Show("生成成功,是否复制 metasploit 启动命令到剪贴板?", "成功", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                string msf_cmd = @"msfconsole -x ""use exploit/multi/handler; set payload windows/{{arch}}meterpreter/reverse_tcp; set lhost {{ip}}; set lport {{port}}; run; """;
                                string temp = comboBox3.Text.StartsWith("64") ? "x64/" : "";
                                msf_cmd = msf_cmd.Replace("{{arch}}", temp).Replace("{{ip}}", ip).Replace("{{port}}", port);
                                Clipboard.SetText(msf_cmd);
                            }
                        }
                        else
                        {
                            MessageBox.Show("生成失败,请检查你的输入。");
                        }
                    }
                    else
                    {
                        MessageBox.Show("必须按照 IP:端口 的形式,如 192.168.1.1:4444 ,输入地址。");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("必须按照 IP:端口 的形式,如 192.168.1.1:4444 ,输入地址。");
                    return;
                }
            }
            else
            {
                if (comboBox2.Text.Contains("注入"))
                {
                    if (textBox2.Text.Trim() == "")
                    {
                        MessageBox.Show("漏填了必填项,请检查", "提示");
                        return;
                    }
                    if (comboBox2.Text.Contains("现有"))
                    {
                        try
                        {
                            int temp = int.Parse(textBox2.Text);
                        }
                        catch
                        {
                            MessageBox.Show("注入现有进程时必须填写数字PID号", "提示");
                            return;
                        }
                    }
                }
                saveFileDialog1.Filter = "可执行文件|*.exe";
                if ((saveFileDialog1.ShowDialog() == DialogResult.OK) && (saveFileDialog1.FileName != "") && (richTextBox1.Text.Trim() != ""))
                {
                    bool result = false;
                    if (comboBox1.Text == "C")
                    {
                        result = Core.Gen_C(richTextBox1.Text, saveFileDialog1.FileName, comboBox2.Text, textBox2.Text, comboBox3.Text, comboBox5.Text);
                    }
                    else if (comboBox1.Text == "C#")
                    {
                        result = Core.Gen_CS(richTextBox1.Text, saveFileDialog1.FileName, comboBox2.Text, textBox2.Text, comboBox3.Text, comboBox5.Text);
                    }
                    if (result)
                    {
                        MessageBox.Show("生成成功!不要将生成的程序上传到在线杀毒网站", "成功");
                        return;
                    }
                    else
                    {
                        MessageBox.Show("生成失败!请检查你的输入", "失败");
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
        }

19 View Source File : SessionManageForm.cs
License : Apache License 2.0
Project Creator : 214175590

private void DeleteItem()
        {
            if (selectedRow != null)
            {
                string delid = curr_session.SessionId;

                DialogResult dr = MessageBox.Show("确认删除此项吗?", "提示", MessageBoxButtons.OKCancel);
                if (dr == DialogResult.OK)
                {
                    listView.Items.Remove(selectedRow);

                    if (AppConfig.Instance.SessionConfigDict.ContainsKey(delid))
                    {
                        AppConfig.Instance.SessionConfigDict.Remove(delid);
                    }                   

                    if (copy_session == curr_session)
                    {
                        copy_session = null;
                    }
                    curr_session = null;

                    AppConfig.Instance.SaveConfig(2);
                }
            }
        }

19 View Source File : FrmEdit.cs
License : GNU General Public License v3.0
Project Creator : 9vult

private void BtnEnable_Click(object sender, EventArgs e)
        {
            DialogResult result =
                MessageBox.Show("Changing these settings may require a re-download of manga files.\n\n" +
                                "Also, enabling this section may take several moments, depending on your Internet speed.\n\n" +
                                "Continue?", "Confirmation", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                btnEnable.Enabled = false;

                if (replacedle is Manga m && m is MangaDex)
                {
                    cmboLang.Items.Clear();

                    foreach (string lc in m.GetLangs())
                    {
                        cmboLang.Items.Add(lc);
                    }
                    foreach (string localeOption in cmboLang.Items)
                    {
                        if (localeOption.StartsWith(m.GetUserLang()))
                        {
                            cmboLang.SelectedItem = localeOption;
                            break;
                        }
                    }

                    cmboGroup.Enabled = true;
                    cmboLang.Enabled = true;
                }
                if (replacedle is Manga)
                    btnChapSelect.Enabled = true; // should allow chapter download for any manga
            }
        }

19 View Source File : FrmSettings.cs
License : GNU General Public License v3.0
Project Creator : 9vult

private void BtnSave_Click(object sender, EventArgs e)
        {
            // Save Update Checking preference 
            Properties.Settings.Default["checkForUpdates"] = chkUpdates.Checked;

            // Save Double-Page Reader preference
            Properties.Settings.Default["doublePageReader"] = chkDblReader.Checked;

            // Save language preference
            Properties.Settings.Default["languageCode"] = cmboLang.SelectedItem.ToString().Substring(0, 2);

            // Check if the home directory was changed
            if (!(new DirectoryInfo(txtDirectory.Text).ToString().Equals(new DirectoryInfo((string)Properties.Settings.Default["homeDirectory"]).ToString())))
            {
                DialogResult result = MessageBox.Show("Changing the save directory will require a restart. Continue?", "MikuReader", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    Properties.Settings.Default["homeDirectory"] = txtDirectory.Text;
                    Properties.Settings.Default.Save();
                    Application.Restart();
                } else
                {
                    txtDirectory.Text = (string)Properties.Settings.Default["homeDirectory"];
                }
            }
            Properties.Settings.Default.Save();
            MessageBox.Show("Requested changes were saved", "MikuReader");
            startPage.RefreshContents();
        }

19 View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN

public static void DefaultPathIssue() {
            //Path is program root - most likely an error, alert user
            DialogResult dialogResult = MessageBox.Show("It seems the path to the cloud service wasn't set correctly. Choose \"Yes\" to go through the setup again. If this doesn't work, try restarting the ACC software.", "Whoops, problem!", MessageBoxButtons.YesNo);
            DoDebug(dialogResult.ToString());

            try {
                if (dialogResult == DialogResult.Yes) {
                    Properties.Settings.Default.HasCompletedTutorial = false;
                    Properties.Settings.Default.ActionFilePath = "";
                    Properties.Settings.Default.Save();

                    if (gettingStarted != null) {
                        gettingStarted.Close();
                    }

                    ShowGettingStarted();
                }
            } catch {
                //Probably not in the main thread
            }
        }

19 View Source File : CustomApplicationContext.cs
License : MIT License
Project Creator : alexis-

private void exireplacedem_Click(object sender, EventArgs e)
    {
      if (MessageBox.Show(ExitConfirmMessage, ExitConfirmreplacedle, MessageBoxButtons.OKCancel) == DialogResult.OK)
        ExitThread();
    }

19 View Source File : SettingsForm.cs
License : MIT License
Project Creator : alexis-

private void DgSnapshotRules_CellContentClick(object sender, DataGridViewCellEventArgs e)
    {
      var senderGrid = (DataGridView)sender;

      if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
          e.RowIndex >= 0)
      {
        SnapshotRule rule = senderGrid.Rows[e.RowIndex].DataBoundItem as SnapshotRule;

        switch (senderGrid.Columns[e.ColumnIndex].Name)
        {
          case "Edit":
            rule = EditSnapshotRuleForm.DisplayInstance(rule);

            if (rule != null)
              AddOrUpdateSnapshotRule(rule);
            break;

          case "Delete":
            var res = MessageBox.Show("Do you also want to delete existing Snapshots ?", "Confirm", MessageBoxButtons.YesNoCancel);

            if (res != DialogResult.Cancel)
              DeleteSnapshotRule(rule, res == DialogResult.Yes);

            break;
        }
      }
    }

19 View Source File : WizardRoot.cs
License : MIT License
Project Creator : alvpickmans

public void RunStarted(object automationObject,
          Dictionary<string, string> replacementsDictionary,
          WizardRunKind runKind, object[] customParams)
        {
            this.runKind = runKind;
            GlobalDictionary["$saferootprojectname$"] = replacementsDictionary["$safeprojectname$"];
            string destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            if (!Enum.TryParse(replacementsDictionary["$dynamoprojecttype$"], out DynamoProjectType projectType))
                throw new Exception("Template doesn't have a valid '$dynamoprojecttype$' custom parameter!");

            PackageDefinitionViewModel viewModel = new PackageDefinitionViewModel();
            viewModel.PackageName = replacementsDictionary["$safeprojectname$"];

            switch (projectType)
            {
                case DynamoProjectType.ZeroTouch:
                    viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"], "1.0.0.0");
                    break;
                case DynamoProjectType.ExplicitNode:
                    viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"], "1.0.0.0");
                    viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"] + ".UI", "1.0.0.0");
                    break;
                default:
                    break;
            }
            
            this.Instancereplacedle = $"{WIZARD_replacedLE} - {projectType}";
            view = new PackageDefinitionView(viewModel)
            {
                replacedle = this.Instancereplacedle,
                DataContext = viewModel
            };

            foreach (var version in viewModel.dynamoEngineVersions)
            {
                view.engineVersions.Items.Add(version);
            }
            view.engineVersions.SelectedIndex = 0;

            view.Closed += (sender, args) =>
            {
                if (!viewModel.IsCancelled)
                {
                    var versionNumbers = viewModel.EngineVersion.Split('.');
                    var versionFolder = string.Join(".", new string[2] { versionNumbers[0], versionNumbers[1] });
                    var sandBoxPath = (versionNumbers[0] == "2") ? DynamoSandbox2path : String.Format(DynamoSandbox1path, versionFolder);
                    var replacedemblies = viewModel.replacedemblies.ToList();
                    string replacedemblyMain = (replacedemblies.Count >= 1) ? GetreplacedemblyData(replacedemblies[0].Key, replacedemblies[0].Value) : String.Empty;
                    string replacedemblyFunctions = (replacedemblies.Count >= 2) ? GetreplacedemblyData(replacedemblies[1].Key, replacedemblies[1].Value) : String.Empty;

                    AddReplacement(replacementsDictionary, "$packageName$", viewModel.PackageName);
                    AddReplacement(replacementsDictionary, "$packageVersion$", viewModel.PackageVersion);
                    AddReplacement(replacementsDictionary, "$packageDescription$", viewModel.PackageDescription);
                    AddReplacement(replacementsDictionary, "$dynamoVersion$", $"{viewModel.DynamoVersion}.*");
                    AddReplacement(replacementsDictionary, "$engineVersion$", viewModel.EngineVersion);
                    AddReplacement(replacementsDictionary, "$versionFolder$", versionFolder);
                    AddReplacement(replacementsDictionary, "$siteUrl$", viewModel.SiteUrl);
                    AddReplacement(replacementsDictionary, "$repoUrl$", viewModel.RepoUrl);
                    AddReplacement(replacementsDictionary, "$startProgramPath$", sandBoxPath);
                    AddReplacement(replacementsDictionary, "$nodeLibraries$", viewModel.NodeLibraries);
                    AddReplacement(replacementsDictionary, "$replacedemblyMain$", replacedemblyMain);
                    AddReplacement(replacementsDictionary, "$replacedemblyFunctions$", replacedemblyFunctions);
                    AddReplacement(replacementsDictionary, "$guidMain$", new Guid().ToString());
                    AddReplacement(replacementsDictionary, "$guidUI$", new Guid().ToString());
                }
            };

            view.Closing += (sender, args) =>
            {
                if (!viewModel.forceClose)
                {
                    var result = MessageBox.Show("Do you wish to stop creating the project?", this.Instancereplacedle, MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                        viewModel.IsCancelled = true;
                    else
                        args.Cancel = true;
                }

            };

            view.btn_Accept.Click += (sender, args) =>
            {
                if (!viewModel.IsEngineVersionSet())
                {
                    MessageBox.Show("An Engine Version must be selected.", this.Instancereplacedle);
                }
                else
                {
                    var result = MessageBox.Show("Are you happy with the package? You will be able to change the parameters later on.", this.Instancereplacedle, MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        viewModel.forceClose = true;
                        view.Close();
                    }
                }
            };

            view.ShowDialog();

            try
            {
                if (viewModel.IsCancelled)
                {
                    throw new WizardBackoutException();
                }
            }
            catch
            {

                if (System.IO.Directory.Exists(destinationDirectory))
                {
                    System.IO.Directory.Delete(destinationDirectory, true);
                }

                throw;
            }
        }

19 View Source File : MinerView.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth

private void deleteMinerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(Factory.Instance.CoreObject.Miners.Count<=1)
            {
                MessageBox.Show("Add another miner to delete this!", "Cannot delete the only Miner");
                return;
            }

            DialogResult retVal=MessageBox.Show("Miners once deleted cannot be recovered. Are you sure?", "Delete Miner", MessageBoxButtons.YesNo);
            if(retVal==DialogResult.Yes && Miner!=null)
            {
                Factory.Instance.CoreObject.RemoveMiner(Miner);
            }
        }

19 View Source File : ServedDevice.cs
License : GNU General Public License v3.0
Project Creator : ASCOMInitiative

private void BtnSetup_Click(object sender, EventArgs e)
        {
            // This device's ProgID is held in the variable progID so try and run its SetupDialog method
            ServerForm.LogMessage(0, 0, 0, "Setup", string.Format("Setup button pressed for device: {0}, ProgID: {1}", cmbDevice.Text, progID));

            try
            {
                // Get an instance of the driver from its ProgID and store this in a dynamic variable so that we can call its method directly
                Type ProgIdType = Type.GetTypeFromProgID(progID);
                //ServerForm.LogMessage(0, 0, 0, "Setup", string.Format("Found type: {0}", ProgIdType.Name));

                dynamic oDrv = Activator.CreateInstance(ProgIdType);
                //ServerForm.LogMessage(0, 0, 0, "Setup", "Created driver instance OK");

                try
                {
                    if (GetConnectdState(oDrv)) // Driver is connected and the Setup dialogue must be run with the device disconnected so ask whether we can disconnect it
                    {
                        DialogResult dialogResult = MessageBox.Show("Device is connected, OK to disconnect and run Setup?", "Disconnect Device?", MessageBoxButtons.OKCancel);
                        if (dialogResult == DialogResult.OK) // OK to disconnect and run setup dialogue
                        {
                            //ServerForm.LogMessage(0, 0, 0, "Setup", "User gave permission to disconnect device - setting Connected to false");
                            try { oDrv.Connected = false; } catch { }; // Set Connected to false ignoring errors
                            try { oDrv.Link = false; } catch { }; // Set Link to false (for IFocuserV1 devices) ignoring errors

                            int RemainingObjectCount = Marshal.FinalReleaseComObject(oDrv);
                            oDrv = null;
                            oDrv = Activator.CreateInstance(ProgIdType);

                            //ServerForm.LogMessage(0, 0, 0, "Setup", string.Format("Connected has bee set false and destroyed. New Connected value: {0}", oDrv.Connected));

                            //ServerForm.LogMessage(0, 0, 0, "Setup", "Device is now disconnected, calling SetupDialog method");
                            oDrv.SetupDialog();
                            //ServerForm.LogMessage(0, 0, 0, "Setup", "Completed SetupDialog method, setting Connected to true");

                            try
                            {
                                oDrv.Connected = true; // Try setting Connected to true
                            }
                            catch (Exception ex2) when (DeviceType.ToLowerInvariant() == "focuser")
                            {
                                // Connected failed so try Link in case this is an IFocuserV1 device
                                ServerForm.LogException(0, 0, 0, "Setup", $"Error setting Connected to true for focuser device {ProgID}, now trying Link for IFocuserV1 devices: \r\n{ex2}");
                                oDrv.Link = true;
                            }

                            //ServerForm.LogMessage(0, 0, 0, "Setup", "Driver is now Connected");
                        }
                        else // Not OK to disconnect so just do nothing and exit
                        {
                            ServerForm.LogMessage(0, 0, 0, "Setup", "User did not give permission to disconnect device - no action taken");
                        }
                    }
                    else // Driver is not connected 
                    {
                        //ServerForm.LogMessage(0, 0, 0, "Setup", "Device is disconnected so just calling SetupDialog method");
                        oDrv.SetupDialog();
                        //ServerForm.LogMessage(0, 0, 0, "Setup", "Completed SetupDialog method");

                        try { oDrv.Dispose(); } catch { }; // Dispose the driver if possible

                        // Release the COM object properly
                        try
                        {
                            //ServerForm.LogMessage(0, 0, 0, "Setup", "  Releasing COM object");
                            int LoopCount = 0;
                            int RemainingObjectCount = 0;

                            do
                            {
                                LoopCount += 1; // Increment the loop counter so that we don't go on for ever!
                                RemainingObjectCount = Marshal.ReleaseComObject(oDrv);
                                //ServerForm.LogMessage(0, 0, 0, "Setup", "  Remaining object count: " + RemainingObjectCount.ToString() + ", LoopCount: " + LoopCount);
                            } while ((RemainingObjectCount > 0) & (LoopCount < 20));
                        }
                        catch (Exception ex2)
                        {
                            ServerForm.LogMessage(0, 0, 0, "Setup", "  ReleaseComObject Exception: " + ex2.Message);
                        }

                        oDrv = null;
                    }
                }
                catch (Exception ex1)
                {
                    string errMsg = string.Format("Exception calling SetupDialog method: {0}", ex1.Message);
                    MessageBox.Show(errMsg);
                    ServerForm.LogMessage(0, 0, 0, "Setup", errMsg);
                    ServerForm.LogException(0, 0, 0, "Setup", ex1.ToString());
                }

            }
            catch (Exception ex)
            {
                string errMsg = string.Format("Exception creating driver {0} - {1}", progID, ex.Message);
                MessageBox.Show(errMsg);
                ServerForm.LogMessage(0, 0, 0, "Setup", errMsg);
                ServerForm.LogException(0, 0, 0, "Setup", ex.ToString());
            }
        }

19 View Source File : Mods.xaml.cs
License : MIT License
Project Creator : Assistant

private void Uninstall_Click(object sender, RoutedEventArgs e)
        {
            Mod mod = ((sender as System.Windows.Controls.Button).Tag as Mod);

            string replacedle = string.Format((string)FindResource("Mods:UninstallBox:replacedle"), mod.name);
            string body1 = string.Format((string)FindResource("Mods:UninstallBox:Body1"), mod.name);
            string body2 = string.Format((string)FindResource("Mods:UninstallBox:Body2"), mod.name);
            var result = System.Windows.Forms.MessageBox.Show($"{body1}\n{body2}", replacedle, MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                UninstallModFromList(mod);
            }
        }

19 View Source File : App.xaml.cs
License : MIT License
Project Creator : Assistant

private async void Application_Startup(object sender, StartupEventArgs e)
        {
            // Set SecurityProtocol to prevent crash with TLS
            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

            if (Modreplacedistant.Properties.Settings.Default.UpgradeRequired)
            {
                Modreplacedistant.Properties.Settings.Default.Upgrade();
                Modreplacedistant.Properties.Settings.Default.UpgradeRequired = false;
                Modreplacedistant.Properties.Settings.Default.Save();
            }

            Version = Version.Substring(0, Version.Length - 2);
            OCIWindow = Modreplacedistant.Properties.Settings.Default.OCIWindow;
            if (string.IsNullOrEmpty(OCIWindow))
            {
                OCIWindow = "Yes";
            }
            Pages.Options options = Pages.Options.Instance;
            options.InstallDirectory =
                BeatSaberInstallDirectory = Utils.GetInstallDir();

            Languages.LoadLanguages();

            while (string.IsNullOrEmpty(BeatSaberInstallDirectory))
            {
                string replacedle = (string)Current.FindResource("App:InstallDirDialog:replacedle");
                string body = (string)Current.FindResource("App:InstallDirDialog:OkCancel");

                if (System.Windows.Forms.MessageBox.Show(body, replacedle, System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    BeatSaberInstallDirectory = Utils.GetManualDir();
                }
                else
                {
                    Environment.Exit(0);
                }
            }

            options.InstallType =
                BeatSaberInstallType = Modreplacedistant.Properties.Settings.Default.StoreType;
            options.SaveSelection =
                SaveModSelection = Modreplacedistant.Properties.Settings.Default.SaveSelected;
            options.CheckInstalledMods =
                CheckInstalledMods = Modreplacedistant.Properties.Settings.Default.CheckInstalled;
            options.SelectInstalledMods =
                SelectInstalledMods = Modreplacedistant.Properties.Settings.Default.SelectInstalled;
            options.ReinstallInstalledMods =
                ReinstallInstalledMods = Modreplacedistant.Properties.Settings.Default.ReinstallInstalled;
            options.CloseWindowOnFinish =
                CloseWindowOnFinish = Modreplacedistant.Properties.Settings.Default.CloseWindowOnFinish;

            await ArgumentHandler(e.Args);
            await Init();
            options.UpdateOCIWindow(OCIWindow);
        }

19 View Source File : Options.xaml.cs
License : MIT License
Project Creator : Assistant

private async void YeetModsButton_Click(object sender, RoutedEventArgs e)
        {
            string replacedle = (string)Application.Current.FindResource("Options:YeetModsBox:replacedle");
            string line1 = (string)Application.Current.FindResource("Options:YeetModsBox:RemoveAllMods");
            string line2 = (string)Application.Current.FindResource("Options:YeetModsBox:CannotBeUndone");

            var resp = System.Windows.Forms.MessageBox.Show($"{line1}\n{line2}", replacedle, System.Windows.Forms.MessageBoxButtons.YesNo);
            if (resp == System.Windows.Forms.DialogResult.Yes)
            {

                if (Mods.Instance.AllModsList == null)
                {
                    MainWindow.Instance.MainText = $"{Application.Current.FindResource("Options:GettingModList")}...";
                    await Task.Run(async () => await Mods.Instance.CheckInstalledMods());
                }
                foreach (Mod mod in Mods.InstalledMods)
                {
                    Mods.Instance.UninstallMod(mod);
                }
                if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "Plugins")))
                    Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "Plugins"), true);
                if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "Libs")))
                    Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "Libs"), true);
                if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA")))
                    Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "IPA"), true);

                MainWindow.Instance.MainText = $"{Application.Current.FindResource("Options:AllModsUninstalled")}...";
            }
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : atenfyr

private void frm_closing(object sender, FormClosingEventArgs e)
        {
            if (!existsUnsavedChanges) return;

            DialogResult res = MessageBox.Show("Do you want to save your changes?", DisplayVersion, MessageBoxButtons.YesNoCancel);
            switch(res)
            {
                case DialogResult.Yes:
                    if (!ForceSave(currentSavingPath)) e.Cancel = true;
                    break;
                case DialogResult.Cancel:
                    e.Cancel = true;
                    break;
            }
        }

19 View Source File : DialogBox.cs
License : GNU General Public License v3.0
Project Creator : audiamus

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
		{
			CenterWindow centerWindow = new CenterWindow(IntPtr.Zero);
			DialogResult dlgResult = MessageBox.Show(text, caption, buttons);
			centerWindow.Dispose();
			return dlgResult;
		}

19 View Source File : DialogBox.cs
License : GNU General Public License v3.0
Project Creator : audiamus

public static DialogResult Show(string text, MessageBoxButtons buttons)
		{
			CenterWindow centerWindow = new CenterWindow(IntPtr.Zero);
			string caption = Application.ProductName;
			DialogResult dlgResult = MessageBox.Show(text, caption, buttons);
			centerWindow.Dispose();
			return dlgResult;
		}

19 View Source File : Progress.cs
License : MIT License
Project Creator : Autodesk-Forge

private void Progress_FormClosing(object sender, FormClosingEventArgs e)
    {
      if (progressBar1.Value < 100)
      {
        // prevent closing the app before it reaches 100%
        DialogResult res = MessageBox.Show(
          "If you close the application, it will not download the results. Proceed?",
          "Are you sure?",
          MessageBoxButtons.YesNo);
        e.Cancel = (res == DialogResult.No);
      }
    }

19 View Source File : Users.cs
License : MIT License
Project Creator : bilalmehrban

private void button1_Click(object sender, EventArgs e)
        {
        //Checking if text boxes are empty or null
        if(Validation())
        {
            //Gettting Data FRom UI
            
            u.user_name = txtusername.Text;
            u.user_type = txtusertype.Text;
            u.preplacedword = txtpreplacedword.Text;
            u.email = txtemail.Text;
            u.cnic = txtcnic.Text;
            u.adress = txtaddress.Text;
            u.phone_no = txtphoneno.Text; 
            //u.added_by = 1;
            u.added_date = DateTime.Now;

            //Getting Username of the logged in user
            string loggedUser = Login.loggedIn;
            usersbll usr = dal.GetIDFromUsername(loggedUser);

            u.added_by = usr.id;

            //Inserting Data into DAtabase
            bool check1 = dal.exist(u);

            //Checking if Product Already Exist
            if(check1 == true)
            {
                    //Showing MessageBox
                    DialogResult = MessageBox.Show("Product already exist do you want to update", "Message", MessageBoxButtons.YesNo);
                    if (DialogResult == DialogResult.Yes)
                    {
                        u.id = Convert.ToInt32(txtid.Text);
                        //Update Data in DataBase
                        bool check = dal.update(u);
                        if (check == true)
                        {
                            MessageBox.Show("Record updated successfully");
                            clear();
                        }
                        else
                        {
                            MessageBox.Show("error");
                        }
                        //Refreshing Data Grid View
                        DataTable dt1 = dal.select();
                        dgvusers.DataSource = dt1;
                    }
                }
            else
            {
                    //Inserting data in DataBase
                    bool check = dal.insert(u);
                    if (check == true)
                    {
                        MessageBox.Show("user data added successfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("error");
                    }
             }
            //Refreshing Data Grid View
            DataTable dt = dal.select();
            dgvusers.DataSource = dt;
          }
        }

19 View Source File : Manage Products.cs
License : MIT License
Project Creator : bilalmehrban

private void btndelete_Click(object sender, EventArgs e)
        {
            if(Validation())
            {
                //Showing Dialog Box to get yes or no result
                DialogResult = MessageBox.Show("Are You Want to delete", "Message", MessageBoxButtons.YesNo);
                if (DialogResult == DialogResult.Yes)
                {
                    //Getting User ID from Form 
                    u.id = Convert.ToInt32(txtproductid.Text);
                    //Deleting Data From DataBase
                    bool check = dal.delete(u);
                    if (check == true)
                    {
                        MessageBox.Show("Record deleted sucessfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("Record not deleted");
                    }
                    //refreshing Datagrid view
                    DataTable dt = dal.select();
                    dgvmanageproducts.DataSource = dt;
                }
            }
            
        }

19 View Source File : Suppliers.cs
License : MIT License
Project Creator : bilalmehrban

private void btndel_Click(object sender, EventArgs e)
        {
            if(Validation())
            {
                //Showing Dialog Box to get yes or no result
                DialogResult = MessageBox.Show("Are You Want to delete", "Message", MessageBoxButtons.YesNo);
                if (DialogResult == DialogResult.Yes)
                {
                    //Getting User ID from Form
                    u.id = Convert.ToInt32(txtid.Text);
                    //Deleting Data From DataBase
                    bool check = dal.delete(u);
                    if (check == true)
                    {
                        MessageBox.Show("Record deleted sucessfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("Record not deleted");
                    }
                    //refreshing Datagrid view
                    DataTable dt = dal.select();
                    dgvsuppliers.DataSource = dt;
                }
            }
        }

19 View Source File : Users.cs
License : MIT License
Project Creator : bilalmehrban

private void btndel_Click(object sender, EventArgs e)
        {
            if(Validation())
            {
                //Showing Dialog Box to get yes or no result
                DialogResult = MessageBox.Show("Are You Want to delete", "Message", MessageBoxButtons.YesNo);
                if (DialogResult == DialogResult.Yes)
                {
                    //Getting User ID from Form 
                    u.id = Convert.ToInt32(txtid.Text);
                    //Deleting Data From DataBase
                    bool check = dal.delete(u);
                    if (check == true)
                    {
                        MessageBox.Show("Record deleted sucessfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("Record not deleted");
                    }
                    //refreshing Datagrid view
                    DataTable dt = dal.select();
                    dgvusers.DataSource = dt;
                }
            }
        }

19 View Source File : Catagories.cs
License : MIT License
Project Creator : bilalmehrban

private void btnadd_Click(object sender, EventArgs e)
        {
            //Checking if text boxes are empty or null
            if (Validation())
            {
                //Gettting Data FRom UI
                
                u.catagory = txtcatagory.Text;
                u.supplier = txtsupplier.Text;
                //u.added_by = 1;
                u.added_date = DateTime.Now;

                //Getting Username of the logged in user
                string loggedUser = Login.loggedIn;
                usersbll usr = da.GetIDFromUsername(loggedUser);

                u.added_by = usr.id;
                //Inserting Data into DAtabase
                bool check1 = dal.exist(u);
                //Checking if Product Already Exist
                if (check1 == true)
                {
                    //Showing MessageBox
                    DialogResult = MessageBox.Show("Product already exist do you want to update", "Message", MessageBoxButtons.YesNo);
                    if (DialogResult == DialogResult.Yes)
                    {
                        u.id = Convert.ToInt32(txtid.Text);
                        //Update Data in DataBase
                        bool check = dal.update(u);
                        if (check == true)
                        {
                            MessageBox.Show("Record updated successfully");
                            clear();
                        }
                        else
                        {
                            MessageBox.Show("error");
                        }
                        //Refreshing Data Grid View
                        DataTable dt1 = dal.select();
                        dgvcatagories.DataSource = dt1;
                    }
                }
                else
                {
                    //Inserting data in DataBase
                    bool check = dal.insert(u);
                    if (check == true)
                    {
                        MessageBox.Show("user data added successfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("error");
                    }
                }
                //Refreshing Data Grid View
                DataTable dt = dal.select();
                dgvcatagories.DataSource = dt;
            }
        }

19 View Source File : Catagories.cs
License : MIT License
Project Creator : bilalmehrban

private void btndel_Click(object sender, EventArgs e)
        {
            if(Validation())
            {
                //Showing Dialog Box to get yes or no result
                DialogResult = MessageBox.Show("Are You Want to delete", "Message", MessageBoxButtons.YesNo);
                if (DialogResult == DialogResult.Yes)
                {
                    //Getting User ID from Form 
                    u.id = Convert.ToInt32(txtid.Text);
                    //Deleting Data From DataBase
                    bool check = dal.delete(u);
                    if (check == true)
                    {
                        MessageBox.Show("Record deleted sucessfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("Record not deleted");
                    }
                    //refreshing Datagrid view
                    DataTable dt = dal.select();
                    dgvcatagories.DataSource = dt;
                }
            }
        }

19 View Source File : Manage Products.cs
License : MIT License
Project Creator : bilalmehrban

private void button1_Click(object sender, EventArgs e)
        {
            //Checking if text boxes are empty or null
            if (Validation())
            {
                //Gettting Data FRom UI
                
                u.product_name = txtproductname.Text;
                u.colour_code = txtcolourcode.Text;
                u.supplier = txtsupplier.Text;
                u.catagory = txtcatagory.Text;
                u.purchase_price = txtpurchaseprice.Text;
                u.retail_price = txtretailprice.Text;
                u.type = txtmaxdiscount.Text;
                u.quanreplacedy = txtquanreplacedy.Text;
                //u.added_by = 1;
                u.added_date = DateTime.Now;

                //Getting Username of the logged in user
                string loggedUser = Login.loggedIn;
                usersbll usr = da.GetIDFromUsername(loggedUser);

                u.added_by = usr.id;
                //Inserting Data into DAtabase
                bool check1 = dal.exist(u);
                //Checking if Product Already Exist
                if (check1 == true)
                {
                    //Showing MessageBox
                    DialogResult = MessageBox.Show("Product already exist do you want to update", "Message", MessageBoxButtons.YesNo);
                    if (DialogResult == DialogResult.Yes)
                    {
                        u.id = Convert.ToInt32(txtproductid.Text);
                        //Update Data in DataBase
                        bool check = dal.update_(u);
                        if (check == true)
                        {
                            MessageBox.Show("Record updated successfully");
                            clear();
                        }
                        else
                        {
                            MessageBox.Show("error");
                        }
                        //Refreshing Data Grid View
                        DataTable dt1 = dal.select();
                        dgvmanageproducts.DataSource = dt1;
                    }
                }
                else
                {
                    //Inserting data in DataBase
                    bool check = dal.insert(u);
                    if (check == true)
                    {
                        MessageBox.Show("Record added successfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("error");
                    }
                }
                //Refreshing Data Grid View
                DataTable dt = dal.select();
                dgvmanageproducts.DataSource = dt;
            }

        }

19 View Source File : Suppliers.cs
License : MIT License
Project Creator : bilalmehrban

private void btnadd_Click(object sender, EventArgs e)
        {
            //Checking if text boxes are empty or null
            if (Validation())
            {
                //Gettting Data FRom UI
                
                u.user_name = txtusername.Text;
                u.email = txtemail.Text;
                u.company = txtcompany.Text;
                u.adress = txtadress.Text;
                u.phone_no = txtphoneno.Text;
                //u.added_by = 1;
                u.added_date = DateTime.Now;

                //Getting Username of the logged in user
                string loggedUser = Login.loggedIn;
                usersbll usr = da.GetIDFromUsername(loggedUser);

                u.added_by = usr.id;
                //Inserting Data into DAtabase
                bool check1 = dal.exist(u);
                //Checking if Product Already Exist
                if (check1 == true)
                {
                    //Showing MessageBox
                    DialogResult = MessageBox.Show("Product already exist do you want to update", "Message", MessageBoxButtons.YesNo);
                    if (DialogResult == DialogResult.Yes)
                    {
                        u.id = Convert.ToInt32(txtid.Text);
                        //Update Data in DataBase
                        bool check = dal.update(u);
                        if (check == true)
                        {
                            MessageBox.Show("Record updated successfully");
                            clear();
                        }
                        else
                        {
                            MessageBox.Show("error");
                        }
                        //Refreshing Data Grid View
                        DataTable dt1 = dal.select();
                        dgvsuppliers.DataSource = dt1;
                    }
                }
                else
                {
                    //Inserting data in DataBase
                    bool check = dal.insert(u);
                    if (check == true)
                    {
                        MessageBox.Show("user data added successfully");
                        clear();
                    }
                    else
                    {
                        MessageBox.Show("error");
                    }
                }
                //Refreshing Data Grid View
                DataTable dt = dal.select();
                dgvsuppliers.DataSource = dt;
            }
        }

19 View Source File : ImageUploadWindow.cs
License : MIT License
Project Creator : BlackDragonBE

private void btnUpload_Click(object sender, EventArgs e)
        {
            _errorInUpload = false;

            if (MessageBox.Show(
                    "Make sure this is the first time you upload these images and double check that the paths are correct before continuing.\n" +
                    "You may have to manually delete uploaded images if anything goes wrong. \n\n" +
                    "Do you want to upload the images and update both your markdown and html?",
                    "Are you sure you want to start the upload?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                UploadImages();

                if (!_errorInUpload)
                {
                    UpdateMarkdownAndHtml();
                    MessageBox.Show(
                        "Succesfully uploaded " + ImageUploadData.FullImagePaths.Count +
                        " images to the RW WordPress!\nYour markdown and the html preview have been updated with the image URLs. The HTML is fully ready to copy to WordPress!",
                        "Upload complete!");
                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
        }

19 View Source File : Main Form.cs
License : MIT License
Project Creator : bodyXY

private void InjectCompleted()
        {
            MessageBox.Show("Game injected!", "Have fun ;)", MessageBoxButtons.OK);
        }

19 View Source File : Main Form.cs
License : MIT License
Project Creator : bodyXY

private void InjectButton_Click(object sender, EventArgs e)
        {
            if (SortreplacedleTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Sortreplacedle!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (PublisherTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Publisher!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (GamecodeTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Game Code!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (GamecodeTextbox.Text.Length < 5 || GamecodeTextbox.Text.Length > 5)
            {
                MessageBox.Show("Enter the unique Game Code (between AAAAA and ZZZZZ)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (CopyrightTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Copyright!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (GamereplacedleTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Game replacedle!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Overscan box 1", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox.Text.Length < 1 || OverscanTextbox.Text.Length > 1)
            {
                MessageBox.Show("Enter the Overscan box 1 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox2.Text == string.Empty)
            {
                MessageBox.Show("Enter the Overscan box 2", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox2.Text.Length < 1 || OverscanTextbox2.Text.Length > 1)
            {
                MessageBox.Show("Enter the Overscan box 2 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox3.Text == string.Empty)
            {
                MessageBox.Show("Enter the Overscan box 3", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox3.Text.Length < 1 || OverscanTextbox3.Text.Length > 1)
            {
                MessageBox.Show("Enter the Overscan box 3 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox4.Text == string.Empty)
            {
                MessageBox.Show("Enter the Overscan box 4", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (OverscanTextbox4.Text.Length < 1 || OverscanTextbox4.Text.Length > 1)
            {
                MessageBox.Show("Enter the Overscan box 4 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (FadeinTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Fade In box 1", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (FadeinTextbox.Text.Length < 1 || FadeinTextbox.Text.Length > 1)
            {
                MessageBox.Show("Enter the Fade In box 1 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (FadeinTextbox2.Text == string.Empty)
            {
                MessageBox.Show("Enter the Fade In box 2", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (FadeinTextbox2.Text.Length < 1 || FadeinTextbox2.Text.Length > 1)
            {
                MessageBox.Show("Enter the Fade In box 2 between (0 and 9)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (VolumeTextbox.Text.Length < 1 || VolumeTextbox.Text.Length > 2)
            {
                MessageBox.Show("Enter the Volume (1-99)", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (VolumeTextbox.Text == string.Empty)
            {
                MessageBox.Show("Enter the Volume", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (GamepathTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid Game path", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (Coverpath1Textbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid Cover path 400x300", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (Coverpath2Textbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid Cover path 355x512", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (replacedledbTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid replacedle DB path", "Error.", MessageBoxButtons.OK);
                return;
            }

            string line;
            using (StreamReader CheckGamecode = new StreamReader(replacedledbTextbox.Text))

                if ((line = CheckGamecode.ReadToEnd()) != null)
                {
                    if (line.Contains(GamecodeTextbox.Text))
                    {
                        MessageBox.Show("Gamecode " + GamecodeTextbox.Text + " already exist in the replacedleDB", "Error");
                        return;
                    }
                }

            if (JPCheckbox.Checked == false)
            {
                string filecheck20 = "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + ".xtx.z";
                if (File.Exists(filecheck20))
                {
                    MessageBox.Show("Cover file " + GamecodeTextbox.Text + " already exist", "Error");
                    return;
                }
                string filecheck24 = "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + "00.xtx.z";
                if (File.Exists(filecheck24))
                {
                    MessageBox.Show("Cover file 355x512 " + GamecodeTextbox.Text + " already exist", "Error");
                    return;
                }
                string filecheck21 = "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + ".nes";
                if (File.Exists(filecheck21))
                {
                    MessageBox.Show("Game file " + GamecodeTextbox.Text + " already exist in the replacedleDB", "Error");
                    return;
                }
            }
            if (JPCheckbox.Checked)
            {
                string filecheck22 = "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + ".xtx.z";
                if (File.Exists(filecheck22))
                {
                    MessageBox.Show("Cover file 400x300 " + GamecodeTextbox.Text + " already exist", "Error");
                    return;
                }
                string filecheck23 = "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + "00.xtx.z";
                if (File.Exists(filecheck23))
                {
                    MessageBox.Show("Cover file 355x512 " + GamecodeTextbox.Text + " already exist", "Error");
                    return;
                }
                string filecheck25 = "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + ".nes";
                if (File.Exists(filecheck25))
                {
                MessageBox.Show("Game file " + GamecodeTextbox.Text + " already exist in the replacedleDB", "Error");
                return;
                }
            }

            string filecheck1 = "cover.xtx";
            if (File.Exists(filecheck1))
            {
                File.Delete(@"cover.xtx");
            }
            string filecheck2 = "screenshot.xtx";
            if (File.Exists(filecheck2))
            {
                File.Delete(@"screenshot.xtx");
            }
            string filecheck3 = "cover.xtx.zlib";
            if (File.Exists(filecheck3))
            {
                File.Delete(@"cover.xtx.zlib");
            }
            string filecheck4 = "screenshot.xtx.zlib";
            if (File.Exists(filecheck4))
            {
                File.Delete(@"screenshot.xtx.zlib");
            }
            string filecheck5 = "temp/cover.tga";
            if (File.Exists(filecheck5))
            {
                File.Delete(@"temp/cover.tga");
            }
            string filecheck6 = "temp/screenshot.tga";
            if (File.Exists(filecheck6))
            {
                File.Delete(@"temp/screenshot.tga");
            }
            string filecheck7 = "temp/lclreplacedics.replacedlesdb";
            if (File.Exists(filecheck7))
            {
                File.Delete(@"temp/lclreplacedics.replacedlesdb");
            }
            string filecheck8 = "temp";
            if (Directory.Exists(filecheck8))
            {
                Directory.Delete(@"temp");
            }

            if (JPCheckbox.Checked == false)
            {
                Directory.CreateDirectory("NES_ONLINE_Mod");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100D870045B6000");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text);

                Directory.CreateDirectory("temp");

                string FileFormat1 = @Coverpath1Textbox.Text;
                string tga0 = Path.GetExtension(FileFormat1);
                if (tga0 == ".tga")
                {
                    File.Copy(@Coverpath1Textbox.Text, "temp/cover.tga");
                }
                string FileFormat = @Coverpath1Textbox.Text;
                string tga = Path.GetExtension(FileFormat);
                if (tga == ".jpg")
                {
                    using (Bitmap original = new Bitmap(@Coverpath1Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/cover.tga");
                }
                string FileFormat2 = @Coverpath1Textbox.Text;
                string tga1 = Path.GetExtension(FileFormat2);
                if (tga1 == ".png")
                {
                    using (Bitmap original = new Bitmap(@Coverpath1Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/cover.tga");
                }

                string FileFormat00 = @Coverpath2Textbox.Text;
                string tga00 = Path.GetExtension(FileFormat00);
                if (tga00 == ".tga")
                {
                    File.Copy(@Coverpath2Textbox.Text, "temp/screenshot.tga");
                }
                string FileFormat3 = @Coverpath2Textbox.Text;
                string tga3 = Path.GetExtension(FileFormat3);
                if (tga3 == ".jpg")
                {
                    using (Bitmap original = new Bitmap(@Coverpath2Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/screenshot.tga");
                }
                string FileFormat4 = @Coverpath2Textbox.Text;
                string tga4 = Path.GetExtension(FileFormat4);
                if (tga4 == ".png")
                {
                    using (Bitmap original = new Bitmap(Coverpath2Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/screenshot.tga");
                }

                string filecheck9 = "cover.tga";
                if (File.Exists(filecheck9))
                {
                    File.Delete(@"cover.tga");
                }

                string filecheck10 = "screenshot.tga";
                if (File.Exists(filecheck10))
                {
                    File.Delete(@"screenshot.tga");
                }

                File.Move(@"temp/screenshot.tga", "screenshot.tga");
                File.Move(@"temp/cover.tga", "cover.tga");

                Nconvert.RunCommand($"-i cover.tga -o cover.xtx --mip-filter box --minmip 5 -f rgba8");
                Nconvert.RunCommand($"-i screenshot.tga -o screenshot.xtx --mip-filter box --minmip 5 -f rgba8");

                Zconvert.RunCommand($"cover.xtx");
                File.Copy(@"cover.xtx.zlib", "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + "00.xtx.z");
                File.Delete(@"cover.xtx");
                File.Delete(@"cover.xtx.zlib");

                Zconvert.RunCommand($"screenshot.xtx");
                File.Copy(@"screenshot.xtx.zlib", "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + ".xtx.z");
                File.Delete(@"screenshot.xtx");
                File.Delete(@"screenshot.xtx.zlib");

                File.Copy(@GamepathTextbox.Text, "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/HLV-C-" + GamecodeTextbox.Text + "\\" + "HLV-C-" + GamecodeTextbox.Text + ".nes");

                File.Copy(@replacedledbTextbox.Text, "temp/lclreplacedics.replacedlesdb");
                string filecheck11 = "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb";
                if (File.Exists(filecheck11))
                {
                    File.Delete(@"NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb");
                }
                File.Move(@"temp/lclreplacedics.replacedlesdb", "NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb");
                Directory.Delete(@"temp");
                
                var lines2 = File.ReadAllLines("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb");
                File.WriteAllLines("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb", lines2.Take(lines2.Length - 2).ToArray());
                using (StreamWriter db = new FileInfo("NES_ONLINE_Mod/replacedles/0100D870045B6000/romfs/replacedles/lclreplacedics.replacedlesdb").AppendText())
                {
                    db.WriteLine("        ,");
                    db.WriteLine("        {");
                    db.WriteLine("            \"sort_replacedle\": \"" + SortreplacedleTextbox.Text + "\",");
                    db.WriteLine("            \"publisher\": \"" + PublisherTextbox.Text + "\",");
                    db.WriteLine("            \"code\": \"HLV-C-" + GamecodeTextbox.Text + "\",");
                    db.WriteLine("            \"rom\": \"/replacedles/HLV-C-" + GamecodeTextbox.Text + "/HLV-C-" + GamecodeTextbox.Text + ".nes\",");
                    db.WriteLine("            \"copyright\": \"" + CopyrightTextbox.Text + "\",");
                    db.WriteLine("            \"replacedle\": \"" + GamereplacedleTextbox.Text + "\",");
                    db.WriteLine("            \"volume\": " + VolumeTextbox.Text + ",");
                    db.WriteLine("            \"release_date\": \"1987-12-01\",");
                    db.WriteLine("            \"players_count\": 1,");
                    db.WriteLine("            \"cover\": \"/replacedles/HLV-C-" + GamecodeTextbox.Text + "/HLV-C-" + GamecodeTextbox.Text + ".xtx.z\",");
                    db.WriteLine("            \"overscan\": [" + OverscanTextbox.Text + ", " + OverscanTextbox2.Text + ", " + OverscanTextbox3.Text + ", " + OverscanTextbox4.Text + "],");
                    db.WriteLine("            \"armet_version\": \"v1\",");
                    db.WriteLine("            \"lcla6_release_date\": \"2018-09-01\",");
                    db.WriteLine("            \"save_count\": 0,");
                    if (SimultreplacedFalseRadioButton.Checked)
                    {
                        db.WriteLine("            \"simultaneous\": false,");
                    };
                    if (SimultreplacedTrueRadioButton.Checked)
                    {
                        db.WriteLine("            \"simultaneous\": true,");
                    };
                    db.WriteLine("            \"fadein\": [" + FadeinTextbox.Text + ", " + FadeinTextbox2.Text + "],");
                    db.WriteLine("            \"details_screen\": \"/replacedles/HLV-C-" + GamecodeTextbox.Text + "/HLV-C-" + GamecodeTextbox.Text + "00.xtx.z\",");
                    db.WriteLine("            \"armet_threshold\": 80,");
                    db.WriteLine("            \"sort_publisher\": \"" + PublisherTextbox.Text + "\"");
                    db.WriteLine("        }");
                    db.WriteLine("    ]");
                    db.WriteLine("}");
                    db.Close();
                }
            }
            else if (JPCheckbox.Checked)
            {
                Directory.CreateDirectory("NES_ONLINE_Mod");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100B4E00444C000");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles");
                Directory.CreateDirectory("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/CLV-G-" + GamecodeTextbox.Text);

                Directory.CreateDirectory("temp");

                string FileFormat1 = @Coverpath1Textbox.Text;
                string tga0 = Path.GetExtension(FileFormat1);
                if (tga0 == ".tga")
                {
                    File.Copy(@Coverpath1Textbox.Text, "temp/cover.tga");
                }
                string FileFormat = @Coverpath1Textbox.Text;
                string tga = Path.GetExtension(FileFormat);
                if (tga == ".jpg")
                {
                    using (Bitmap original = new Bitmap(@Coverpath1Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/cover.tga");
                }
                string FileFormat2 = @Coverpath1Textbox.Text;
                string tga1 = Path.GetExtension(FileFormat2);
                if (tga1 == ".png")
                {
                    using (Bitmap original = new Bitmap(@Coverpath1Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/cover.tga");
                }

                string FileFormat00 = @Coverpath2Textbox.Text;
                string tga00 = Path.GetExtension(FileFormat00);
                if (tga00 == ".tga")
                {
                    File.Copy(@Coverpath2Textbox.Text, "temp/screenshot.tga");
                }
                string FileFormat3 = @Coverpath2Textbox.Text;
                string tga3 = Path.GetExtension(FileFormat3);
                if (tga3 == ".jpg")
                {
                    using (Bitmap original = new Bitmap(@Coverpath2Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/screenshot.tga");
                }
                string FileFormat4 = @Coverpath2Textbox.Text;
                string tga4 = Path.GetExtension(FileFormat4);
                if (tga4 == ".png")
                {
                    using (Bitmap original = new Bitmap(Coverpath2Textbox.Text))
                    using (Bitmap clone = new Bitmap(original))
                    using (Bitmap newbmp = clone.Clone(new Rectangle(0, 0, clone.Width, clone.Height), PixelFormat.Format32bppArgb))
                        T = (TGA)newbmp;
                    T.Save("temp/screenshot.tga");
                }

                string filecheck9 = "cover.tga";
                if (File.Exists(filecheck9))
                {
                    File.Delete(@"cover.tga");
                }

                string filecheck10 = "screenshot.tga";
                if (File.Exists(filecheck10))
                {
                    File.Delete(@"screenshot.tga");
                }

                File.Move(@"temp/cover.tga", "cover.tga");
                File.Move(@"temp/screenshot.tga", "screenshot.tga");

                Nconvert.RunCommand($"-i cover.tga -o cover.xtx --mip-filter box --minmip 5 -f rgba8");
                Nconvert.RunCommand($"-i screenshot.tga -o screenshot.xtx --mip-filter box --minmip 5 -f rgba8");

                Zconvert.RunCommand($"cover.xtx");
                File.Copy(@"cover.xtx.zlib", "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + "00.xtx.z");
                File.Delete(@"cover.xtx");
                File.Delete(@"cover.xtx.zlib");

                Zconvert.RunCommand($"screenshot.xtx");
                File.Copy(@"screenshot.xtx.zlib", "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + ".xtx.z");
                File.Delete(@"screenshot.xtx");
                File.Delete(@"screenshot.xtx.zlib");

                File.Copy(@GamepathTextbox.Text, "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/CLV-G-" + GamecodeTextbox.Text + "\\" + "CLV-G-" + GamecodeTextbox.Text + ".nes");

                File.Copy(@replacedledbTextbox.Text, "temp/lclreplacedics.replacedlesdb");
                string filecheck11 = "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb";
                if (File.Exists(filecheck11))
                {
                    File.Delete(@"NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb");
                }
                File.Move(@"temp/lclreplacedics.replacedlesdb", "NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb");
                Directory.Delete(@"temp");

                if (SimultreplacedFalseRadioButton.Checked)
                {
                    string fileContent1 = File.ReadAllText("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb");
                    fileContent1 = fileContent1.Remove(fileContent1.Length - 2) +
                        " ,{\"sort_replacedle\": \"" + SortreplacedleTextbox.Text + "\", " +
                        "\"publisher\": \"" + PublisherTextbox.Text + "\", " +
                        "\"code\": \"CLV-G-" + GamecodeTextbox.Text + "\", " +
                        "\"rom\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + ".nes\", " +
                        "\"copyright\": \"" + CopyrightTextbox.Text + "\", " +
                        "\"replacedle\": \"" + GamereplacedleTextbox.Text + "\", " +
                        "\"volume\": " + VolumeTextbox.Text + ", " +
                        "\"release_date\": \"1987-12-01\", " +
                        "\"players_count\": 1," +
                        "\"cover\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + ".xtx.z\"," +
                        "\"overscan\": [" + OverscanTextbox.Text + ", " + OverscanTextbox2.Text + ", " + OverscanTextbox3.Text + ", " + OverscanTextbox4.Text + "]," +
                        "\"armet_version\": \"v1\"," +
                        "\"lcla6_release_date\": \"2018-09-01\"," +
                        "\"save_count\": 0," +
                        "\"simultaneous\": false," +
                        "\"fadein\": [" + FadeinTextbox.Text + ", " + FadeinTextbox2.Text + "]," +
                        "\"details_screen\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + "00.xtx.z\"," +
                        "\"armet_threshold\": 80," +
                        "\"sort_publisher\": \"" + PublisherTextbox.Text + "\"" + "}]}";
                    File.WriteAllText("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb", fileContent1);
                };
                if (SimultreplacedTrueRadioButton.Checked)
                {
                    string fileContent2 = File.ReadAllText("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb");
                    fileContent2 = fileContent2.Remove(fileContent2.Length - 2) +
                        " ,{\"sort_replacedle\": \"" + SortreplacedleTextbox.Text + "\", " +
                        "\"publisher\": \"" + PublisherTextbox.Text + "\", " +
                        "\"code\": \"CLV-G-" + GamecodeTextbox.Text + "\", " +
                        "\"rom\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + ".nes\", " +
                        "\"copyright\": \"" + CopyrightTextbox.Text + "\", " +
                        "\"replacedle\": \"" + GamereplacedleTextbox.Text + "\", " +
                        "\"volume\": " + VolumeTextbox.Text + ", " +
                        "\"release_date\": \"1987-12-01\", " +
                        "\"players_count\": 1," +
                        "\"cover\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + ".xtx.z\"," +
                        "\"overscan\": [" + OverscanTextbox.Text + ", " + OverscanTextbox2.Text + ", " + OverscanTextbox3.Text + ", " + OverscanTextbox4.Text + "]," +
                        "\"armet_version\": \"v1\"," +
                        "\"lcla6_release_date\": \"2018-09-01\"," +
                        "\"save_count\": 0," +
                        "\"simultaneous\": true," +
                        "\"fadein\": [" + FadeinTextbox.Text + ", " + FadeinTextbox2.Text + "]," +
                        "\"details_screen\": \"/replacedles/CLV-G-" + GamecodeTextbox.Text + "/CLV-G-" + GamecodeTextbox.Text + "00.xtx.z\"," +
                        "\"armet_threshold\": 80," +
                        "\"sort_publisher\": \"" + PublisherTextbox.Text + "\"" + "}]}";
                    File.WriteAllText("NES_ONLINE_Mod/replacedles/0100B4E00444C000/romfs/replacedles/lclreplacedics.replacedlesdb", fileContent2);
                };
            }
            InjectCompleted();
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void NspExtractButton_Click(object sender, EventArgs e)
        {
            //CHECK CORRECT NSP PATH
            if (NspInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NSP path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            //CHECK CORRECT OUTPUT PATH
            else if (NspOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NSP output path!", "Error.", MessageBoxButtons.OK);
                return;
            }

            else
            {
                ProcessHelper();

                //HACTOOL COMMAND TO EXTRACT NSP
                Hactool.RunCommand($" --keyset \"{NspKeysTextbox.Text}\" -t pfs0 \"{NspInTextbox.Text}\" --outdir=\"{NspOutTextbox.Text}\"");
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void RomFSExtractButton_Click(object sender, EventArgs e)
        {
            //CHECK CORRECT ROMFS PATH
            if (romFSInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid romFS path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            //CHECK CORRECT OUTPUT PATH
            else if (romFSOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid romFS output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else
            {
                ProcessHelper();

                //HACTOOL COMMAND TO EXTRACT ROMFS
                Hactool.RunCommand($"-t romfs \"{romFSInTextbox.Text}\" --romfsdir=\"{romFSOutTextbox.Text}/romfs\"");

                display("Extracting completed successfully");
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void NcaExtractButton_Click(object sender, EventArgs e)
        {
            //CHECK CORRECT NCA PATH
            if (NcaInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NCA path!", "Error.", MessageBoxButtons.OK);
                return;
            }

            //CHECK CORRECT OUTPUT PATH
            else if (NcaOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NCA output path!", "Error.", MessageBoxButtons.OK);
                return;
            }

            //CHECK CORRECT replacedLE-KEY
            else if (NcareplacedleKeyTextbox.Text != string.Empty)
            {
                if (NcareplacedleKeyTextbox.Text.Length > 32 || NcareplacedleKeyTextbox.Text.Length < 32)
                {
                    MessageBox.Show("Invalid replacedle-key!", "Error.", MessageBoxButtons.OK);
                    return;
                }
            }
            
            if (NcareplacedleKeyTextbox.Text != string.Empty)
            {
                ProcessHelper();

                //HACTOOL COMMAND TO EXTRACT NCA WITHOUT replacedLE-KEY
                Hactool.RunCommand($"--keyset \"{NcaKeysTextbox.Text}\" --replacedlekey={NcareplacedleKeyTextbox.Text} \"{NcaInTextbox.Text}\" --section0dir=\"{NcaOutTextbox.Text}/exefs\" --romfsdir=\"{NcaOutTextbox.Text}/romfs\"");
            }
            else
            {
                ProcessHelper();

                //HACTOOL COMMAND TO EXTRACT NCA WITH replacedLE-KEY
                Hactool.RunCommand($" \"{NcaInTextbox.Text}\" --keyset \"{NcaKeysTextbox.Text}\" --section0dir=\"{NcaOutTextbox.Text}/exefs\" --romfsdir=\"{NcaOutTextbox.Text}/romfs\"");
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void XciExtractButton_Click(object sender, EventArgs e)
        {
            //CHECK CORRECT XCI PATH
            if (XciInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid XCI path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            //CHECK CORRECT OUTPUT PATH
            else if (XciOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid XCI output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else
            {
                ProcessHelper();

                //HACTOOL COMMAND TO EXTRACT XCI
                Hactool.RunCommand($"--keyset \"{XciKeysTextbox.Text}\" -t xci \"{XciInTextbox.Text}\" --outdir=\"{XciOutTextbox.Text}\"");
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void XciExtractButton_Click(object sender, EventArgs e)
        {
            if (XciInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid XCI path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (XciOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid XCI output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else
            {
                Hactool.RunCommand($"--keyset \"{XciKeysTextbox.Text}\" -t xci \"{XciInTextbox.Text}\" --outdir=\"{XciOutTextbox.Text}\"");

                ExtractedCompleted();
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void ExtractedCompleted()
        {
            MessageBox.Show("Extractet!", "Finish.", MessageBoxButtons.OK);
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void NspExtractButton_Click(object sender, EventArgs e)
        {
            if (NspInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NSP path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (NspOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NSP output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else
            {
                Hactool.RunCommand($" --keyset \"{NspKeysTextbox.Text}\" -t pfs0 \"{NspInTextbox.Text}\" --outdir=\"{NspOutTextbox.Text}\"");

                ExtractedCompleted();
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void NcaExtractButton_Click(object sender, EventArgs e)
        {
            if (NcaInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NCA path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (NcaOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid NCA output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (NcareplacedleKeyTextbox.Text != string.Empty)
            {
                if (NcareplacedleKeyTextbox.Text.Length > 32 || NcareplacedleKeyTextbox.Text.Length < 32)
                {
                    MessageBox.Show("Invalid replacedle-key!", "Error.", MessageBoxButtons.OK);
                    return;
                }
            }
            if (NcareplacedleKeyTextbox.Text != string.Empty)
            {
                Hactool.RunCommand($"--keyset \"{NcaKeysTextbox.Text}\" --replacedlekey={NcareplacedleKeyTextbox.Text} \"{NcaInTextbox.Text}\" --section0dir=\"{NcaOutTextbox.Text}/exefs\" --romfsdir=\"{NcaOutTextbox.Text}/romfs\"");

                ExtractedCompleted();
            }
            else
            {
                Hactool.RunCommand($" \"{NcaInTextbox.Text}\" --keyset \"{NcaKeysTextbox.Text}\" --section0dir=\"{NcaOutTextbox.Text}/exefs\" --romfsdir=\"{NcaOutTextbox.Text}/romfs\"");

                ExtractedCompleted();
            }
        }

19 View Source File : GUI.cs
License : MIT License
Project Creator : bodyXY

private void RomFSExtractButton_Click(object sender, EventArgs e)
        {
            if (romFSInTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid romFS path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else if (romFSOutTextbox.Text == string.Empty)
            {
                MessageBox.Show("Invalid romFS output path!", "Error.", MessageBoxButtons.OK);
                return;
            }
            else
            {
                Hactool.RunCommand($"-t romfs \"{romFSInTextbox.Text}\" --romfsdir=\"{romFSOutTextbox.Text}/romfs\"");

                ExtractedCompleted();
            }
        }

19 View Source File : Form1.cs
License : GNU General Public License v3.0
Project Creator : BorjaMerino

private void ClearGridToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dialogResult = MessageBox.Show(@"Are you sure?", @"Delete data", MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes) DtSales.Clear();
        }

19 View Source File : Form1.cs
License : GNU General Public License v3.0
Project Creator : BorjaMerino

private bool FillComboDevices()
        {
            try
            {
                _devices = WinPcapDeviceList.Instance;
                if (_devices.Count < 1)
                {
                    MessageBox.Show(@"No devices were found on this machine",
                        @"No devices found", MessageBoxButtons.OK);
                    return false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"This app requires WinPcap. Please refer to: https://www.winpcap.org/install/",
                    @"WinPcap Not Found", MessageBoxButtons.OK);

                Debug.WriteLine("[-] Error WinPcap: " + ex.Message);
                return false;
            }

            foreach (ICaptureDevice device in _devices)
            {
                var pattern = "FriendlyName:.*\n";
                var matchDevice = Regex.Match(device.ToString(), pattern);
                var friendly = matchDevice.ToString().TrimEnd('\r', '\n');
                cboInterfaces.Items.Add(friendly.Split(' ')[1] + ": " + device.Description);
            }

            cboInterfaces.DropDownStyle = ComboBoxStyle.DropDownList;
            return true;
        }

19 View Source File : Form1.cs
License : GNU General Public License v3.0
Project Creator : BorjaMerino

private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode.ToString() == "F4")
            {
                var dialogResult = MessageBox.Show(@"Are you sure?", @"Delete data", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    DtSales.Clear();
                    numRows.Text = "0";
                }
            }

            if (e.KeyCode.ToString() == "F5")
            {
                var result = DnsFlushResolverCache();
                if (result == 1)
                    MessageBox.Show(@"DNS cache cleared successfully");
            }

            if (e.KeyCode.ToString() == "F6") DomainCountToolStripMenuItem_Click(sender, e);

            if (e.Control && e.KeyCode == Keys.E) dgvMain.SelectAll();
        }

19 View Source File : Authenticate.cs
License : MIT License
Project Creator : brianzhouzc

private void loginButton_Click(object sender, EventArgs e)
        {
            if (usernameTextField.Text != "" && preplacedwordTextField.Text != "")
            {
                var id = "060b5cde8c3d11e89eb6529269fb1459";
                var description = "LastPreplaced for Wox";
                try
                {
                    var thread = new Thread(
                       () =>
                       {
                           vault = Vault.Open(usernameTextField.Text,
                                            preplacedwordTextField.Text,
                                            new ClientInfo(Platform.Desktop, id, description, false),
                                            new TwoFactorUI());
                       });

                    thread.Start();
                    thread.Join();

                    if (rememberUsernameCheckBox.Checked)
                        Properties.Settings.Default.username = usernameTextField.Text;
                    else
                        Properties.Settings.Default.username = "";

                    if (rememberPreplacedwordCheckBox.Checked)
                        Properties.Settings.Default.preplacedword = preplacedwordTextField.Text;
                    else
                        Properties.Settings.Default.preplacedword = "";

                    Properties.Settings.Default.saveusername = rememberUsernameCheckBox.Checked;
                    Properties.Settings.Default.savepreplacedword = rememberPreplacedwordCheckBox.Checked;
                    Properties.Settings.Default.Save();

                    
                    Main.form.twofactor.Close();
                    Main.form.twofactor.Dispose();

                    Main.form.Close();
                    Main.form.Dispose();
                    MessageBox.Show("You have successfully logged in.");
                }
                catch (Exception ex)
                {
                    vault = null;
                    MessageBox.Show("Something went wrong, maybe wrong username or preplacedword?", "Error", MessageBoxButtons.OK);
                }

            }
            else
            {
                MessageBox.Show("You are missing some information!", "You are missing some information!", MessageBoxButtons.OK);
            }
        }

19 View Source File : Form1.cs
License : GNU General Public License v3.0
Project Creator : brunopaiva15

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                DialogResult form1 = MessageBox.Show("Are you sure you want to leave the utility ?", "Exit", MessageBoxButtons.YesNo);

                if (form1 == DialogResult.Yes)
                {
                    System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcessesByName("cmd");
                    foreach (System.Diagnostics.Process p in process)
                    {
                        if (!string.IsNullOrEmpty(p.ProcessName))
                        {
                            p.Kill();
                        }
                    }

                    System.Diagnostics.Process[] process1 = System.Diagnostics.Process.GetProcessesByName("Dism");
                    foreach (System.Diagnostics.Process p in process1)
                    {
                        if (!string.IsNullOrEmpty(p.ProcessName))
                        {
                            p.Kill();
                        }
                    }

                    Process.GetCurrentProcess().Kill();
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch
            {
                MessageBox.Show("Error when closing the program.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 View Source File : Wizard.cs
License : GNU General Public License v3.0
Project Creator : brunopaiva15

private void Wizard_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                DialogResult form1 = MessageBox.Show("Are you sure you want to leave the utility ?", "Exit", MessageBoxButtons.YesNo);

                if (form1 == DialogResult.Yes)
                {
                    System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcessesByName("cmd");
                    foreach (System.Diagnostics.Process p in process)
                    {
                        if (!string.IsNullOrEmpty(p.ProcessName))
                        {
                            p.Kill();
                        }
                    }

                    System.Diagnostics.Process[] process1 = System.Diagnostics.Process.GetProcessesByName("Dism");
                    foreach (System.Diagnostics.Process p in process1)
                    {
                        if (!string.IsNullOrEmpty(p.ProcessName))
                        {
                            p.Kill();
                        }
                    }

                    Process.GetCurrentProcess().Kill();
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch
            {
                MessageBox.Show("Error when closing the program.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 View Source File : Wizard.cs
License : GNU General Public License v3.0
Project Creator : brunopaiva15

private void btnGo_Click(object sender, EventArgs e)
        {
            try
            {
                if (Directory.Exists(@"C:\Program Files (x86)\Windows Kits\10\replacedessment and Deployment Kit"))
                {
                    Cursor.Current = Cursors.WaitCursor;
                    btnGo.Enabled = false;

                    if (rbAMD64.Checked == true)
                    {
                        strChoosed = "amd64";

                        Process procGenererPE = new Process();
                        procGenererPE.StartInfo.FileName = "cmd";
                        procGenererPE.StartInfo.Verb = "runas";
                        //procGenererPE.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Windows Kits\10\replacedessment and Deployment Kit\Windows Preinstallation Environment";
                        procGenererPE.StartInfo.Arguments = "/k " + Directory.GetCurrentDirectory() + "\\copype.cmd amd64" + " C:\\WinPE_amd64 & exit";
                        procGenererPE.StartInfo.ErrorDialog = true;
                        procGenererPE.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        procGenererPE.Start();
                        procGenererPE.WaitForExit();
                    }

                    if (rbX86.Checked == true)
                    {
                        strChoosed = "x86";

                        Process procGenererPE = new Process();
                        procGenererPE.StartInfo.FileName = "cmd";
                        procGenererPE.StartInfo.Verb = "runas";
                        //procGenererPE.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Windows Kits\10\replacedessment and Deployment Kit\Windows Preinstallation Environment";
                        procGenererPE.StartInfo.Arguments = "/k " + Directory.GetCurrentDirectory() + "\\copype.cmd x86" + " C:\\WinPE_x86 & exit";
                        procGenererPE.StartInfo.ErrorDialog = true;
                        procGenererPE.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        procGenererPE.Start();
                        procGenererPE.WaitForExit();
                    }

                    if (rbARM.Checked == true)
                    {
                        strChoosed = "arm";

                        Process procGenererPE = new Process();
                        procGenererPE.StartInfo.FileName = "cmd";
                        procGenererPE.StartInfo.Verb = "runas";
                        //procGenererPE.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Windows Kits\10\replacedessment and Deployment Kit\Windows Preinstallation Environment";
                        procGenererPE.StartInfo.Arguments = "/k " + Directory.GetCurrentDirectory() + "\\copype.cmd arm" + " C:\\WinPE_arm & exit";
                        procGenererPE.StartInfo.ErrorDialog = true;
                        procGenererPE.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        procGenererPE.Start();
                        procGenererPE.WaitForExit();
                    }

                    if (tbxLCID.Text != "" || cbxDrivers.Checked == true)
                    {
                        Process procOuvrirWIM = new Process();
                        procOuvrirWIM.StartInfo.FileName = "cmd";
                        procOuvrirWIM.StartInfo.Verb = "runas";
                        procOuvrirWIM.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                        procOuvrirWIM.StartInfo.Arguments = @"/k Dism /Mount-Image /ImageFile:C:\WinPE_" + strChoosed + @"\media\sources\boot.wim /index:1 /MountDir:C:\WinPE_" + strChoosed + @"\mount & exit";
                        procOuvrirWIM.StartInfo.ErrorDialog = true;
                        procOuvrirWIM.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        procOuvrirWIM.Start();
                        procOuvrirWIM.WaitForExit();
                    }

                    if (Directory.Exists("C:\\WinPE_" + strChoosed))
                    {
                        if (tbxLCID.Text != "")
                        {
                            Process procSysLocale = new Process();
                            procSysLocale.StartInfo.FileName = "cmd";
                            procSysLocale.StartInfo.Verb = "runas";
                            procSysLocale.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procSysLocale.StartInfo.Arguments = "/k Dism /image:C:\\WinPE_" + strChoosed + "\\mount /Set-SysLocale:" + tbxLCID.Text + " & exit";
                            procSysLocale.StartInfo.ErrorDialog = true;
                            procSysLocale.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procSysLocale.Start();
                            procSysLocale.WaitForExit();

                            Process procInputLocale = new Process();
                            procInputLocale.StartInfo.FileName = "cmd";
                            procInputLocale.StartInfo.Verb = "runas";
                            procInputLocale.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procInputLocale.StartInfo.Arguments = "/k Dism /image:C:\\WinPE_" + strChoosed + "\\mount /Set-InputLocale:" + tbxLCID.Text + " & exit";
                            procInputLocale.StartInfo.ErrorDialog = true;
                            procInputLocale.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procInputLocale.Start();
                            procInputLocale.WaitForExit();

                            Process procUserLocale = new Process();
                            procUserLocale.StartInfo.FileName = "cmd";
                            procUserLocale.StartInfo.Verb = "runas";
                            procUserLocale.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procUserLocale.StartInfo.Arguments = "/k Dism /image:C:\\WinPE_" + strChoosed + "\\mount /Set-UserLocale:" + tbxLCID.Text + " & exit";
                            procUserLocale.StartInfo.ErrorDialog = true;
                            procUserLocale.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procUserLocale.Start();
                            procUserLocale.WaitForExit();
                        }
                    }

                    if (Directory.Exists("C:\\WinPE_" + strChoosed))
                    {
                        if (cbxCreateUSB.Checked == true)
                        {
                            if (cbxUSB.Text != "")
                            {
                                Process procDeplacerFichier = new Process();
                                procDeplacerFichier.StartInfo.FileName = "cmd";
                                procDeplacerFichier.StartInfo.Verb = "runas";
                                procDeplacerFichier.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                                procDeplacerFichier.StartInfo.Arguments = "/k copy " + Directory.GetCurrentDirectory() + @"\bootsect.exe C:\Windows\System32\ & exit";
                                procDeplacerFichier.StartInfo.ErrorDialog = true;
                                procDeplacerFichier.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                                procDeplacerFichier.Start();
                                procDeplacerFichier.WaitForExit();

                                Process procCreerUSB = new Process();
                                procCreerUSB.StartInfo.FileName = "cmd";
                                procCreerUSB.StartInfo.Verb = "runas";
                                procCreerUSB.StartInfo.Arguments = "/k " + Directory.GetCurrentDirectory() + "\\MakeWinPEMedia.cmd /UFD C:\\WinPE_" + strChoosed + " " + cbxUSB.Text + " & exit";
                                procCreerUSB.StartInfo.ErrorDialog = true;
                                procCreerUSB.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                                procCreerUSB.Start();
                                procCreerUSB.WaitForExit();
                            }
                        }
                    }

                    if (Directory.Exists("C:\\WinPE_" + strChoosed))
                    {
                        if (cbxScript.Checked == true)
                        {
                            Process procCreerRepertoireScript = new Process();
                            procCreerRepertoireScript.StartInfo.FileName = "cmd";
                            procCreerRepertoireScript.StartInfo.Verb = "runas";
                            procCreerRepertoireScript.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procCreerRepertoireScript.StartInfo.Arguments = @"/k mkdir C:\WinPE_" + strChoosed + @"\mount\scripts & exit";
                            procCreerRepertoireScript.StartInfo.ErrorDialog = true;
                            procCreerRepertoireScript.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procCreerRepertoireScript.Start();
                            procCreerRepertoireScript.WaitForExit();

                            Process procDeplacerFichier1 = new Process();
                            procDeplacerFichier1.StartInfo.FileName = "cmd";
                            procDeplacerFichier1.StartInfo.Verb = "runas";
                            procDeplacerFichier1.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier1.StartInfo.Arguments = @"/k copy diskpart_DISK.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_DISK.txt & exit";
                            procDeplacerFichier1.StartInfo.ErrorDialog = true;
                            procDeplacerFichier1.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier1.Start();
                            procDeplacerFichier1.WaitForExit();

                            Process procDeplacerFichier2 = new Process();
                            procDeplacerFichier2.StartInfo.FileName = "cmd";
                            procDeplacerFichier2.StartInfo.Verb = "runas";
                            procDeplacerFichier2.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier2.StartInfo.Arguments = @"/k copy diskpart_prep_1.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_prep_1.txt & exit";
                            procDeplacerFichier2.StartInfo.ErrorDialog = true;
                            procDeplacerFichier2.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier2.Start();
                            procDeplacerFichier2.WaitForExit();

                            Process procDeplacerFichier3 = new Process();
                            procDeplacerFichier3.StartInfo.FileName = "cmd";
                            procDeplacerFichier3.StartInfo.Verb = "runas";
                            procDeplacerFichier3.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier3.StartInfo.Arguments = @"/k copy diskpart_prep_2.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_prep_2.txt & exit";
                            procDeplacerFichier3.StartInfo.ErrorDialog = true;
                            procDeplacerFichier3.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier3.Start();
                            procDeplacerFichier3.WaitForExit();

                            Process procDeplacerFichier4 = new Process();
                            procDeplacerFichier4.StartInfo.FileName = "cmd";
                            procDeplacerFichier4.StartInfo.Verb = "runas";
                            procDeplacerFichier4.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier4.StartInfo.Arguments = @"/k copy diskpart_prep_3.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_prep_3.txt & exit";
                            procDeplacerFichier4.StartInfo.ErrorDialog = true;
                            procDeplacerFichier4.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier4.Start();
                            procDeplacerFichier4.WaitForExit();

                            Process procDeplacerFichier5 = new Process();
                            procDeplacerFichier5.StartInfo.FileName = "cmd";
                            procDeplacerFichier5.StartInfo.Verb = "runas";
                            procDeplacerFichier5.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier5.StartInfo.Arguments = @"/k copy diskpart_TWICE.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_TWICE.txt & exit";
                            procDeplacerFichier5.StartInfo.ErrorDialog = true;
                            procDeplacerFichier5.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier5.Start();
                            procDeplacerFichier5.WaitForExit();

                            Process procDeplacerFichier6 = new Process();
                            procDeplacerFichier6.StartInfo.FileName = "cmd";
                            procDeplacerFichier6.StartInfo.Verb = "runas";
                            procDeplacerFichier6.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier6.StartInfo.Arguments = @"/k copy diskpart_VOL.txt C:\WinPE_" + strChoosed + @"\mount\scripts\diskpart_VOL.txt & exit";
                            procDeplacerFichier6.StartInfo.ErrorDialog = true;
                            procDeplacerFichier6.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier6.Start();
                            procDeplacerFichier6.WaitForExit();

                            Process procDeplacerFichier7 = new Process();
                            procDeplacerFichier7.StartInfo.FileName = "cmd";
                            procDeplacerFichier7.StartInfo.Verb = "runas";
                            procDeplacerFichier7.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier7.StartInfo.Arguments = @"/k copy dism_script.bat C:\WinPE_" + strChoosed + @"\mount\scripts\dism_script.bat & exit";
                            procDeplacerFichier7.StartInfo.ErrorDialog = true;
                            procDeplacerFichier7.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier7.Start();
                            procDeplacerFichier7.WaitForExit();

                            Process procDeplacerFichier8 = new Process();
                            procDeplacerFichier8.StartInfo.FileName = "cmd";
                            procDeplacerFichier8.StartInfo.Verb = "runas";
                            procDeplacerFichier8.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier8.StartInfo.Arguments = @"/k copy Ghost64.exe C:\WinPE_" + strChoosed + @"\mount\scripts\Ghost64.bat & exit";
                            procDeplacerFichier8.StartInfo.ErrorDialog = true;
                            procDeplacerFichier8.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier8.Start();
                            procDeplacerFichier8.WaitForExit();

                            Process procDeplacerFichier9 = new Process();
                            procDeplacerFichier9.StartInfo.FileName = "cmd";
                            procDeplacerFichier9.StartInfo.Verb = "runas";
                            procDeplacerFichier9.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier9.StartInfo.Arguments = @"/k copy /y startnet.cmd C:\WinPE_" + strChoosed + @"\mount\Windows\System32\startnet.cmd & exit";
                            procDeplacerFichier9.StartInfo.ErrorDialog = true;
                            procDeplacerFichier9.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier9.Start();
                            procDeplacerFichier9.WaitForExit();
                        }
                    }

                    if (Directory.Exists("C:\\WinPE_" + strChoosed))
                    {
                        if (cbxDrivers.Checked == true)
                        {
                            if (tbxDrivers.Text != "")
                            {
                                string[] lines = tbxDrivers.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

                                foreach (string l in lines)
                                {
                                    Process procAddDriver = new Process();
                                    procAddDriver.StartInfo.FileName = "cmd";
                                    procAddDriver.StartInfo.Verb = "runas";
                                    procAddDriver.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                                    procAddDriver.StartInfo.Arguments = "/k Dism /Add-Driver /Image:C:\\WinPE_" + strChoosed + @"\mount /Driver:\"" + l + "" & exit";
                                    procAddDriver.StartInfo.ErrorDialog = true;
                                    procAddDriver.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                                    procAddDriver.Start();
                                    procAddDriver.WaitForExit();
                                }
                            }
                        }
                    }

                    if (tbxLCID.Text != "" || cbxDrivers.Checked == true)
                    {
                        Process procFermerWIM = new Process();
                        procFermerWIM.StartInfo.FileName = "cmd";
                        procFermerWIM.StartInfo.Verb = "runas";
                        procFermerWIM.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                        procFermerWIM.StartInfo.Arguments = "/k Dism /Unmount-Image /MountDir:C:\\WinPE_" + strChoosed + "\\mount /commit & exit";
                        procFermerWIM.StartInfo.ErrorDialog = true;
                        procFermerWIM.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        procFermerWIM.Start();
                        procFermerWIM.WaitForExit();
                    }

                    if (Directory.Exists("C:\\WinPE_" + strChoosed))
                    {
                        if (cbxGenerateISO.Checked == true)
                        {
                            Process procDeplacerFichier = new Process();
                            procDeplacerFichier.StartInfo.FileName = "cmd";
                            procDeplacerFichier.StartInfo.Verb = "runas";
                            procDeplacerFichier.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procDeplacerFichier.StartInfo.Arguments = "/k copy " + Directory.GetCurrentDirectory() + @"\oscdimg.exe C:\Windows\System32\ & exit";
                            procDeplacerFichier.StartInfo.ErrorDialog = true;
                            procDeplacerFichier.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procDeplacerFichier.Start();
                            procDeplacerFichier.WaitForExit();

                            Process procGenereISO = new Process();
                            procGenereISO.StartInfo.FileName = "cmd";
                            procGenereISO.StartInfo.Verb = "runas";
                            procGenereISO.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
                            procGenereISO.StartInfo.Arguments = "/k " + Directory.GetCurrentDirectory() + "\\MakeWinPEMedia.cmd /iso C:\\WinPE_" + strChoosed + " C:\\WinPe_" + strChoosed + "\\WinPE.iso & exit";
                            procGenereISO.StartInfo.ErrorDialog = true;
                            procGenereISO.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            procGenereISO.Start();
                            procGenereISO.WaitForExit();
                        }
                    }

                    Cursor.Current = Cursors.Default;
                    btnGo.Enabled = true;

                    MessageBox.Show("All operations were successfully completed.", "Success", MessageBoxButtons.OK);
                }
                else
                {
                    System.Diagnostics.Process.Start("https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install");
                    MessageBox.Show("You need to install Windows ADK to use WinPE Creation Tool.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
                MessageBox.Show("An unexpected error occurred.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 View Source File : CsvDownloadForm.cs
License : Apache License 2.0
Project Creator : BuffettCode

private void Execute()
        {
            if (!ValidateControls())
            {
                return;
            }
            try
            {
                var parameters = CreateParametersFromFormValues();
                var resources = apiResourceGetter.GetQuarters(parameters);
                var quarters = resources.ToList();
                if (quarters.Count == 0)
                {
                    MessageBox.Show("条件に当てはまる財務データがありませんでした。", "CSV出力", MessageBoxButtons.OK);
                }
                else
                {
                    var tabular = TabularFormatter<Quarter>.Format(quarters);
                    var writer = quarterTabularWriterBuilder.Set(parameters).Build();
                    writer.Write(tabular);
                    MessageBox.Show("財務データの取得が完了しました", "CSV出力", MessageBoxButtons.OK);
                }
                DialogResult = DialogResult.OK;
            }
            catch (TestAPIConstraintException)
            {
                MessageBox.Show("テスト用のAPIキーでは末尾が01の銘柄コードのみ使用できます。", "CSV出力", MessageBoxButtons.OK);
            }
            catch (QuotaException)
            {
                MessageBox.Show("APIの実行回数が上限に達しました。", "CSV出力", MessageBoxButtons.OK);
            }
            catch (InvalidAPIKeyException)
            {
                MessageBox.Show("APIキーが有効ではありません。", "CSV出力", MessageBoxButtons.OK);
            }
            catch (ApiResponseParserException)
            {
                MessageBox.Show("APIのレスポンスのパースに失敗しました。", "CSV出力", MessageBoxButtons.OK);
            }
            catch (NotSupportedTierException)
            {
                MessageBox.Show("取得可能な範囲を超えています", "CSV出力", MessageBoxButtons.OK);
            }
            catch (OperationCanceledException)
            {
                MessageBox.Show("CSV出力がキャンセルされました", "CSV出力", MessageBoxButtons.OK);
            }
            catch (Exception)
            {
                MessageBox.Show("データの取得中にエラーが発生しました。", "CSV出力", MessageBoxButtons.OK);
            }
            Close();
        }

19 View Source File : Ribbon.cs
License : Apache License 2.0
Project Creator : BuffettCode

private void SettingButton_Click(object sender, RibbonControlEventArgs e)
        {
            var config = Configuration.GetInstance();
            var configSettings = AddinSettings.Create(config);
            var form = new SettingForm(configSettings);
            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                try
                {
                    var newSettings = AddinSettings.Create(form.GetAPIKey(), form.IsOndemandEndpointEnabled(), form.IsDebugMode());
                    newSettings.SaveToConfiguration(config);
                }
                catch (AddinConfigurationException)
                {
                    MessageBox.Show("API KEYが間違っています", "設定", MessageBoxButtons.OK);
                }
            }
        }

19 View Source File : RegistryHelper.cs
License : MIT License
Project Creator : builtbybel

public static bool IntEquals(string keyName, string valueName, int expectedValue)
        {
            try
            {
                var value = Registry.GetValue(keyName, valueName, null);
                return (value != null && (int)value == expectedValue);
            }
            catch (Exception ex)

            {
                MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK);
                return false;
            }
        }

19 View Source File : RegistryHelper.cs
License : MIT License
Project Creator : builtbybel

public static bool StringEquals(string keyName, string valueName, string expectedValue)
        {
            try
            {
                var value = Registry.GetValue(keyName, valueName, null);
                return (value != null && (string)value == expectedValue);
            }
            catch (Exception ex)
            {
                MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK);
                return false;
            }
        }

See More Examples