Exemplo n.º 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            SplashLoad lo = new SplashLoad();

            lo.Show();
            lo.setMenssage("Verificando ruta de descarga...");
            var pa = System.Text.Json.JsonSerializer.Deserialize <path>(File.ReadAllText("path/path.json"));

            if (pa.Download == "none")
            {
                lo.Hide();
                if (new Inicio().ShowDialog() == true)
                {
                    lo.Show();
                }
                else
                {
                    Current.Shutdown();
                }
            }
            lo.setMenssage("Buscando Mods...");
            GoogleDrive go   = new GoogleDrive();
            Hashtable   page = go.getTable();

            lo.setMenssage("Buscando atualizacion...");
            var vers = System.Text.Json.JsonSerializer.Deserialize <Versiones>(go.getUpdate());

            if (getActualization(vers.version))
            {
                lo.setMenssage("Iniciando aplicacion...");
                new MainWindow(pa.Download, go, File.Exists(@"data\Logs.txt")).Show();
                lo.Close();
            }
            else
            {
                Console.WriteLine("existe? " + (File.Exists(Environment.CurrentDirectory + @"\Update.exe") ? "Si ": "no"));
                MessageBox.Show("Se ha encontrado una nueva version, Se iniiciara a descargar", "Actualizacion encontrada", MessageBoxButton.OK, MessageBoxImage.Information);
                ProcessStartInfo pros = new ProcessStartInfo(Environment.CurrentDirectory + @"\Update.exe");
                Process          p    = new Process();
                p.StartInfo = pros;
                p.Start();
                lo.Close();
                System.Windows.Application.Current.Shutdown();
            }
        }