private static void UpdateClient(string[] updatefilelines) { //FormExecution.HideLogin(); FormExecution.Client_PopMessageBoxShowDialog("Un mise à jour du jeu est disponible !", "Mise à jour"); List <string> updatesToDo = new List <string>(); int i = 0; while (updatefilelines[i] != CLIENT_VERSION.ToString() && i < updatefilelines.Length - 1) { updatesToDo.Add(GetClientUpdateURL(updatefilelines[i])); i++; } updatesToDo.Reverse(); UpdatesInfos infos = new UpdatesInfos { LastVersion = FormExecution.GetLastVersion(updatefilelines).ToString(), Updates = updatesToDo.ToArray(), ProcessName = Assembly.GetExecutingAssembly().Location }; Process p = new Process(); p.StartInfo.FileName = Path.Combine(FormExecution.path, "BattleCityAlpha-Updater.exe"); p.StartInfo.WorkingDirectory = Path.Combine(FormExecution.path); string jsonStr = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(infos))); p.StartInfo.Arguments = jsonStr; p.StartInfo.Verb = "runas"; p.Start(); }
public Main() { try { Application.Current.Dispatcher.Invoke(() => FormExecution.InitConfig()); if (!CheckClientUpdate()) { Application.Current.Dispatcher.Invoke(() => FormExecution.Init()); } } catch (Exception ex) { logger.Fatal(ex); FormExecution.Client_PopMessageBoxShowDialog("Une erreur s'est produite.", "Problème"); } }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { logger.Error("UNHANDLED EXCEPTION - {0}", e.Exception.ToString()); FormExecution.Client_PopMessageBoxShowDialog("Une erreur s'est produite.", "Problème"); Application.Current.Dispatcher.Invoke(Application.Current.Shutdown); }