Program.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Avalonia;
  2. using fis.Upgrader.Helpers;
  3. using fis.Upgrader.Managers;
  4. using System;
  5. using System.Globalization;
  6. using System.IO;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace fis.Upgrader
  10. {
  11. internal class Program
  12. {
  13. // Initialization code. Don't use any Avalonia, third-party APIs or any
  14. // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
  15. // yet and stuff might break.
  16. [STAThread]
  17. public static void Main(string[] args) {
  18. var storagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AppStorage");
  19. var languageConfig = Path.Combine(storagePath, "configed_language_local.conf");
  20. string? languageCode;
  21. if (!File.Exists(languageConfig))
  22. {
  23. languageCode = CultureInfo.CurrentUICulture.Name;
  24. }
  25. else
  26. {
  27. string configText = File.ReadAllText(languageConfig, Encoding.UTF8);
  28. languageCode = configText?.Trim();
  29. }
  30. TranslationHelper.CurrentLanguageCode = languageCode!;
  31. Task.Run(() => { UpgradeManager.Instance.RunFullUpgrade(); });
  32. BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
  33. }
  34. // Avalonia configuration, don't remove; also used by visual designer.
  35. public static AppBuilder BuildAvaloniaApp()
  36. => AppBuilder.Configure<App>()
  37. .UsePlatformDetect()
  38. .LogToTrace();
  39. }
  40. }