System.Windows.Forms.Application.Exit()

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

627 Examples 7

19 View Source File : Dashboard.cs
License : GNU General Public License v3.0
Project Creator : AHosseinRnj

private void Connection_Authentication()
        {
            while (!Status.IsConnected())
            {
                DialogResult dResult = MessageBox.Show("You are not Connected to the internet", "No Connection",
                                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                if (dResult == DialogResult.Cancel)
                {
                    break;
                }
            }

            if (!Status.IsConnected())
            {
                Application.Exit();
            }
        }

19 View Source File : mainForm.cs
License : MIT License
Project Creator : ajohns6

private void selectedModsButton_Click(object sender, EventArgs e)
        {
            foreach(DataGridViewRow row in onlineGrid.Rows)
            {
                Boolean enable = Convert.ToBoolean(row.Cells[0].Value);

                PAK pak = new PAK();
                pak.modName = row.Cells[1].Value.ToString();
                pak.modCreator = row.Cells[2].Value.ToString();
                pak.modType = row.Cells[3].Value.ToString();
                pak.modDesc = row.Cells[4].Value.ToString();
                pak.modDir = row.Cells[5].Value.ToString();
                pak.modURL = row.Cells[6].Value.ToString();
                pak.modFile = row.Cells[7].Value.ToString();
                pak.modHash = row.Cells[8].Value.ToString();

                if (enable)
                {
                    enablePAK(pak);
                }
                else
                {
                    disablePAK(pak);
                }
            }

            foreach (DataGridViewRow row in localGrid.Rows)
            {
                Boolean enable = Convert.ToBoolean(row.Cells[0].Value);

                PAK pak = new PAK();
                pak.modName = row.Cells[1].Value.ToString();
                pak.modCreator = row.Cells[2].Value.ToString();
                pak.modType = row.Cells[3].Value.ToString();
                pak.modDesc = row.Cells[4].Value.ToString();
                pak.modDir = row.Cells[5].Value.ToString();
                pak.modURL = row.Cells[6].Value.ToString();
                pak.modFile = row.Cells[7].Value.ToString();
                pak.modHash = row.Cells[8].Value.ToString();

                if (enable)
                {
                    enablePAK(pak);
                }
                else
                {
                    disablePAK(pak);
                }
            }

            if (launch())
            {
                saveSettings();
                if (!this.closeCheck.Checked) Application.Exit();
            }
        }

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

private void SetFoV(float val)
        {
            bool reset = val < 0 ? true : false;

            if (!reset)
            {
                if (val < c_FoV_lowerLimit) fFoV = c_FoV_lowerLimit;
                else if (val > c_FoV_upperLimit) fFoV = c_FoV_upperLimit;
                else fFoV = val;
            }

            try
            {
                if (mem != null && isRunning(false) && writeAllowed)
                    mem.WriteFloat(pFoV, reset ? c_FoV : fFoV);
            }
            catch (Exception err)
            {
                ErrMessage(err);
                Application.Exit();
            }

            if (!reset) numFoV.Value = (decimal)fFoV;
            SaveData();
        }

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

private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                ShowThreadExceptionDialog("Windows Forms Error", (Exception)e.ExceptionObject);
            }
            catch (Exception exc)
            {
                try
                {
                    MessageBox.Show("Fatal Non-UI Error",
                        "Fatal Non-UI Error. Could not write the error to the event log. Reason: "
                        + exc.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }
        }

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

bool isRunning(bool init)
        {
            Process[] spProcs = Process.GetProcessesByName(Singleplayer.c_exe);
            Process[] mpProcs = Process.GetProcessesByName(Multiplayer.c_exe);

            Process[] procs = new Process[mpProcs.Length + spProcs.Length];

            try
            {
                spProcs.CopyTo(procs, 0);
                mpProcs.CopyTo(procs, spProcs.Length);
            }
            catch { }

            if (procs.Length > 0)
            {

                if (proc == null && init)
                {
                    proc = procs[0];

                    if (proc.ProcessName == Singleplayer.c_exe && !rbSingleplayer.Checked)
                        rbSingleplayer.Checked = true;
                    else if (proc.ProcessName == Multiplayer.c_exe && !rbMultiplayer.Checked)
                        rbMultiplayer.Checked = true;

                    try
                    {
                        mem = new Memory((string)gameMode.GetValue("c_cVar"), proc.Id, (int)gameMode.GetValue("c_baseAddr"), (byte)gameMode.GetValue("c_checkRange"), c_pOffset);
                    }
                    catch (Exception ex)
                    {
                        ErrMessage(ex);
                        Application.Exit();
                    }

                    TimerVerif.Start();
                }
                return true;
            }
            else
            {
                if (proc != null && init)
                {
                    TimerVerif.Stop();
                    mem = null;
                    progStop();
                }
                return false;
            }
        }

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

bool isRunning(bool init)
        {
            Process[] spProcs = Process.GetProcessesByName(Singleplayer.c_exe);
            Process[] mpProcs = Process.GetProcessesByName(Multiplayer.c_exe);

            Process[] procs = new Process[mpProcs.Length + spProcs.Length];

            try
            {
                spProcs.CopyTo(procs, 0);
                mpProcs.CopyTo(procs, spProcs.Length);
            }
            catch { }

            if (procs.Length > 0)
            {
                if (proc == null && init)
                {
                    proc = procs[0];

                    if (proc.ProcessName == Singleplayer.c_exe && !rbSingleplayer.Checked)
                        rbSingleplayer.Checked = true;
                    else if (proc.ProcessName == Multiplayer.c_exe && !rbMultiplayer.Checked)
                        rbMultiplayer.Checked = true;

                    try
                    {
                        mem = new Memory((string)gameMode.GetValue("c_cVar"), proc.Id, (dword_ptr)gameMode.GetValue("c_baseAddr"), (byte)gameMode.GetValue("c_checkRange"), c_pOffset);
                    }
                    catch (Exception ex)
                    {
                        ErrMessage(ex);
                        Application.Exit();
                    }

                    TimerVerif.Start();
                }

                /*if (proc != null)
                {
                    proc.Refresh();
                    return !proc.HasExited;
                }*/
                
                return true;
            }
            else
            {
                if (proc != null && init)
                {
                    TimerVerif.Stop();
                    mem = null;
                    progStop();
                }
                return false;
            }
        }

19 View Source File : RawInputApp.cs
License : GNU General Public License v3.0
Project Creator : aiportal

private RawInputWnd CreateRawInputWnd()
		{
			// if create RawInputWnd fail, exit process to try again.
			try
			{
				RawInputWnd form = null;
				form = new RawInputWnd();
				form.RawInputMouseEvent += (e, x, y) =>
				{
					TraceLogger.Instance.WriteLineVerbos("RawInputMouseEvent: " + e);
					var evt = new RawInputEvent(e, (short)x, (short)y, DateTime.Now);
					if (_policy.FireEvent(evt))
					{
						TraceLogger.Instance.WriteLineVerbos("Push event: " + evt.Evt);
						_events.Enqueue(evt);
					}
				};
				form.RawInputKeyboardEvent += (e, key) =>
				{
					TraceLogger.Instance.WriteLineVerbos("RawInputKeyboardEvent: " + e);
					var evt = new RawInputEvent(e, key, DateTime.Now);
					if (_policy.FireEvent(evt))
					{
						TraceLogger.Instance.WriteLineVerbos("Push event: " + evt.Evt);
						_events.Enqueue(evt);
					}
					///? GetKeyState to get state of shift, ctrl and alt, mask it in key value by Keys.Shift/Control/Alt.
				};
				return form;
			}
			catch (Exception ex)
			{
				TraceLogger.Instance.WriteException(ex);
				Application.Exit();
				return null;
			}
		}

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

private void label1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

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

public static void Exit() {
            DoDebug("Exiting");
            sysIcon.HideIcon();
            Application.Exit();
            //Application.Exit doesn't close the application on update...?
            Environment.Exit(1);
        }

19 View Source File : Player.cs
License : MIT License
Project Creator : adrianeyre

public void LoseLife()
        {
            // Lose a life
            Lives--;
            if (Lives > 0)
            {
                Form1.pacman.Set_Pacman();
                Form1.ghost.ResetGhosts();
                SetLives();
            }
            else
            {
                Application.Exit();
            }
        }

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

private void UpdateResponse(IAsyncResult result)
        {
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
                Stream resStream = response.GetResponseStream();

                string tempString;
                int count;

                StringBuilder sb = new StringBuilder();
                byte[] buf = new byte[0x2000];

                do
                {
                    count = resStream.Read(buf, 0, buf.Length);
                    if (count != 0)
                    {
                        tempString = Encoding.ASCII.GetString(buf, 0, count);
                        sb.Append(tempString);
                    }
                }
                while (count > 0);

                string dataVer = Regex.Match(sb.ToString(), @"FoVChangerVer\[([0-9\.]*?)\]").Groups[1].Value;
                string dataSafe = Regex.Match(sb.ToString(), @"SafeToUse\[([A-Za-z]*?)\]").Groups[1].Value;
                string dataInfo = Regex.Unescape(HttpUtility.HtmlDecode(Regex.Match(sb.ToString(), @"UpdateInfo\[(.*?)\]").Groups[1].Value));

                //MessageBox.Show(dataVer);
                if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected")
                {
                    this.Invoke(new Action(() =>
                    {
                        DialogResult vacResult = MessageBox.Show(this, "It has been reported that this FoV Changer may cause Valve Anti-Cheat to trigger a ban. " +
                                                                       "For any information, please check MapModNews.com.\n\n" +
                                                                       "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.",
                                                                       "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

                        if (vacResult == DialogResult.OK)
                            Application.Exit();
                    }));
                }

                //MessageBox.Show(dataVer);
                if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer))
                {
                    this.Invoke(new Action(() => 
                    {
                        if (updateChk)
                            MessageBox.Show(this, "Update v" + dataVer + " for the FoV Changer is available at MapModNews.com, or can be downloaded directly \nby clicking the \"Help\" button below." + (!String.IsNullOrEmpty(dataInfo) ? "\n\nAdditional infos:\n" + dataInfo : ""),
                                                  "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                                  MessageBoxDefaultButton.Button1, 0, "http://mw3fov.ftp.sh/");

                        lblUpdateAvail.Text = " - Update v" + dataVer + " available";
                        lblUpdateAvail.Enabled = true;
                        lblUpdateAvail.Visible = true;

                        TimerBlink.Start();
                    }));
                }
            }
            catch {}

            requestSent = false;
        }

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

bool isRunning(bool init)
        {
            Process[] procs = Process.GetProcessesByName(c_exe);

            if (procs.Length > 0)
            {
                if (proc == null && init)
                {
                    proc = procs[0];

                    try
                    {
                        mem = new Memory(c_cVar, proc.Id, c_baseAddr, c_checkRange);
                    }
                    catch (Exception err)
                    {
                        ErrMessage(err);
                        Application.Exit();
                    }

                    TimerVerif.Start();
                }
                return true;
            }
            else
            {
                if (proc != null && init)
                {
                    TimerVerif.Stop();
                    mem = null;
                    progStop();
                }
                return false;
            }
        }

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

private void TimerVerif_Tick(object sender, EventArgs e)
        {
            if (proc != null && mem != null && isRunning(false))
            {
                if (btnStartGame.Enabled) ToggleButton(false);
                proc.Refresh();

                try
                {
                    if (proc.PagedMemorySize64 > 0x2000000)
                    {
                        byte step = 0;

                        try
                        {
                            mem.FindFoVOffset(ref pFoV, ref step);

                            if (!isOffsetWrong(pFoV)) progStart();
                            else if (proc.PagedMemorySize64 > (dword_ptr)gameMode.GetValue("c_memSearchRange"))
                            {
                                TimerVerif.Stop();
                                TimerCheck.Stop();

                                //bool offsetFound = false;

                                //int ptrSize = IntPtr.Size * 4;
                                /*for (int i = -0x50000; i < 0x50000 && !offsetFound; i += 16)
                                {
                                    if (mem.ReadFloat(true, pFoV + i) == 65f && !isOffsetWrong(pFoV + i))
                                    {
                                        pFoV += i;
                                        offsetFound = true;
                                    }

                                    if (i % 50000 == 0)
                                    {
                                        label1.Text = i.ToString();
                                        Update();
                                    }
                                }*/

                                //Console.Beep(5000, 100);

                                //MessageBox.Show("find " + pFoV.ToString("X8"));
                                if (isRunning(false) && !mem.FindFoVOffset(ref pFoV, ref step))
                                {
                                    string memory = BitConverter.ToString(BitConverter.GetBytes(mem.ReadFloat(pFoV)));

                                    MessageBox.Show(this, "The memory research pattern wasn't able to find the FoV offset in your " + gameMode.GetValue("c_supportMessage") + ".\n" +
                                                          "Please look for an updated version of this FoV Changer tool.\n\n" +
                                                          "If you believe this might be a bug, please send me an email at [email protected], and include a screenshot of this:\n" +
                                                          "\n" + c_toolVer +
                                                          "\nWorking Set: 0x" + proc.WorkingSet64.ToString("X8") +
                                                          "\nPaged Memory: 0x" + proc.PagedMemorySize64.ToString("X8") +
                                                          "\nVirtual Memory: 0x" + proc.VirtualMemorySize64.ToString("X8") +
                                                          "\nStep: " + step.ToString() +
                                                          "\nFoV pointer: 0x" + (pFoV - c_pOffset).ToString("X8") + " = " + memory,
                                                          "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                                    pFoV = (dword_ptr)gameMode.GetValue("c_pFoV");
                                    Application.Exit();
                                }
                                else
                                {
                                    //Console.Beep(5000, 100);
                                    SaveSettings();
                                    proc = null;
                                    TimerCheck.Start();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrMessage(ex);
                            Application.Exit();
                        }
                    }
                }
                catch (InvalidOperationException) { }
            }
        }

19 View Source File : Updater.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public static void CheckForUpdate()
        {
            string version = GetWebString(VersionUrl);

            if ( string.IsNullOrEmpty(version))
            {
                DialogResult result =
                    MessageBox.Show(
                        "An error has occurred. Please manually check the Github releases page for updates.",
                        "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                if (result == DialogResult.Yes)
                {
                    Process.Start(DownloadListUrl);
                }
            }
            else
            {
                var versionSplit = version.Split(new[] {'.'}, 3);
                int versionCode = 0;
                foreach (var s in versionSplit)
                {
                    versionCode *= 0x100;
                    versionCode += int.Parse(s);
                }

                Version vrs = replacedembly.GetExecutingreplacedembly().GetName().Version;
                int replacedemblyVersionCode = (vrs.Major * 0x100 + vrs.Minor) * 0x100 + vrs.Build;
                
                if (versionCode > replacedemblyVersionCode)
                {
                    string message =
                        "There is a new version of SparkIV available! Would you like to download the newest version?" +
                        "\n" + "\n" + "This version is:  " + vrs.Major + "." + vrs.Minor + "." + vrs.Build + "\n"
                        + "New Version is: " + version;

                    DialogResult result = MessageBox.Show(message, "New Update!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        var url = GetWebString(UpdateUrl);

                        if ( string.IsNullOrEmpty(url) )
                        {
                            result =
                                MessageBox.Show(
                                    "An error has occurred. Please manually check the Github releases page for updates?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                            if (result == DialogResult.Yes)
                            {
                                Process.Start(DownloadListUrl);
                            }
                        }
                        else
                        {
                            Process.Start( url );
                            Application.Exit();                            
                        }
                    }
                }
                else
                {
                    MessageBox.Show(String.Format("There is no update available at this time."),
                                    "No update available", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
        }

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

private void BtnContinue_Click(object sender, EventArgs e)
        {
            if (rbWait.Checked)
            {
                this.Close();
            }
            else // Download Update
            {
                System.Diagnostics.Process.Start(info.Download_url);
                Application.Exit();
            }
        }

19 View Source File : Application.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Exit()
        {
            System.Windows.Forms.Application.Exit();
            Application.m_IsRunning = false;
        }

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

private void TimerUpdate_Tick(object sender, EventArgs e)
        {
            try
            {
                if (mem != null && isRunning(false))
                {
                    float readValue = mem.ReadFloat(pFoV);

                    if (readValue != fFoV && readValue >= c_FoV_lowerLimit)
                    {
                        mem.WriteFloat(pFoV, fFoV);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrMessage(ex);
                Application.Exit();
            }
        }

19 View Source File : RawInputWnd.cs
License : GNU General Public License v3.0
Project Creator : aiportal

private void RegisterRawInput(IntPtr hWnd)
		{
			// if create RegisterRawInput fail, exit process to try again.
			try
			{
				RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[]
				{
					new RAWINPUTDEVICE(){
						usUsagePage = util.HID_USAGEPAGE_GENERIC,
						usUsage = util.HID_USAGE_KEYBOARD,
						dwFlags = (int)RawInputDeviceFlags.InputSink,
						hwndTarget = hWnd
					},
#if !DEBUG
					new RAWINPUTDEVICE(){
					    usUsagePage = util.HID_USAGEPAGE_GENERIC,
					    usUsage = util.HID_USAGE_MOUSE,				    
					    dwFlags = (int)RawInputDeviceFlags.InputSink,
					    hwndTarget = hWnd
					},
#endif
				};
				bool succeed = user32.RegisterRawInputDevices(rid, rid.Length, Marshal.SizeOf(rid[0]));
				TraceLogger.Instance.WriteLineInfo("RegisterRawInputDevices : " + succeed);
				if (!succeed)
					throw new Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error());
			}
			catch (Exception ex)
			{
				TraceLogger.Instance.WriteException(ex);
				Application.Exit();
			}
		}

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

private void closeForm1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

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

private static void FileDownloadedCallback(object sender, AsyncCompletedEventArgs e) {
            if (MainProgram.updateProgressWindow != null) {
                MainProgram.updateProgressWindow.Close();
                MainProgram.updateProgressWindow = null;
            }

            MainProgram.DoDebug("Finished downloading");

            if (!e.Cancelled) {
                //Download success
                try {
                    if (File.Exists(targetLocation)) {
                        Process.Start(targetLocation);
                        MainProgram.DoDebug("New installer successfully downloaded and opened.");
                        Application.Exit();
                    } else {
                        MainProgram.DoDebug("Downloaded file doesn't exist (new version)");
                        MessageBox.Show("Failed to download new version of ACC. File doesn't exist", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
                    }
                } catch (Exception ee) {
                    MainProgram.DoDebug("Error occurred on open of new version; " + ee.Message);
                    MessageBox.Show("Failed to open new version! Error is logged, please contact the developer on Discord!", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
                }
            } else {
                MainProgram.DoDebug("Failed to download new version of ACC. Error; " + e.Error);
                MessageBox.Show("Failed to download new version. Try again later!", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
            }

            Thread.Sleep(500);
            Thread.CurrentThread.Abort();
        }

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

private void TimerVerif_Tick(object sender, EventArgs e)
        {
            if (proc != null && mem != null && isRunning(false))
            {
                if (btnStartGame.Enabled) ToggleButton(false);
                proc.Refresh();

                if (proc.PagedMemorySize64 > 0x2000000)
                {
                    byte step = 0;

                    try
                    {
                        mem.FindFoVOffset(ref pFoV, ref step);

                        if (!isOffsetWrong(pFoV)) progStart();
                        else if (proc.PagedMemorySize64 > memSearchRange)
                        {
                            TimerVerif.Stop();
                            TimerCheck.Stop();

                            //bool offsetFound = false;

                            //int ptrSize = IntPtr.Size * 4;
                            /*for (int i = -0x50000; i < 0x50000 && !offsetFound; i += 16)
                            {
                                if (mem.ReadFloat(true, pFoV + i) == 65f && !isOffsetWrong(pFoV + i))
                                {
                                    pFoV += i;
                                    offsetFound = true;
                                }

                                if (i % 50000 == 0)
                                {
                                    label1.Text = i.ToString();
                                    Update();
                                }
                            }*/

                            //Console.Beep(5000, 100);

                            //MessageBox.Show("find " + pFoV.ToString("X8"));
                            if (isRunning(false) && !mem.FindFoVOffset(ref pFoV, ref step))
                            {
                                string memory = BitConverter.ToString(BitConverter.GetBytes(mem.ReadFloat(pFoV)));

                                MessageBox.Show("The memory research pattern wasn't able to find the FoV offset in your " + c_supportMessage + ".\n" +
                                                "Please look for an updated version of this FoV Changer tool.\n\n" +
                                                "If you believe this might be a bug, please send me an email at [email protected], and include a screenshot of this:\n\n" + c_toolVer +
                                                "\n0x" + Convert.ToInt32(proc.WorkingSet64).ToString("X8") +
                                                "\n0x" + Convert.ToInt32(proc.PagedMemorySize64).ToString("X8") +
                                                "\n0x" + Convert.ToInt32(proc.VirtualMemorySize64).ToString("X8") +
                                                "\nStep = " + step.ToString() +
                                                "\n0x" + (pFoV - 0xC).ToString("X8") + " = " + memory,
                                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                                pFoV = c_pFoV;
                                Application.Exit();
                            }
                            else
                            {
                                //Console.Beep(5000, 100);
                                SaveData();
                                proc = null;
                                TimerCheck.Start();
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        ErrMessage(err);
                        Application.Exit();
                    }
                }
            }
        }

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

private void UpdateResponse(IAsyncResult result)
        {
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
                Stream resStream = response.GetResponseStream();

                string tempString;
                int count;

                StringBuilder sb = new StringBuilder();
                byte[] buf = new byte[0x1000];

                do
                {
                    count = resStream.Read(buf, 0, buf.Length);
                    if (count != 0)
                    {
                        tempString = Encoding.ASCII.GetString(buf, 0, count);
                        sb.Append(tempString);
                    }
                }
                while (count > 0);

                string dataVer = Regex.Match(sb.ToString(), @"FoVChangerVer\[([0-9\.]+)\]").Groups[1].Value;
                string dataSafe = Regex.Match(sb.ToString(), @"SafeToUse\[([A-Za-z]+)\]").Groups[1].Value;


                //MessageBox.Show(dataVer);
                if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected")
                {
                    DialogResult vacResult = MessageBox.Show("It has been reported that this FoV Changer may cause Valve Anti-Cheat to trigger a ban. " +
                                                             "For any information, please check MapModNews.com.\n\n" +
                                                             "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.",
                                                             "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

                    if (vacResult == DialogResult.OK) Application.Exit();
                }

                //MessageBox.Show(dataVer);
                if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer))
                {
                    lblUpdateAvail.Text = "└ Update v" + dataVer + " available";
                    lblUpdateAvail.Enabled = true;
                    lblUpdateAvail.Visible = true;

                    if (updateChk) MessageBox.Show("Update v" + dataVer + " for the FoV Changer is available at MapModNews.com",
                                                   "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    TimerBlink.Start();
                }
            }
            catch { }

            requestSent = false;
        }

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 : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev

bool isOffsetWrong(int ptr)
        {
            for (int i = 0x20; i < (byte)gameMode.GetValue("c_checkRange"); i += 0x10)
            {
                //MessageBox.Show(ReadFloat(Increment(ptr, i)).ToString());
                try
                {
                    if (mem.ReadFloat(ptr + i) != c_FoV)
                        return true;
                }
                catch (Exception ex)
                {
                    ErrMessage(ex);
                    Application.Exit();
                }
            }

            return false;
        }

19 View Source File : Player.cs
License : MIT License
Project Creator : adrianeyre

public void LevelComplete()
        {
            Application.Exit();
        }

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

private void TimerVerif_Tick(object sender, EventArgs e)
        {
            if (proc != null && mem != null && isRunning(false))
            {
                if (btnStartGame.Enabled) ToggleButton(false);
                proc.Refresh();

                if (proc.PagedMemorySize64 > 0x2000000)
                {
                    byte step = 0;

                    try
                    {
                        mem.FindFoVOffset(ref pFoV, ref step);

                        if (!isOffsetWrong(pFoV)) progStart();
                        else if (proc.PagedMemorySize64 > (long)gameMode.GetValue("c_memSearchRange"))
                        {
                            TimerVerif.Stop();
                            TimerCheck.Stop();

                            //bool offsetFound = false;

                            //int ptrSize = IntPtr.Size * 4;
                            /*for (int i = -0x50000; i < 0x50000 && !offsetFound; i += 16)
                            {
                                if (mem.ReadFloat(true, pFoV + i) == 65f && !isOffsetWrong(pFoV + i))
                                {
                                    pFoV += i;
                                    offsetFound = true;
                                }

                                if (i % 50000 == 0)
                                {
                                    label1.Text = i.ToString();
                                    Update();
                                }
                            }*/

                            //Console.Beep(5000, 100);

                            //MessageBox.Show("find " + pFoV.ToString("X8"));
                            if (isRunning(false) && !mem.FindFoVOffset(ref pFoV, ref step))
                            {
                                string memory = BitConverter.ToString(BitConverter.GetBytes(mem.ReadFloat(pFoV)));

                                MessageBox.Show(this, "The memory research pattern wasn't able to find the FoV offset in your " + gameMode.GetValue("c_supportMessage") + ".\n" +
                                                      "Please look for an updated version of this FoV Changer tool.\n\n" +
                                                      "If you believe this might be a bug, please send me an email at [email protected], and include a screenshot of this:\n\n" + c_toolVer +
                                                      "\n0x" + Convert.ToInt32(proc.WorkingSet64).ToString("X8") +
                                                      "\n0x" + Convert.ToInt32(proc.PagedMemorySize64).ToString("X8") +
                                                      "\n0x" + Convert.ToInt32(proc.VirtualMemorySize64).ToString("X8") +
                                                      "\nStep = " + step.ToString() +
                                                      "\n0x" + (pFoV - 0xC).ToString("X8") + " = " + memory,
                                                      "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                                pFoV = (int)gameMode.GetValue("c_pFoV");
                                Application.Exit();
                            }
                            else
                            {
                                //Console.Beep(5000, 100);
                                SaveSettings();
                                proc = null;
                                TimerCheck.Start();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrMessage(ex);
                        Application.Exit();
                    }
                }
            }
        }

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

bool isOffsetWrong(uint ptr)
        {
            for (uint i = 0x20; i < c_checkRange; i += 0x10)
            {
                //MessageBox.Show(ReadFloat(Increment(ptr, i)).ToString());
                try
                {
                    if (mem.ReadFloat(ptr + i) != c_FoV)
                        return true;
                }
                catch (Exception err)
                {
                    ErrMessage(err);
                    Application.Exit();
                }
            }

            return false;
        }

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

bool isOffsetWrong(dword_ptr ptr)
        {
            for (int i = 0x20; i < 0x30 /*(byte)gameMode.GetValue("c_checkRange")*/; i += 0x10)
            {
                //MessageBox.Show(ReadFloat(Increment(ptr, i)).ToString());
                try
                {
                    if (mem.ReadFloat(ptr + i) != c_FoV)
                        return true;
                }
                catch (Exception ex)
                {
                    ErrMessage(ex);
                    Application.Exit();
                }
            }

            return false;
        }

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

private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            try
            {
                ShowThreadExceptionDialog("Windows Forms Error", t.Exception);
            }
            catch
            {
                try
                {
                    MessageBox.Show("Fatal Windows Forms Error",
                        "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }
            Application.Exit();
        }

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

private void menuExit_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            this.Close();

            Application.Exit();
        }

19 View Source File : KeyUtil.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public string FindGameDirectory()
        {

            if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), ExecutableName)))
            {
                dir = Directory.GetCurrentDirectory();
            }
            else
            {
                if (ExecutableName == "GTAIV.exe" && File.Exists(@"path.iv") && !StringExtensions.IsNullOrWhiteSpace(File.ReadAllText(@"path.iv")) && File.Exists(Path.Combine(File.ReadAllText(@"path.iv"), ExecutableName)))
                {
                    dir = File.ReadAllText(@"path.iv");
                }
                else
                {
                    if (ExecutableName == "EFLC.exe" && File.Exists(@"path.eflc") && !StringExtensions.IsNullOrWhiteSpace(File.ReadAllText(@"path.eflc")) && File.Exists(Path.Combine(File.ReadAllText(@"path.eflc"), ExecutableName)))
                    {
                        dir = File.ReadAllText(@"path.eflc");
                    }
                    else
                    {
                        var keys = PathRegistryKeys;
                        foreach (var s in keys)
                        {
                            RegistryKey key;
                            if ((key = Registry.LocalMachine.OpenSubKey(s)) != null)
                            {
                                if (key.GetValue("InstallFolder") != null && File.Exists(Path.Combine(key.GetValue("InstallFolder").ToString(), ExecutableName)))
                                {
                                    dir = key.GetValue("InstallFolder").ToString();
                                    key.Close();
                                    break;
                                }
                                else
                                {
                                    var fbd = new VistaFolderBrowserDialog();
                                    fbd.Description = "Select game folder";
                                    //DialogResult result = fbd.ShowDialog();
                                    if (fbd.ShowDialog() == DialogResult.OK && !StringExtensions.IsNullOrWhiteSpace(fbd.SelectedPath))
                                    {
                                        dir = fbd.SelectedPath;
                                        break;
                                    }
                                    else
                                    {
                                        MessageBox.Show("Please select game folder.");
                                        Application.Exit();
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return dir;
        }

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

private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

19 View Source File : Dashboard.cs
License : GNU General Public License v3.0
Project Creator : AHosseinRnj

public void ExitMethod()
        {
            if (!ConnectBtn.Enabled)
            {
                MessageBox.Show("Please Disconnect First", "Error at 0x150", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                VPN.Dispose();
                VPN = null;
                GC.Collect();
                Application.Exit();
            }
        }

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 : Dashboard.cs
License : GNU General Public License v3.0
Project Creator : AHosseinRnj

private void Administrator_Authentication()
        {
            if (!Status.IsAdministrator())
            {
                DialogResult dResult = MessageBox.Show("Please Re-start as an Administrator", "Permission Denied",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (dResult == DialogResult.OK)
                {
                    Application.Exit();
                }
            }
        }

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

private void SetFoV(float val)
        {
            bool reset = val < 0 ? true : false;

            if (!reset)
            {
                if (val < c_FoV_lowerLimit)
                    fFoV = c_FoV_lowerLimit;
                else if (val > c_FoV_upperLimit)
                    fFoV = c_FoV_upperLimit;
                else
                    fFoV = val;
            }
            else
                SaveSettings();

            try
            {
                if (mem != null && isRunning(false) && writeAllowed)
                    mem.WriteFloat(pFoV, reset ? c_FoV : fFoV);
            }
            catch (Exception ex)
            {
                ErrMessage(ex);
                Application.Exit();
            }

            if (!reset)
            {
                numFoV.Value = Convert.ToDecimal(fFoV);
                SaveSettings();
            }
        }

19 View Source File : RawInputApp.cs
License : GNU General Public License v3.0
Project Creator : aiportal

private void RecordWorker()
		{
			try
			{
				TraceLogger.Instance.WriteLineInfo("New session is creating...");
				this._session = this.CreateRecordSession(this.SessionId);
				this.SessionId = this._session.SessionId;
				TraceLogger.Instance.WriteLineInfo(string.Format("UserName={0}, SessionId={1}, CreateTime={2:o}", _session.UserName, _session.SessionId, _session.CreateTime));
			}
			catch (Exception ex)
			{
				TraceLogger.Instance.WriteException(ex);
				Application.Exit();
			}

			List<IRawEvent> evts = new List<IRawEvent>();
			while (true)
			{
				try
				{
					if (_events.Count > 0)
					{
						TraceLogger.Instance.WriteLineVerbos("Events data count: " + _events.Count);
						{
							object[] tempEvts = null;
							//lock (_eventsRoot)
							{
								tempEvts = _events.ToArray();
								_events.Clear();
							}
							evts.AddRange(Array.ConvertAll(tempEvts, e => e as IRawEvent));
							Debug.replacedert(evts.Count > 0);
						}
						if (_policy.Snapshot(evts[evts.Count-1]))
						{
							ThreadPool.QueueUserWorkItem(this.SnapshotWorker, evts.ToArray());
							TraceLogger.Instance.WriteLineInfo("SnapshotWorker has queued at ticks: " + DateTime.Now.Ticks);
							evts.Clear();
						}
						_session.LastActiveTime = DateTime.Now;
					}
				}
				catch (Exception ex) { TraceLogger.Instance.WriteException(ex); }

				Thread.Sleep(10);
			}
		}

19 View Source File : UI.cs
License : MIT License
Project Creator : aaaddress1

private void refreshUi(object sender, EventArgs e)
        {
            /* i'm too lazy to make a editor for C/C++ :P,
             * and this editor is really useful!!
             * https://github.com/PavelTorgashov/FastColoredTextBox */
            fastColoredTextBox.Language = FastColoredTextBoxNS.Language.CSharp;

            if (srcPath == "")
                srcPath = Path.Combine(Application.StartupPath, "main.cpp");

            if (!File.Exists(srcPath))
                File.WriteAllText(srcPath, Properties.Resources.templateSrc);

            fastColoredTextBox.InsertText(File.ReadAllText(srcPath));

            asmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".s");
            obfAsmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + "_obf.s");
            exePath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".exe");
            this.Text = string.Format("puzzCode [{0}] by [email protected]", new FileInfo(srcPath).Name);

            logBox.Clear();
            logMsg(demostr, Color.Blue);

            compiler.logText = this.logBox;
            obfuscator.logText = this.logBox;

            this.splitContainer.Panel2Collapsed = true;

            if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
            {
                MessageBox.Show("please choose your MinGW path.");
                (new config()).ShowDialog();
                if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
                {
                    MessageBox.Show("sorry, MinGW not found :(");
                    Application.Exit();
                }
            }
        }

19 View Source File : RawInputApp_Tasks.cs
License : GNU General Public License v3.0
Project Creator : aiportal

private void MakeShortSession(object state)
		{
			if (_session != null)
			{
				if (DateTime.Now.Subtract(_session.LastActiveTime).TotalMinutes > 15)
				{
					TraceLogger.Instance.WriteLineInfo("Record appplication will exit on idle: " + DateTime.Now.ToShortTimeString());
					_cacheManager.WriteSessionEnd(_session.SessionId);
					_tasks.Stop();
					Application.Exit();
				}
			}
		}

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

private void UpdateResponse(IAsyncResult result)
        {
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
                Stream resStream = response.GetResponseStream();

                string tempString;
                int count;

                StringBuilder sb = new StringBuilder();
                byte[] buf = new byte[0x2000];

                do
                {
                    count = resStream.Read(buf, 0, buf.Length);
                    if (count != 0)
                    {
                        tempString = Encoding.ASCII.GetString(buf, 0, count);
                        sb.Append(tempString);
                    }
                }
                while (count > 0);

                string returnData = sb.ToString();

                string dataVer = Regex.Match(returnData, @"FoVChangerVer\[([0-9\.]*?)\]").Groups[1].Value;
                string dataSafe = Regex.Match(returnData, @"SafeToUse\[([A-Za-z]*?)\]").Groups[1].Value;
                string dataInfo = Regex.Unescape(HttpUtility.HtmlDecode(Regex.Match(returnData, @"UpdateInfo\[(.*?)\]").Groups[1].Value));
                string dataDownloadLink = Regex.Match(returnData, @"DownloadLink\[(.*?)\]").Groups[1].Value;
                string datareplacedytics = Regex.Match(returnData, @"Googlereplacedytics\[([A-Za-z\-0-9]*?)\]").Groups[1].Value;
                string dataIPService = Regex.Match(returnData, @"IPService\[(.*?)\]").Groups[1].Value;

                //MessageBox.Show(dataSafe);
                if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected")
                {
                    this.Invoke(new Action(() =>
                    {
                        DialogResult vacResult = MessageBox.Show(this, "It has been reported that this FoV Changer may cause anti-cheat software to trigger a ban. " +
                                                                       "For any information, please check github.com/AgentRev/CoD-FoV-Changers\n\n" +
                                                                       "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.",
                                                                       "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

                        if (vacResult == DialogResult.OK)
                            Application.Exit();
                    }));
                }

                //MessageBox.Show(dataVer);
                if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer))
                {
                    this.Invoke(new Action(() => 
                    {
                        updateAvailable = true;

                        if (chkUpdate.Checked && updateNotify)
                        {
                            MessageBox.Show(this, "Update v" + dataVer + " is available at MapModNews.com\nClicking the \"Help\" button below will take you to the download page." + (!String.IsNullOrEmpty(dataInfo) ? "\n\nInfos:\n" + dataInfo : ""),
                                                  "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                                  MessageBoxDefaultButton.Button1, 0, (!String.IsNullOrEmpty(dataDownloadLink) ? dataDownloadLink : "http://ghostsfov.ftp.sh/"));

                            lblUpdateAvail.Text = "Update v" + dataVer + " available";
                            lblUpdateAvail.Enabled = true;
                            lblUpdateAvail.Visible = true;

                            TimerBlink.Start();
                        }
                        else
                        {
                            requestSent = false;
                        }
                    }));
                }

                if (!String.IsNullOrEmpty(datareplacedytics))
                {
                    Greplacedytics.trackingID = datareplacedytics;
                }

                if (!String.IsNullOrEmpty(dataIPService))
                {
                    Greplacedytics.ipService = dataIPService;
                }
            }
            catch {}

            try
            {
                Greplacedytics.Triggerreplacedytics((string)gameMode.GetValue("c_settingsDirName") + " v" + c_toolVer, firstTime);
            }
            catch {}
        }

19 View Source File : updateForm.cs
License : MIT License
Project Creator : ajohns6

private void checkUpdate(object sender, EventArgs e)
        {
            if (!progressForm.IsConnectedToInternet())
            {
                this.Dispose();
                return;
            }

            string url = "https://api.github.com/repos/ajohns6/SM64-NX-Launcher/releases";
            string releaseString = "";

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Accept = "application/json";
            request.Method = "GET";
            request.UserAgent = "Foo";
            try
            {
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    releaseString = reader.ReadToEnd();
                }
            }
            catch
            {
                this.Dispose();
                return;
            }

            Application.DoEvents();

            var releaseList = JsonConvert.DeserializeObject<List<release>>(releaseString);

            if (releaseList[0].tag_name != ("v" + version))
            {
                this.statusLabel.Text = "Downloading " + releaseList[0].tag_name + "...";
                this.progBar.Visible = true;
                string tempPath = Path.Combine(Path.GetTempPath(),
                             "sm64nxlauncherinstaller",
                             version);
                string zipPath = Path.Combine(tempPath, "installer.zip");
                mainForm.DeleteDirectory(tempPath);

                Task.Run(() =>
                {
                    using (var client = new WebClient())
                    {
                        if (!Directory.Exists(tempPath))
                        {
                            Directory.CreateDirectory(tempPath);
                        }

                        client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(downloadProgress);
                        client.DownloadFileCompleted += new AsyncCompletedEventHandler(downloadComplete);
                        Uri installerLink = new Uri(releaseList[0].replacedets[0].browser_download_url);
                        client.DownloadFileAsync(installerLink, zipPath);
                    }
                });

                progBar.Maximum = 100;

                Application.DoEvents();

                do
                {
                    progBar.Value = progress;
                } while (progress < 100);

                do
                {
                    Application.DoEvents();
                } while (!complete);

                this.statusLabel.Text = "Extracting installer...";

                Task.Run(() =>
                {
                    bool unzipped = false;
                    do
                    {
                        try
                        {
                            ZipFile.ExtractToDirectory(zipPath, tempPath);
                            unzipped = true;
                        }
                        catch { }
                    } while (!unzipped);
                }).Wait();

                ProcessStartInfo installStart = new ProcessStartInfo();
                installStart.FileName = Path.Combine(tempPath, "setup.exe");

                Process installer = new Process();
                installer.StartInfo = installStart;

                installer.Start();

                Application.Exit();
            }

            this.Close();
        }

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 : mainForm.cs
License : MIT License
Project Creator : ajohns6

private void noModsButton_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in onlineGrid.Rows)
            {
                PAK pak = new PAK();
                pak.modName = row.Cells[1].Value.ToString();
                pak.modCreator = row.Cells[2].Value.ToString();
                pak.modType = row.Cells[3].Value.ToString();
                pak.modDesc = row.Cells[4].Value.ToString();
                pak.modDir = row.Cells[5].Value.ToString();
                pak.modURL = row.Cells[6].Value.ToString();
                pak.modFile = row.Cells[7].Value.ToString();
                pak.modHash = row.Cells[8].Value.ToString();

                disablePAK(pak);
            }

            foreach (DataGridViewRow row in onlineGrid.Rows)
            {
                PAK pak = new PAK();
                pak.modName = row.Cells[1].Value.ToString();
                pak.modCreator = row.Cells[2].Value.ToString();
                pak.modType = row.Cells[3].Value.ToString();
                pak.modDesc = row.Cells[4].Value.ToString();
                pak.modDir = row.Cells[5].Value.ToString();
                pak.modURL = row.Cells[6].Value.ToString();
                pak.modFile = row.Cells[7].Value.ToString();
                pak.modHash = row.Cells[8].Value.ToString();

                disablePAK(pak);
            }

            if (launch() && !this.closeCheck.Checked)
            {
                Application.Exit();
            }
        }

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

private void TimerUpdate_Tick(object sender, EventArgs e)
        {
            try
            {
                if (mem != null && isRunning(false)) mem.WriteFloat(pFoV, fFoV);
            }
            catch (Exception err)
            {
                ErrMessage(err);
                Application.Exit();
            }
        }

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

private void pictureBox1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

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

[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ApplicationExit += new EventHandler(OnApplicationExit);
            t.Start();
            using (NotifyIcon icon = new NotifyIcon())
            {
                icon.Icon = System.Drawing.Icon.ExtractreplacedociatedIcon(Application.ExecutablePath);
                icon.ContextMenu = new ContextMenu(new MenuItem[] {
                    new MenuItem("Options", (s, e) => {new Form1().Show();}),
                    new MenuItem("Exit", (s, e) => { Application.Exit(); }),
                });
                icon.Visible = true;

                Application.Run();
                icon.Visible = false;
            }
        }

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 : Apache License 2.0
Project Creator : 214175590

private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text = appName + " v" + appVersion;

                string str = YSTools.YSFile.readFileToString(MyDoreplacedents + "\\." + appName);
                if(!string.IsNullOrWhiteSpace(str)){
                    MessageBox.Show(str);
                    Application.Exit();
                }
            }
            catch { }

            tsp_font_fimily.SelectedIndex = 3;
            tsp_font_size.SelectedIndex = 0;

            init();
            ThreadPool.QueueUserWorkItem((a) => {
                if (AppConfig.Instance.MConfig.OnstartShowSessMgt)
                {
                    this.BeginInvoke((MethodInvoker)delegate()
                    {
                        SessionManageForm form = new SessionManageForm();
                        form.ShowDialog(this);

                        RenderSessionList();
                    });                    
                }
            });
        }

19 View Source File : EpubViewer.cs
License : MIT License
Project Creator : Aeroblast

public static void SendDataWhenLoad(Object sender, LoadingStateChangedEventArgs e)
        {
#if !DEBUG
            try
            {
#endif
            if (e.IsLoading == true) return;
            if (Program.epub.spine.pageProgressionDirection == "rtl")
            {
                chromium.ExecuteScriptAsync("direction = direction_rtl;");
            }
            string userDataCmd = string.Format("LoadUserSettings({0});", UserSettings.GetJson());
            string initCmd = "";
            string lengthDataCmd = "";
            foreach (Itemref i in Program.epub.spine)
            {
                if (!i.linear) continue;
                initCmd += string.Format(",'{0}'", "aeroepub://domain/book/" + i.ToString());
                int l;
                if (i.item.mediaType == "application/xhtml+xml")
                {
                    l = (i.item.GetFile() as TextEpubFileEntry).text.Length;
                }
                else if (i.item.mediaType.Contains("image")) { l = 10; }
                else
                {
                    throw new Exception("Cannot Handle type in spine:" + i.item.mediaType);
                }

                lengthDataCmd += "," + l;
            }
            if (lengthDataCmd.Length == 0) throw new Exception("Spine is empty.");
            lengthDataCmd = $"LoadScrollBar([{ lengthDataCmd.Substring(1)}],{new TocManager().GetPlainStructJSON()});";
            initCmd = string.Format("Init([{0}],{1},{2});", initCmd.Substring(1), ResizeManage.index, ResizeManage.percent);
            chromium.ExecuteScriptAsync(userDataCmd + lengthDataCmd + initCmd);

            if (Program.epub.toc != null)
            {
                switch (Program.epub.toc.mediaType)
                {
                    case "application/x-dtbncx+xml":
                        {
                            string toc = (Program.epub.toc.GetFile() as TextEpubFileEntry).text;
                            Match m = Regex.Match(toc, "<navMap>([\\s\\S]*?)</navMap>");
                            if (m.Success)
                            {
                                chromium.ExecuteScriptAsync("LoadTocNcx", m.Groups[1], Path.GetDirectoryName(Program.epub.toc.href));
                            }
                            else
                            {
                                Log.log("[Error]at TOC loading:" + Program.epub.toc);
                            }
                        }
                        break;
                    case "application/xhtml+xml":
                        {
                            string toc = (Program.epub.toc.GetFile() as TextEpubFileEntry).text;
                            toc = toc.Replace(" href=\"", " hraf=\"");
                            Match m = Regex.Match(toc, "<body[\\s\\S]*?>([\\s\\S]*?)</body>");
                            if (m.Success)
                            {
                                chromium.ExecuteScriptAsync("LoadTocNav", m.Groups[1], Path.GetDirectoryName(Program.epub.toc.href).Replace('\\', '/'));
                            }
                            else
                            {
                                Log.log("[Error]at TOC loading:" + Program.epub.toc);
                            }
                        }
                        break;

                }

            }
            chromium.LoadingStateChanged -= SendDataWhenLoad;
#if !DEBUG
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
                Application.Exit();
            }
#endif
        }

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

private void TimerUpdate_Tick(object sender, EventArgs e)
        {
            try
            {
                if (mem != null && isRunning(false)) mem.WriteFloat(pFoV, fFoV);
            }
            catch (Exception ex)
            {
                ErrMessage(ex);
                Application.Exit();
            }
        }

See More Examples