public static void DownloadPatches()
        {
            Task.Run(async() =>
            {
                State.CurrentState = State.state.Deleting;
                using (WebClient wc = new WebClient())
                {
                    string json = await wc.DownloadStringTaskAsync(PatchesURL);

                    Patches patch = JsonConvert.DeserializeObject <Patches>(json);
                    Installer.DeletePreviousPatch(new Action(() =>
                    {
                        State.CurrentState = State.state.Installing;
                        patch.Install();
                        patch.SetRealmlist();
                    }));
                }
            });
        }
 public static async void Install(this Patches patch)
 {
     if (patch == null)
     {
         return;
     }
     for (int i = 0; i < patch.patches.Count; i++)
     {
         Patch pth = patch.patches[i];
         await Task.Run(async() =>
         {
             using (WebClient wc = new WebClient())
             {
                 wc.DownloadProgressChanged += (s, g) =>
                 {
                     downloadBar?.Dispatcher.BeginInvoke(new Action(() => downloadBar.SetPercent(g.ProgressPercentage, 1f)));
                 };
                 await wc.DownloadFileTaskAsync(pth.Url, $"{Patcher.GetDataPath}{pth.Name}");
                 Debug.WriteLine(pth.Name);
             }
         });
     }
     State.CurrentState = State.state.Ready;
 }