예제 #1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            this.buttonStart.Enabled = false;
            this.buttonClose.Enabled = false;

            if (workerFile.IsBusy)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Da li ste sigurni da želite prekinuti provjeru vaši datoteka?";
                if (MessageBoxAdv.Show(text, title.WarningMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    //buttonStart.Text = "Poèni";
                    workerFile.CancelAsync();
                }
                else
                {
                    this.buttonStart.Enabled = true;
                    //this.buttonClose.Enabled = false;
                }
            }
            else
            {
                workerFile.RunWorkerAsync();
                this.buttonStart.Text    = "Prekini";
                this.buttonStart.Enabled = true;
                //this.buttonClose.Enabled = false;
                this.labelName.Text = "Priprema za provjeru vaši datoteka...";
            }
        }
예제 #2
0
        private DialogResult MessageErrorLog()
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Prilikom skidanja datoteka sa servisa došlo je do pogreške na nekima.\n" +
                                 "Da li želite pogledati detaljan izvještaj datoteka koje se nisu ažurirale?";

            return(MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error));
        }
예제 #3
0
        private DialogResult MessageInfoDownload()
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Skidanje i ažuriranje datoteka sa download servisa je uspješno izvršeno\n" +
                                 "i sada imate potpunu modifikaciju za pristup našem serveru, prijavite se.\n" +
                                 String.Format("Ukupno je skinuto {0} datoteka èija je ukupna velièina {1:0.00} MB.", downloadNumber, downloadSize / 1048576.0);

            return(MessageBoxAdv.Show(text, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information));
        }
예제 #4
0
        private DialogResult MessageErrorDownload(string file)
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Skidanje i ažuriranje navedene datoteke nije upotpunosti uspješno izvršeno.\n" +
                                 String.Format("Naziv datoteke: {0}\n", file) +
                                 "Da li želite ponovo pokušati preuzeti istoimenu datoteku ili ne za nastavak preuzimanja?";

            return(MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error));
        }
예제 #5
0
        private DialogResult MessageErrorService()
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Spajanje na naš servis za preuzimanje datoteka nije trenutno moguæe ostvariti.\n" +
                                 "Potrebno je uspješno se spojiti na servis kako bih mogli preuzimati datoteke sa njega.\n" +
                                 "Da li želite sada ponovo pokušati se spojiti na naš servis i nastaviti sa preuzimanjem?";

            return(MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error));
        }
예제 #6
0
        private DialogResult MessageErrorInternet()
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Vaša internet konekcija je nedostupna, provjerite vašu spojenost na internet.\n" +
                                 "Trebate biti pravilno spojeni na internet kako bih nastavili sa skidanjem datoteka.\n" +
                                 "Da li želite sada ponovo provjeriti vašu dostupnost internet konekcije i nastaviti?";

            return(MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error));
        }
예제 #7
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     if (this.textboxPassword.Text != this.textboxAuthentic.Text)
     {
         MessageTitle title = new MessageTitle();
         string       text  = "Unesene lozinke se ne poklapaju!";
         MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
예제 #8
0
        private void MenuLinkItemTeamSpeak_Click(object sender, EventArgs e)
        {
            RegistryKey localKey32 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);

            localKey32 = localKey32.OpenSubKey(@"SOFTWARE\TeamSpeak 3 Client");
            if (localKey32 != null)
            {
                object value = localKey32.GetValue(null);
                if (value != null)
                {
                    ProcessStartInfo info = new ProcessStartInfo();

                    info.FileName         = "ts3client_win32.exe";
                    info.WorkingDirectory = value.ToString();
                    info.Arguments        = String.Format("ts3server://{0}?port={1}", Launcher.Teamspeak.Substring(0, Launcher.Teamspeak.IndexOf(":")), Launcher.Teamspeak.Substring(Launcher.Teamspeak.IndexOf(":") + 1));

                    if (File.Exists(String.Format("{0}\\{1}", value.ToString(), info.FileName)))
                    {
                        Process.Start(info);
                        return;
                    }
                }
            }

            RegistryKey localKey64 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);

            localKey64 = localKey64.OpenSubKey(@"SOFTWARE\TeamSpeak 3 Client");
            if (localKey64 != null)
            {
                object value = localKey64.GetValue(null);
                if (value != null)
                {
                    ProcessStartInfo info = new ProcessStartInfo();

                    info.FileName         = "ts3client_win64.exe";
                    info.WorkingDirectory = value.ToString();
                    info.Arguments        = String.Format("ts3server://{0}?port={1}", Launcher.Teamspeak.Substring(0, Launcher.Teamspeak.IndexOf(":")), Launcher.Teamspeak.Substring(Launcher.Teamspeak.IndexOf(":") + 1));

                    if (File.Exists(String.Format("{0}\\{1}", value.ToString(), info.FileName)))
                    {
                        Process.Start(info);
                        return;
                    }
                }
            }

            MessageTitle title = new MessageTitle();
            string       text  = "Vi nemate instaliran Teamspeak 3!";

            MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            Process.Start("https://www.teamspeak.com/teamspeak3.html");
        }
예제 #9
0
        private void MenuToolsUpdate_Click(object sender, EventArgs e)
        {
            MessageTitle title = new MessageTitle();
            string       text  = "Da li ste sigurni da želite provjeriti nadogradnju launchera?\n" +
                                 "Napomena, aplikacija æe se pokrenuti ponovo nakon ažuriranja.";
            DialogResult dialog = MessageBoxAdv.Show(text, title.InfoMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialog == DialogResult.Yes)
            {
                ColumbiaUpdate update = new ColumbiaUpdate();

                if (update.DownloadFile())
                {
                    update.RunFile();
                    Application.Exit();
                }
                //Application.Exit();
            }
        }
예제 #10
0
        private void workerFile_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            buttonStart.Text         = "Poèni";
            this.buttonStart.Enabled = true;
            this.buttonClose.Enabled = true;
            this.progressLoad.Value  = 0;
            this.labelName.Text      = "Molimo vas kliknite na Poèni da pokrente provjeru.";

            string       text;
            MessageTitle title = new MessageTitle();

            if (e.Cancelled)
            {
                text  = "Provjera datoteka od Columbia State modifikacije je prekunita.\n";
                text += "Za više informacija o upustvima i provjeri posjetite naš forum.";
                MessageBoxAdv.Show(text, title.WarningMsg, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (errorResult)
            {
                text  = "Vaša modifikacija sadrži nekoliko pogrešaka sa datotekama.\n";
                text += "Da li želite detaljno pogledati listu datoteka sa greškom?.";
                if (MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    FileForm ff = new FileForm(files);
                    ff.FileMissed    = this.fileMissed;
                    ff.FileUnknown   = this.fileUnknown;
                    ff.FileIncorrect = this.fileIncorrect;
                    ff.FileTotal     = Launcher.Name.Length;

                    ff.ShowDialog();
                }
            }
            else
            {
                text  = "Vaša datoteke su ispravne i korektne sa Columbia State modifikacijom.\n";
                text += "Sada provjereno ispunjavate uslove za pristup našem serveru, uživati u igri.";
                MessageBoxAdv.Show(text, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #11
0
        private void WorkerCheck_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                MessageTitle  title  = new MessageTitle();
                ProcessKiller killer = new ProcessKiller();

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

                string message = "Greška, otkriveni su pokušaji izmjene modifikacije tokom rada.\n" +
                                 "Columbia State Launcher æe se zatovriti iz sigurnosnih razloga.\n" +
                                 "Napomena, izmjene modifikacije nisu dozvoljene od strane korisnika.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                //workerGame.CancelAsync();
                //workerHost.CancelAsync();
                Application.Exit();
                return;
            }

            workerCheck.RunWorkerAsync();
        }
예제 #12
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (this.textName.Text.ToLower() == "ime_prezime")
            {
                MessageTitle title = new MessageTitle();

                string message = "Korisnièko ime ne može biti poèetno postaljeno (Ime_Prezime).\n" +
                                 "Unesite vaše korisnièko za prijavu na server formata 'Ime_Prezime'.";

                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (this.textName.Text.Length < 4)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Korisnièko ime mora sadržavati najmanje 4 karaktera.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textName.Text = "Ime_Prezime";
                //this.Show();
                return;
            }

            if (this.textName.Text.Length > 21)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Korisnièko ime može imati najviše 21 karakter.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textName.Text = "Ime_Prezime";
                //this.Show();
                return;
            }

            //if (!this.textName.Text.Contains("_"))
            //{
            //    MessageTitle title = new MessageTitle();
            //    string text = "Korisnièko ime mora sadržavati znak '_' u sebi.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.";
            //    MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    this.textName.Text = "Ime_Prezime";
            //    //this.Show();
            //    return;
            //}

            //if (this.textName.Text.Contains("_"))
            //{
            //    string temp = this.textName.Text.Remove(this.textName.Text.IndexOf("_"), 1);
            //    if (temp.Contains("_"))
            //    {
            //        MessageTitle title = new MessageTitle();
            //        string text = "Korisnièko ime može samo sadržavati jednu donju-crtu '_'.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.";
            //        MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            //        this.textName.Text = "Ime_Prezime";
            //        //this.Show();
            //        return;
            //    }
            //}

            if (!Regex.IsMatch(this.textName.Text, @"^[a-zA-Z_]+$"))
            {
                MessageTitle title = new MessageTitle();
                string       text  = String.Format("Korisnièko ime može sadržavati samo slova i znak donje-crte '_'.\nFormat korisnièkog imena mora biti 'Ime_Prezime', maksimalne dužine 21 karakter.");
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textName.Text = "Ime_Prezime";
                return;
            }

            //string name = this.textName.Text.Substring(0, this.textName.Text.IndexOf("_"));
            //string surname = this.textName.Text.Substring(this.textName.Text.IndexOf("_") + 1);

            //if (name.Length < 3 || surname.Length < 4)
            //{
            //    MessageTitle title = new MessageTitle();
            //    string text = "Dio 'Ime' može imati najamnje 3 slova, dok 'Prezime' najmanje 4 slova.\nFormat korisnièkog imena mora biti 'Ime_Prezime', maksimalne dužine 21 karakter.";
            //    MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    this.textName.Text = "Ime_Prezime";
            //    //this.Show();
            //    return;
            //}

            //if (name.Substring(0, 1) != name.Substring(0, 1).ToUpper())
            //{
            //    MessageTitle title = new MessageTitle();
            //    string text =String.Format("Dio '{0}' mora poèinjati velikim slovom.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.", name);
            //    MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    this.textName.Text = "Ime_Prezime";
            //    return;
            //}

            //if (surname.Substring(0, 1) != surname.Substring(0, 1).ToUpper())
            //{
            //    MessageTitle title = new MessageTitle();
            //    string text = String.Format("Dio '{0}' mora poèinjati velikim slovom.\nFormat korisnièkog imena mora biti 'Ime_Prezime'.", surname);
            //    MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    this.textName.Text = "Ime_Prezime";
            //    return;
            //}

            Process[] sampRun = Process.GetProcessesByName("samp");
            if (sampRun.Length > 0)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Imate veæ pokrenutu SAMP aplikaciju, zatvorite je!";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Process[] gtaRun = Process.GetProcessesByName("gta_sa");
            if (gtaRun.Length > 0)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Imate veæ pokrenutu GTA San Andreas igru, zatvorite je!";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SampRegistry sr = new SampRegistry();

            sr.Default();
            if (!sr.Check())
            {
                sr.Create();
            }
            //else if (!sr.Valid())
            //    sr.Write();
            else
            {
                sr.Read();
            }

            if (sr.PlayerName != this.textName.Text)
            {
                sr.PlayerName = this.textName.Text;
                sr.Write();
            }

            if (Launcher.Locked && Launcher.Password != this.textPassword.Text)
            {
                MessageTitle title = new MessageTitle();
                string       text  = "Columbia State server je zakljuèan, vaša lozinka je pogrešna.";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ValidForm vf = new ValidForm();

            if (vf.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                vf = null;
                GC.Collect();

                ProcessStartInfo processInfo = new ProcessStartInfo();
                processInfo.FileName         = "samp.exe";
                processInfo.WorkingDirectory = @".\";
                processInfo.Arguments        = String.Format("{0} {1}", Launcher.Address, Launcher.Password);
                Process.Start(processInfo);

                Process host = new Process();
                host.StartInfo.FileName         = "host-cs.exe";
                host.StartInfo.Arguments        = "cs_silent14";
                host.StartInfo.WorkingDirectory = ".\\";
                host.Start();

                workerCheck.RunWorkerAsync();
                workerGame.RunWorkerAsync();
                workerHost.RunWorkerAsync();
                //this.Hide();
                //return;
            }
            else
            {
                //MessageTitle title = new MessageTitle();
                //string text = "Columbia State server je zakljuèan, vaša lozinka je pogrešna.";
                //MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //Application.Exit();
            return;
        }
예제 #13
0
        private void UpdateForm_Shown(object sender, EventArgs e)
        {
            this.progressOne.Maximum = 100;
            this.progressAll.Maximum = Launcher.Name.Length - 1;

            Thread thread = new Thread(() =>
            {
                Network net   = new Network();
                GoogleApi api = new GoogleApi();

                Thread.Sleep(1000);
                errorResult = ErrorResult.None;

                this.BeginInvoke((MethodInvoker) delegate
                {
                    labelName.Text = "Spajanje na servis za preuzimanje...";
                });

                DriveService service = new GDriveAccount().Authenticate();
                if (service == null)
                {
                    errorResult = ErrorResult.Service;
                }

                for (int i = 0; i < Launcher.Name.Length; i++)
                {
                    if (errorResult != ErrorResult.None)
                    {
                        break;
                    }

                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        progressOne.Value = 0;
                        progressAll.Value = i;
                        labelValue.Text   = String.Empty;

                        if (Launcher.Name[i].Length > 30)
                        {
                            labelName.Text = String.Format("Fajl {0}/{1}: {2}", i + 1, Launcher.Name.Length, String.Format("...{0}", Launcher.Name[i].Substring(Launcher.Name[i].Length - 24)));
                        }
                        else
                        {
                            labelName.Text = String.Format("Fajl {0}/{1}: {2}", i + 1, Launcher.Name.Length, Launcher.Name[i]);
                        }
                    });

                    bool exist = System.IO.File.Exists(Launcher.Name[i]);

                    if (!exist || Launcher.Valid[i] && HashFile.GetMD5(Launcher.Name[i]) != Launcher.Hash[i].ToUpper())
                    {
                        number = i;
                        if (!net.Available())
                        {
                            errorResult = ErrorResult.Network;
                            break;
                        }

                        string path = Path.GetDirectoryName(Launcher.Name[i]);
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }

                        if (Launcher.Size[number] > 1048576)
                        {
                            size = Launcher.Size[number] / 1048576.0;
                        }
                        else
                        {
                            size = Launcher.Size[number] / 1024.0;
                        }

                        //Uri address = new Uri(String.Format("https://drive.google.com/uc?export=download&id={0}", Launcher.Link[i]));
                        //
                        //using (WebClient client = new WebClient())
                        //{
                        //   client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
                        //    //client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);
                        //
                        //    client.DownloadFileAsync(address, Launcher.Name[i]);
                        //    while (client.IsBusy) Thread.Sleep(500);
                        //}
                        //
                        //if (HashFile.GetMD5(Launcher.Name[i]) == Launcher.Hash[i]) continue;


                        //google drive api download
                        var request = service.Files.Get(Launcher.Link[i]);
                        //GoogleFile file = service.Files.Get(Launcher.Link[i]).Execute();

                        if (Launcher.Size[i] > 1048576)
                        {
                            request.MediaDownloader.ChunkSize = 1024 * 512;
                        }
                        else
                        {
                            request.MediaDownloader.ChunkSize = 1024 * 4;
                        }

                        using (FileStream fs = new FileStream(Launcher.Name[i], FileMode.Create, FileAccess.Write))
                        {
                            request.MediaDownloader.ProgressChanged += (IDownloadProgress progress) =>
                            {
                                switch (progress.Status)
                                {
                                case DownloadStatus.Downloading:
                                    {
                                        this.BeginInvoke((MethodInvoker) delegate
                                        {
                                            //double bytesIn = double.Parse(progress.BytesDownloaded.ToString());
                                            //double totalBytes = double.Parse(Launcher.Size[i].ToString());
                                            //double percentage = bytesIn / totalBytes * 100;
                                            //progressOne.Value = int.Parse(Math.Truncate(percentage).ToString());
                                            progressOne.Value = (int)(((double)progress.BytesDownloaded / Launcher.Size[i]) * 100);

                                            if (Launcher.Size[i] > 1048576)
                                            {
                                                labelValue.Text = String.Format("{0:0.00}/{1:0.00} MB", progress.BytesDownloaded / 1048576.0, size);
                                            }
                                            else
                                            {
                                                labelValue.Text = String.Format("{0:0.00}/{1:0.00} KB", progress.BytesDownloaded / 1024.0, size);
                                            }

                                            //if (Launcher.Size[i] < 1048576) //1MB = 1B * 1024 * 1024 = 1038576 B
                                            //    labelValue.Text = String.Format("{0:0.00}/{1:0.00} KB", Math.Truncate((bytesIn / 1024) * 100) / 100, Math.Truncate((totalBytes / 1024) * 100) / 100);
                                            //else
                                            //    labelValue.Text = String.Format("{0:0.00}/{1:0.00} MB", Math.Truncate((bytesIn / 1048576) * 100) / 100, Math.Truncate((totalBytes / 1048576) * 100) / 100);


                                            //////double bytesIn = double.Parse(progress.BytesDownloaded.ToString());
                                            //////double totalBytes = double.Parse(Launcher.Size[number].ToString());
                                            //////double percentage = bytesIn / totalBytes * 100;
                                            ////int value = (int)((progress.BytesDownloaded / Launcher.Size[number]) * 100);
                                            ////progressOne.Value = value;

                                            //if (Launcher.Size[number] < 1048576) //1MB = 1B * 1024 * 1024 = 1038576 B
                                            //    labelValue.Text = String.Format("{0}/{1} KB", (progress.BytesDownloaded / 1024), Launcher.Size[i] / 1024);
                                            //else
                                            //    labelValue.Text = String.Format("{0}/{1} MB", (progress.BytesDownloaded / 1048576), Launcher.Size[i] / 1048576);


                                            //double bytesIn = double.Parse(progress.BytesDownloaded.ToString());
                                            //double totalBytes = double.Parse(Launcher.Size[number].ToString());
                                            //double percentage = bytesIn / totalBytes * 100;
                                            //progressOne.Value = int.Parse(Math.Truncate(percentage).ToString());

                                            ////if (Launcher.Size[number] < 1048576) //1MB = 1B * 1024 * 1024 = 1038576 B
                                            ////    labelValue.Text = String.Format("{0:0.00}/{1:0.00} KB", Math.Truncate((bytesIn / 1024) * 100) / 100, Math.Truncate((totalBytes / 1024) * 100) / 100);
                                            ////else
                                            ////    labelValue.Text = String.Format("{0:0.00}/{1:0.00} MB", Math.Truncate((bytesIn / 1048576) * 100) / 100, Math.Truncate((totalBytes / 1048576) * 100) / 100);
                                        });

                                        if (Launcher.Size[i] > 1048576)
                                        {
                                            request.MediaDownloader.ChunkSize += 1024 * 16;
                                        }
                                        else
                                        {
                                            request.MediaDownloader.ChunkSize += 1024 * 2;
                                        }

                                        break;
                                    }

                                case DownloadStatus.Completed:
                                    {
                                        this.BeginInvoke((MethodInvoker) delegate
                                        {
                                            progressOne.Value = 100;
                                        });
                                        Thread.Sleep(100);
                                        break;
                                    }

                                case DownloadStatus.Failed:
                                    {
                                        if (Launcher.Size[i] > 0)
                                        {
                                            errorResult = ErrorResult.Download;
                                        }
                                        break;
                                    }
                                }
                            };
                            request.Download(fs);
                        }

                        if (HashFile.GetMD5(Launcher.Name[i]) != Launcher.Hash[i].ToUpper())
                        {
                            errorResult = ErrorResult.Download;
                        }



                        //using (WebClient client = new WebClient())
                        //{
                        //    client.if (HashFile.GetMD5(Launcher.Name[i]) != Launcher.Hash[i]) errorResult = ErrorResult.Download; += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
                        //    client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);

                        //    string path = Path.GetDirectoryName(Launcher.Name[i]);
                        //    if (!Directory.Exists(path)) Directory.CreateDirectory(path);

                        //    if (!net.Available())
                        //    {
                        //        errorResult = ErrorResult.Network;
                        //        break;
                        //    }

                        //    client.DownloadFileAsync(address, filename);
                        //    while (client.IsBusy) Thread.Sleep(1000);
                        //}
                        //address = String.Format("https://drive.google.com/uc?export=download&id={0}", Launcher.Link[i]);

                        //using (WebClient client = new WebClient())
                        //{
                        //    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
                        //    client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);

                        //    string path = Path.GetDirectoryName(Launcher.Name[i]);
                        //    if (!Directory.Exists(path)) Directory.CreateDirectory(path);

                        //    if (!net.Available())
                        //    {
                        //        errorResult = ErrorResult.Network;
                        //        thread.Abort();
                        //        break;
                        //    }

                        //    client.DownloadFileAsync(new Uri(address), Launcher.Name[i]);
                        //    while (client.IsBusy) Thread.Sleep(1000);
                        //}

                        //if (HashFile.GetMD5(Launcher.Name[i]) != Launcher.Hash[i])
                        //{
                        //    errorResult = ErrorResult.Download;
                        //}
                    }
                    else
                    {
                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            progressOne.Value = 100;
                        });
                        Thread.Sleep(100);
                    }
                }

                this.BeginInvoke((MethodInvoker) delegate
                {
                    this.Hide();

                    string text;
                    MessageTitle title = new MessageTitle();

                    if (errorResult == ErrorResult.None)
                    {
                        text = "Ažuriranje moda Columbia State je uspješno završeno.";
                        MessageBoxAdv.Show(text, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (errorResult == ErrorResult.Network)
                    {
                        text = "Vaša internet konekcija ne radi ili je prekinuta.";
                        MessageBoxAdv.Show(text, title.WarningMsg, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (errorResult == ErrorResult.Service)
                    {
                        text = "Autentifikacija sa fajlovima nije validna, ažuriranje je prekinuto.";
                        MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        this.DialogResult = System.Windows.Forms.DialogResult.Abort;
                    }
                    else if (errorResult == ErrorResult.Download)
                    {
                        text = String.Format("Došlo je do pogreške prilikom ažuriranja na fajlu: {0}", Path.GetFileName(Launcher.Name[number]));
                        MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    //GC.Collect();
                    this.Close();
                });
            });


            thread.Priority     = ThreadPriority.Lowest;
            thread.IsBackground = true;
            thread.Start();
        }
예제 #14
0
        static void Main(string[] args)
        {
#if !DEBUG
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Library lib = new Library();
            if (!lib.Valid())
            {
                MessageTitle title   = new MessageTitle();
                string       message = "Biblioteke datoteka od Columbia State Launchera nisu isparavne.\n" +
                                       "Da li želite pokreniti servis ažuriranja i nadomjestiti ispravnim?\n" +
                                       "Napomena, launcher ne može biti pokrenuta ako datoteke nisu validne.";

                if (DialogResult.No == MessageBox.Show(message, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Stop))
                {
                    return;
                }

                ColumbiaUpdate update = new ColumbiaUpdate();

                if (update.DownloadFile())
                {
                    update.RunFile();
                    Application.Exit();
                    return;
                }
                else
                {
                    message = "Servis Columbia State Launcher Update trenutno ne postoji.\n" +
                              "Ovaj korak će biti implemnetiran u novijim ažuriranjima launchera.";

                    MessageBox.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return;
            }

            LauncherBase lan = new LauncherBase();
            if (lan.Read())
            {
                Launcher.SlideShow = lan.SlideNumber;
                if (HashFile.GetMD5("columbia.exe") != lan.HashLauncher)
                {
                    MessageTitle title   = new MessageTitle();
                    string       message = "Vaša verzija Columbia State Launchera nije posljednja.\n" +
                                           "Da li želite sada ažurirati launcher na zadnju verziju?\n" +
                                           "Napomena, za pristpu našem serveru aplikacija treba biti najnovija.";
                    if (DialogResult.Yes == MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error))
                    {
                        ColumbiaUpdate update = new ColumbiaUpdate();

                        if (update.DownloadFile())
                        {
                            update.RunFile();
                            Application.Exit();
                        }
                        else
                        {
                            message = "Servis Columbia State Launcher Update trenutno ne postoji.\n" +
                                      "Ovaj korak će biti implemnetiran u novijim ažuriranjima launchera.";

                            MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    return;
                }

                /*else if (HashFile.GetMD5("update-cs.exe") != lan.HashUpdate)
                 * {
                 *  MessageTitle title = new MessageTitle();
                 *  string message = "Vaša verzija Columbia State Update servisa nije posljednja.\n" +
                 *                   "Da li želite sada ažurirati update servis na zadnju verziju?\n" +
                 *                   "Napomena, za pristpu našem serveru servis treba biti najnoviji.";
                 *
                 *  MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                 *
                 *  message = "Implementacija u novim ažuriranjem Columbia State Launcher-a.";
                 *  MessageBoxAdv.Show(message, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 * }*/
            }
            else
            {
                MessageTitle title   = new MessageTitle();
                string       message = "Nažalost došlo je do greške pri spajanju sa bazom podataka.\n" +
                                       "Provjerite svoju internet konekciju ili kontaktirajte administraciju.";
                MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            lan = null;
            lib = null;

            if (args.Length > 0)
            {
                string       message;
                MessageTitle title = new MessageTitle();
                if (args[0] == "0")
                {
                    message = "Ažuriranje Columbia State Launchera je uspješno urađeno.\n" +
                              "Želimo vam ugodno korištenje, sve primjedbe pišite na forumu.";
                    MessageBoxAdv.Show(message, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    message = "Ažuriranje Columbia State Launchera je neuspješno.\n" +
                              "Detaljnije obrađena poruka u novijim nadogradnjama.";
                    MessageBoxAdv.Show(message, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
#endif

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

            Application.Run(new LoadForm());
            //Application.Run(new DownloadForm());
        }
예제 #15
0
        private void WorkerFile_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            string       text;
            MessageTitle title = new MessageTitle();

            if (e.Cancelled)
            {
                text  = "Validacija datoteka od Columbia State modifikacije je prekunita.\n";
                text += "Ne možete se spojiti na server sve dok uspješno ne završite validaciju.";
                MessageBoxAdv.Show(text, title.WarningMsg, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //workerFile.CancelAsync();
                //text = String.Format("Tokom provjere došlo je do neovlaštene izmjene fajlova.\nAplikacija iz sigurnostnih razloga bit æe zatvorena, pokušajte ponovo.");
                //MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                //Application.Exit();
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                this.Close();
                //return;
            }
            else if (this.fileUnknown > 0 || this.fileMissed > 0 || this.fileIncorrect > 0)
            {
                text  = "Vaša modifikacija sadrži nekoliko pogrešaka sa datotekama.\n";
                text += "Da li želite detaljno pogledati listu datoteka sa greškom?.";
                if (MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    FileForm ff = new FileForm(this.errorFiles);
                    ff.FileMissed    = this.fileMissed;
                    ff.FileUnknown   = this.fileUnknown;
                    ff.FileIncorrect = this.fileIncorrect;
                    ff.FileTotal     = Launcher.Name.Length;

                    ff.ShowDialog();
                }

                //ako potoje nepoznate datoteke, ponudit ce se brisanje istih
                //i ako se izvede brisanje onda ce se nastaviti sa vlidacijom
                if (this.fileUnknown > 0)
                {
                    text  = "Da bih ste se uspješno spojili na server potrebno je da uklonite nepoznate fajlove.\n";
                    text += "Da li želite sada ukloniti nepoznate fajlove i tako omoguæiti uspješnu validaciju datoteka?\n";
                    text += "Napomena, datoteke koje su u listi tj. zapisniku oznaèene kao nepoznate æe biti trajno uklonjene.";
                    if (MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                    {
                        Library  libs = new Library();
                        DataFile df   = new DataFile();
                        df.ReadUnknown(Launcher.Name, libs.Name);
                        foreach (string file in df.UnknownFiles)
                        {
                            if (!File.Exists(file))
                            {
                                continue;
                            }
                            File.Delete(file);
                        }

                        text = "Nepoznate datoteke su uspješno obrisane, sada možete nastaviti.";
                        MessageBoxAdv.Show(text, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        //korisnik je odabrao da ne zeli ukloniti nepoznate fajlove
                        //time se validacija ne ispunjava i prekida se zatvaranjem forme
                        this.DialogResult = System.Windows.Forms.DialogResult.Abort;
                        this.Close();
                        return;
                    }
                }

                //ako potoje nedotajuce i nekorektne datoteke onda ce biti ponudjeno skidanje istih
                //u slucaju da se uspjesno izvede validacija ce biti nastavljena dalje;
                if (this.fileMissed > 0 || this.fileIncorrect > 0)
                {
                    long lenght = 0;
                    //sabira se ukupna velicina svih pojedinih fajlova na listi za download
                    foreach (int id in this.id)
                    {
                        lenght += Launcher.Size[id];
                    }
                    text  = "Da bih ste se spojili uspješno na server sve datoteke trebaju biti validne.\n";
                    text += "Da li želite sada skinuti potrebne datotke i tako omoguæiti uspješnu validaciju?\n";
                    text += String.Format("Napomena, broj datoteka za skidanje je {0} i ukupna velièina je {1:0.00}MB.", this.fileMissed + this.fileIncorrect, lenght / 1048576.0);
                    if (MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                    {
                        this.Hide();
                        DownloadForm dw = new DownloadForm();
                        foreach (int index in this.id)
                        {
                            dw.Id.Add(index);
                        }
                        if (dw.ShowDialog() == DialogResult.Abort)
                        {
                            //ažuriranje datoteka nije uspješno izvršeno i validacija se prekida;
                            text  = "Skidanje i ažuriranje datoteka sa servisa nije uspješno izvršeno.\n";
                            text += "Nažalost validacija ne može biti nastavljena dalje, pokušajte ponovo.\n";
                            text += "U sluèaju da ne može proæi postupak validacije, obratite se na forumu.";
                            MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.DialogResult = System.Windows.Forms.DialogResult.Abort;
                            this.Close();
                            return;
                        }

                        /*if (dw.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                         *  this.DialogResult = System.Windows.Forms.DialogResult.OK;
                         * else
                         *  this.DialogResult = System.Windows.Forms.DialogResult.Abort;*/
                    }
                    else
                    {
                        //korisnik je odabrao da ne zeli skinuti protrebne fajlove
                        //time validacija ne može biti zadovoljena i forma se zatvara
                        this.DialogResult = System.Windows.Forms.DialogResult.Abort;
                        this.Close();
                        return;
                    }
                }
            }

            /*else if (this.id.Count > 0)
             * {
             *  text = String.Format("Ukupno ima {0} fajlova za ažuriranje.\nDa li želite sada izvršiti nadogradnju istih?", this.id.Count);
             *  if (MessageBoxAdv.Show(text, title.WarningMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
             *  {
             *      DownloadForm dw = new DownloadForm(true);
             *      foreach (int index in this.id) dw.Id.Add(index);
             *
             *      if (dw.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             *          this.DialogResult = System.Windows.Forms.DialogResult.OK;
             *      else
             *          this.DialogResult = System.Windows.Forms.DialogResult.Abort;
             *  }
             *  else
             *  {
             *      this.DialogResult = System.Windows.Forms.DialogResult.Abort;
             *  }
             * }
             * else
             * {
             *  this.DialogResult = System.Windows.Forms.DialogResult.OK;
             * }*/

#if DEBUG
            /*Library lib = new Library();
             * if (!lib.Valid())
             * {
             *  text = "Columbia State Launcher biblioteke nisu validne!";
             *  MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
             *  this.DialogResult = System.Windows.Forms.DialogResult.Abort;
             * }*/
#endif

            //this.fileStream.Clear();
            //this.fileStream = null;
            //GC.Collect();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #16
0
        private void workerLoad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.Hide();
            MessageTitle title = new MessageTitle();

            if (e.Result.ToString() == ErrorResult.Work.ToString())
            {
                string text = "Instanca aplikacije Columbia State Launcher-a je veæ pokrenuta.\n" +
                              "Pokretanje više instanci nije dozvoljeno i ista neæe biti startovana.";

                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Service.ToString())
            {
                string text = "Prijava na servis Columbia State moda nije uspješno izvršena.\n" +
                              "Pokušajte ponovo ili evidentirajte vašu grešku na forum.";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Edit.ToString())
            {
                ProcessKiller killer = new ProcessKiller();

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

                string text = "Naziv Columbia State Launcher 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 neæe pokrenuti.";

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

                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Network.ToString())
            {
                Network net = new Network();
                MessageBoxAdv.Show(net.Error, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Database.ToString())
            {
                string text = "Konekcija sa bazom podataka je neuspješna.\nKontaktirajte administratora na forumu ili pokušajte ponovo.";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Unknown.ToString())
            {
                long size = 0;
                foreach (string file in unknownFiles)
                {
                    if (System.IO.File.Exists(file))
                    {
                        FileInfo info = new FileInfo(file);
                        size += info.Length;
                        //size += new System.IO.FileInfo(file).Length;
                    }
                }
                double total = size / 1048576.0;

                string message = String.Format("Vaša modifikacija sadrži {0} nepoznatih datoteka, velièine {1:0.00} MB.\n", unknownFiles.Count, total) +
                                 "Da li želite iste obrisati sada i nastaviti sa uèitavanem launcher-a?\n" +
                                 "Napomena, aplikacija se neæe uèitati dok postoje strane nepredviðene datoteke.";

                if (System.Windows.Forms.DialogResult.Yes == MessageBoxAdv.Show(message, title.WarningMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    try
                    {
                        foreach (string name in this.unknownFiles)
                        {
                            System.IO.File.Delete(name);
                        }

                        message = "Nepoznate datoteke su uspješno uklonjene, launcher æe se ponovo uèitati.";
                        MessageBoxAdv.Show(message, title.InfoMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.workerLoad.RunWorkerAsync();
                        return;
                    }
                    catch (Exception)
                    {
                        message = "Nepoznate datoteke nisu uspješno izbrisane, uèinite mehanièki uklanjanje!";
                        MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                Application.Exit();
                return;
            }
            else if (e.Result.ToString() == ErrorResult.Missed.ToString())
            {
                long size = 0;
                foreach (int id in missedFiles)
                {
                    if (System.IO.File.Exists(Launcher.Name[id]))
                    {
                        size += new System.IO.FileInfo(Launcher.Name[id]).Length;
                    }
                }

                string message = String.Format("Vašoj modifikaciji nedostaje {0} datoteka, ukupne velièine {1:0.00} MB.\n", missedFiles.Count, size / 1048576.0) +
                                 "Da li želite iste skinuti sada i nastaviti sa uèitavanem launcher-a?\n" +
                                 "Napomena, aplikacija se neæe uèitati dok sve datoteke ne budu ažurirane.";

                if (System.Windows.Forms.DialogResult.Yes == MessageBoxAdv.Show(message, title.WarningMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    DownloadForm dw = new DownloadForm();
                    foreach (int index in this.missedFiles)
                    {
                        dw.Id.Add(index);
                    }

                    if (dw.ShowDialog(this) == System.Windows.Forms.DialogResult.Abort)
                    {
                        message = "Nažalost skidanje novih datoteka nije uspješno izvršeno do kraja.\n" +
                                  "Columbia State Launcher ne može nastaviti sa daljnjim uèitavanjem.\n" +
                                  "Potražiti na forumu upustvo za pogrešku ovog tipa ili evidentirajte istu.";

                        MessageBoxAdv.Show(message, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Process.Start("https://columbia-state.com/");
                        Application.Exit();
                        return;
                    }
                }
                else
                {
                    Application.Exit();
                    return;
                }
            }

            if (Launcher.Working == false)
            {
                string text = "Columbia State Server je trenutno u procesu nadogradnje, pokušajte kasnije!";
                MessageBoxAdv.Show(text, title.ErrorMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);

                Application.Exit();
                return;
            }

            mainForm.Show();
        }