Ejemplo n.º 1
0
        private async void TsmiReDownload_Click(object sender, EventArgs e)
        {
            try {
                var existingIDs = ContentUtil.GetSubscribedItems();
                var steamItems  = ConfigWrapper.instance.SteamCache.Items;
                var ids         = steamItems
                                  .Where(item => item.Status.IsBroken() && existingIDs.Contains(item.PublishedFileId))
                                  .Select(item => item.ID)
                                  .Concat(ContentUtil.GetMissingDirItems()) // missing root dir
                                  .Distinct()
                                  .ToArray();
                SteamUtil.ReDownload(ids);

                var res = MessageBox.Show(
                    "You can monitor download progress in steam client. Wait for steam to finish downloading. Then press OK to refresh everything.\n" +
                    "should this not work the first time please try again", "Wait for download");
                ConfigWrapper.instance.CSCache.MissingDir             = new ulong[0];
                LoadOrderWindow.Instance.DownloadWarningLabel.Visible = false;
                foreach (var item in steamItems)
                {
                    if (item.Status.IsBroken() && item.DTO != null)
                    {
                        item.RefreshIsUpToDate();
                    }
                }
                await LoadOrderWindow.Instance.ReloadAll(); // reload to fix included/excluded, paths, ...
            } catch (Exception ex) { ex.Log(); }
        }