// Decompiled with JetBrains decompiler
// Type: FiestaLauncher.Services.ClientUpdateService
// Assembly: FiestaOnline, Version=2019.5.22.0, Culture=neutral, PublicKeyToken=null
// MVID: 2FD5EB61-BC25-469D-997E-88998E849F6A
// Assembly location: C:\Users\marbo\Documents\Gamigo 2020 Client\FiestaOnline.exe

namespace FiestaLauncher.Services
{
  internal static class ClientUpdateService
  {
    internal static bool IsUpdatingLauncher;

    internal static void CheckForUpdates(bool self = false)
    {
      if (gFiestaLauncher.CURRENT_PATCH == "")
      {
        VersionService.SetDefaultValues();
        if (self)
          return;
        ClientUpdateService.CheckForUpdates(true);
      }
      else if (!PatchHiveService.ClientPatchHive.ContainsKey(gFiestaLauncher.CURRENT_PATCH))
      {
        gFiestaLauncher.MainWindow.RunOnUiThread((Main.RunOnUiThreadDelegate) (() => gFiestaLauncher.MainWindow.ClientUpToDate()));
      }
      else
      {
        VersionService.ParseGdpFile(PatchHiveService.ClientPatchHive[gFiestaLauncher.CURRENT_PATCH]);
        gFiestaLauncher.MainWindow.RunOnUiThread((Main.RunOnUiThreadDelegate) (() => gFiestaLauncher.MainWindow.StartPatchDownload(PatchHiveService.ClientPatchHive[gFiestaLauncher.CURRENT_PATCH])));
      }
    }

    internal static void LauncherUpdateRequired(
      string LauncherUpdaterURL,
      string LauncherUpdateName)
    {
      ClientUpdateService.IsUpdatingLauncher = true;
      gFiestaLauncher.MainWindow.RunOnUiThread((Main.RunOnUiThreadDelegate) (() => gFiestaLauncher.MainWindow.Hide()));
      LauncherUpdater launcherUpdater = new LauncherUpdater(LauncherUpdaterURL, LauncherUpdateName);
    }
  }
}
