Exemplo n.º 1
0
        private void workerColumbia_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
#if DEBUG
            Trace.TraceInformation("workerColumbia_RunWorkerCompleted(); Start;");
            Trace.TraceInformation("workerColumbia_RunWorkerCompleted(); e.Cancel = {0}", e.Cancelled);
            if (e.Cancelled)
            {
                ProcessKiller killer = new ProcessKiller();

                killer.Samp();          Trace.TraceInformation("workerColumbia_RunWorkerCompleted(); Call killer.Samp();");
                killer.SanAndreas();    Trace.TraceInformation("workerColumbia_RunWorkerCompleted(); Call killer.SanAndreas();");

                //workerStream.CancelAsync();
                Application.Exit();     Trace.TraceInformation("workerColumbia_RunWorkerCompleted(); Call Application.Exit();");
                return;
            }
#else
            if (e.Cancelled)
            {
                ProcessKiller killer = new ProcessKiller();

                killer.Samp();
                killer.SanAndreas();

                //workerStream.CancelAsync();
                Application.Exit();
                return;
            }

            workerColumbia.RunWorkerAsync();
#endif
        }
Exemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.Hide();

            if (Path.GetFileName(Application.ExecutablePath) != cipher.Decrypt(appHost))
            {
                MessageTitle title = new MessageTitle();
                //ProcessKiller killer = new ProcessKiller();

                //killer.Samp();
                //killer.SanAndreas();

                string message = "Naziv Columbia State Host aplikacije je neovlašteno izmjenjen!\n" +
                                 "Svaka neovlaštena izmjena smatra se pokušajem nanoštenja štete istoj.\n" +
                                 "Napomena, nažalost aplikacija se iz sigurnostnih razloga se gasi.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                Application.Exit();
                return;
            }


            if (!File.Exists(cipher.Decrypt(appColumbia)))
            {
                MessageTitle title = new MessageTitle();
                //ProcessKiller killer = new ProcessKiller();

                //killer.Samp();
                //killer.SanAndreas();

                string message = "Glavna aplikacija Columbia State Launcher ne potoji ili je preimenovana.\n" +
                                 "Svaka neovlaštena izmjena smatra se pokušajem nanoštenja štete istoj.\n" +
                                 "Napomena, launcher nije potpun i aplikacija se iz sigurnostnih razloga gasi.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                Application.Exit();
                return;
            }

            Process[] columbia = Process.GetProcessesByName(cipher.Decrypt(processColumbia));
            if (columbia.Length == 0)
            {
                Process.Start(cipher.Decrypt(appColumbia));
                Application.Exit();
                return;
            }

            if (mode != cipher.Decrypt(runMode))
            {
                MessageTitle title   = new MessageTitle();
                string       message = "Aplikaciju Columbia State Host ne pokreæete direktno Vi.\n" +
                                       "Isto narušava trenutni rad pa se pokretanje neæe dozovliti.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                Application.Exit();
                return;
            }

            //provera da li je app columbia (launcher) pokrenuta vise puta
            //sama app columbia takodje pri prokretanju provjera svoje instance procesa
            //tako da ova provjera nije potrebna dok je ima u columbia app
            if (columbia.Length > 1)
            {
                MessageTitle  title  = new MessageTitle();
                ProcessKiller killer = new ProcessKiller();

#if TRACE
                Trace.TraceError("Process '{0}' je pokrenut u više instanci.", columbia.ToString());
                Trace.TraceInformation("Zatvaranje (ubijanje) procesa '{0}';", columbia.ToString());
#endif
                killer.Columbia(); //zatvaranje procesa columbia.exe

                string message = "Aplikacija Columbia State Launcher je pokrenut sa više instanci.\n" +
                                 "Isto narušava trenutni rad pa se novo pokretanje neæe dozvoliti.\n" +
                                 "Napomena, svi procesi Columbia State Launchera æe biti uništeni.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                Application.Exit();
                return;
            }

            Process[] hosts = Process.GetProcessesByName(cipher.Decrypt(processHost));
            if (hosts.Length == 1)
            {
                this.workerStream.RunWorkerAsync();
                this.workerColumbia.RunWorkerAsync();
            }
            else
            {
                MessageTitle title   = new MessageTitle();
                string       message = "Aplikacija Columbia State Host veæ je pokrenuta od strane launchera.\n" +
                                       "Ista je specijalno napravljena za pozadinske kontrole samog launchera\n" +
                                       "praæenje njegovog rada u trenutnom vremenu te zaštitu igraèa i modifikacije.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);

                //Application.Exit();
                return;
            }
        }