Exemple #1
0
        public loginForm()
        {
            this.BackgroundImage = Recursos.login_bg;
            InitializeComponent();


            //MessageBox.Show("VERSION 99 - PRUEBA");

            /*Vemos si exite el CoevenConfig.ini sino lo creamos  */
            CoevenConfigStart();
            /*Vemos si exite el CoevenConfig.ini sino lo creamos  */

            leerINI conFile            = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");
            string  configSaveUser     = conFile.IniReadValue("CoevenConfig", "SaveUser");
            string  configSavePassword = conFile.IniReadValue("CoevenConfig", "SavePassword");

            if (configSavePassword == "on")
            {
                string savedPass = conFile.IniReadValue("Datos", "Pass");
                checkBox.Image = Recursos.login_check;
                savePassword   = true;
                if (savedPass.Length != 0)
                {
                    textBox_Password.Text = savedPass;
                }
            }

            if (configSaveUser == "on")
            {
                string savedUser = conFile.IniReadValue("Datos", "User");

                if (savedUser.Length != 0)
                {
                    textBox_Username.Text = savedUser;
                    loginConnect.Select();
                }
            }
            else
            {
                textBox_Username.Text = "";
            }
            loginClose.Image   = Recursos.login_close;
            loadingGIF.Image   = Recursos.loading;
            loginConnect.Image = Recursos.login_connect;
            errorIcon.Image    = Recursos.login_bulletwrong;
            successIcon.Image  = Recursos.login_bulletok;

            loadingGIF.Hide();
            loginStatus.Hide();
            errorIcon.Hide();
            successIcon.Hide();
            backgroundWorker1.WorkerReportsProgress      = true;
            backgroundWorker1.WorkerSupportsCancellation = false;
            labelVersion.Text = "Version: " + Datos.LauncherVersion + "." + Datos.LauncherBuild + "." + Datos.LauncherPatch;
        }
Exemple #2
0
        public loginForm()
        {
            this.BackgroundImage = Recursos.login_bg;
            InitializeComponent();

            //MessageBox.Show("VERSION 99 - PRUEBA");

            leerINI conFile   = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");
            string  savedUser = conFile.IniReadValue("Datos", "User");

            //MessageBox.Show(savedUser + savedUser.Length);
            if (savedUser.Length != 0)
            {
                textBox_Username.Text = savedUser;
                textBox_Password.Select();
            }
            loginClose.Image   = Recursos.login_close;
            loadingGIF.Image   = Recursos.loading;
            loginConnect.Image = Recursos.login_connect;
            errorIcon.Image    = Recursos.login_bulletwrong;
            successIcon.Image  = Recursos.login_bulletok;

            loadingGIF.Hide();
            loginStatus.Hide();
            errorIcon.Hide();
            successIcon.Hide();
            backgroundWorker1.WorkerReportsProgress      = true;
            backgroundWorker1.WorkerSupportsCancellation = false;
            labelVersion.Text = "Version: " + Datos.LauncherVersion + "." + Datos.LauncherBuild + "." + Datos.LauncherPatch;
        }
Exemple #3
0
        private void cargarConfiguraciones()
        {
            //Cargar todas las configuraciones
            leerINI conFile          = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");
            string  configSaveBackup = conFile.IniReadValue("CoevenConfig", "SaveBackup");
            //string configSafeLogin = conFile.IniReadValue("CoevenConfig", "SafeLogin");
            string configSound        = conFile.IniReadValue("CoevenConfig", "Sound");
            string configXelionBackup = conFile.IniReadValue("XelionOnline", "SaveBackup");

            if (configSaveBackup == "on")
            {
                Configuraciones.backupLauncher = true;
            }
            if (configSound == "on")
            {
                Configuraciones.isSoundOn = true;
            }
            if (configXelionBackup == "on")
            {
                Configuraciones.backupXelion = true;
            }
        }
        public Configuracion()
        {
            InitializeComponent();
            myPCName.Text = "\\\\" + Environment.MachineName;
            //Leer datos
            leerINI conFile = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");

            configSaveUser     = conFile.IniReadValue("CoevenConfig", "SaveUser");
            configSavePassword = conFile.IniReadValue("CoevenConfig", "SavePassword");
            configSaveBackup   = conFile.IniReadValue("CoevenConfig", "SaveBackup");
            configSafeLogin    = conFile.IniReadValue("CoevenConfig", "SafeLogin");
            configSound        = conFile.IniReadValue("CoevenConfig", "Sound");
            configXelionBackup = conFile.IniReadValue("XelionOnline", "SaveBackup");
            if (configSaveUser == "on")
            {
                saveUserCheck.Checked = true;
            }
            if (configSavePassword == "on")
            {
                savePassCheck.Checked = true;
            }
            if (configSafeLogin == "on")
            {
                safeLoginCheck.Checked = true;
            }
            if (configSaveBackup == "on")
            {
                saveBackupCheck.Checked = true;
            }
            if (configSound == "on")
            {
                soundCheck.Checked = true;
            }
            if (configXelionBackup == "on")
            {
                xelionBackupCheck.Checked = true;
            }
        }
Exemple #5
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            if (File.Exists(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip"))
            {
                // Si Existe Borramos el exe del launcher y ponemos el nuevo
                // Tambien hay que leer el INI a ver si quiere que guardemos los backups!

                //Leemos el ZIP
                using (ZipFile zip = ZipFile.Read(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip"))
                {
                    Thread.Sleep(600);
                    zip.ExtractAll(Directory.GetCurrentDirectory(), ExtractExistingFileAction.OverwriteSilently);
                }

                try
                {
                    leerINI ini        = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");
                    string  caniDelete = ini.IniReadValue("CoevenConfig", "SaveBackup");
                    if (caniDelete == "off")
                    {
                        File.Delete(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip");
                    }
                }
                catch
                {
                    File.Delete(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip");
                }
            }
            else
            {
                //Magicamente no lo guardo :( volvemos a bajar
                string cvnUpdateURL = "http://localhost/cvn_updates/";
                string descargar    = cvnUpdateURL + Program.LauncherServerCode + "/" + Program.LauncherServerCode.ToLower() + ".zip";

                string      guardar           = Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip";
                string      folder            = Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\";
                WebRequest  request           = WebRequest.Create(descargar);
                WebResponse response          = request.GetResponse();
                Int64       iSize             = response.ContentLength;
                Int64       iRunningByteTotal = 4096;

                using (Stream responseStream = response.GetResponseStream())
                {
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }

                    using (Stream fileStream = File.OpenWrite(guardar))
                    {
                        byte[] buffer    = new byte[4096];
                        int    bytesRead = responseStream.Read(buffer, 0, 4096);
                        while (bytesRead > 0)
                        {
                            fileStream.Write(buffer, 0, bytesRead);
                            bytesRead         = responseStream.Read(buffer, 0, 4096);
                            iRunningByteTotal = iRunningByteTotal + bytesRead;
                            //Calculamos la descarga en la progress bar total/%
                            //MessageBox.Show("" + iRunningByteTotal);
                            double dIndex = (double)(iRunningByteTotal);
                            double dTotal = (double)iSize;
                            //MessageBox.Show("" + FormatBytes(iRunningByteTotal));
                            double dProgressPercentage = (dIndex / dTotal);
                            int    iProgressPercentage = (int)(dProgressPercentage * 100);
                        }
                    }
                }
                //Fin Stream
                //Leemos el ZIP
                using (ZipFile zip = ZipFile.Read(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip"))
                {
                    zip.ExtractAll(Directory.GetCurrentDirectory(), ExtractExistingFileAction.OverwriteSilently);
                }


                try
                {
                    leerINI ini        = new leerINI(Directory.GetCurrentDirectory() + "\\CoevenConfig.ini");
                    string  caniDelete = ini.IniReadValue("CoevenConfig", "SaveBackup");
                    if (caniDelete == "off")
                    {
                        File.Delete(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip");
                    }
                }
                catch
                {
                    File.Delete(Directory.GetCurrentDirectory() + "\\Downloads\\Coeven\\cvn_" + Program.LauncherServerCode.ToLower() + ".zip");
                }
            }

            Thread.Sleep(3000);
        }