// Decompiled with JetBrains decompiler
// Type: FiestaLauncher.Services.PatchHiveService
// 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

using System;
using System.Collections.Generic;

namespace FiestaLauncher.Services
{
  internal static class PatchHiveService
  {
    internal static Dictionary<string, string> ClientPatchHive = new Dictionary<string, string>();
    internal static string First = "";
    private static string _launcherUpdateName = "";
    private static string _launcherUpdaterUrl = "";
    private static bool _needLauncherUpdate;

    internal static void ParseHiveFile(string file)
    {
      string[] separator = new string[1]
      {
        Environment.NewLine
      };
      string[] strArray1 = file.Split(separator, StringSplitOptions.RemoveEmptyEntries);
      for (int index = 0; index < strArray1.Length; ++index)
      {
        if (strArray1[index][0] == '#')
        {
          string[] strArray2 = strArray1[index].Split("\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
          string str = strArray2[0];
          if (str != null)
          {
            if (str == "#LAUNCHER")
            {
              if (strArray2[1] != gFiestaLauncher.LauncherVersion && !PatchHiveService._needLauncherUpdate)
              {
                PatchHiveService._needLauncherUpdate = true;
                PatchHiveService._launcherUpdateName = strArray2[2];
              }
            }
            else if (str == "#UPDATER")
              PatchHiveService._launcherUpdaterUrl = strArray2[1];
            else if (str != "#PATCH")
            {
              if (str == "#ROOT")
                gFiestaLauncher.Settings["PatchRoot"] = strArray2[1];
            }
            else if (!PatchHiveService.ClientPatchHive.ContainsKey(strArray2[1]))
            {
              if (PatchHiveService.First == "")
              {
                PatchHiveService.First = strArray2[1];
                gFiestaLauncher.FirstPatch = PatchHiveService.First;
              }
              PatchHiveService.ClientPatchHive.Add(strArray2[1], strArray2[2]);
            }
          }
        }
      }
      if (!PatchHiveService._needLauncherUpdate)
        return;
      ClientUpdateService.LauncherUpdateRequired(PatchHiveService._launcherUpdaterUrl, PatchHiveService._launcherUpdateName);
    }
  }
}
