Exemple #1
0
        private void CtxMenuDownloadSelectedAssets_Click(object sender, EventArgs e)
        {
            var selectedIndices      = lvwManifest.SelectedIndices;
            var selectedIndicesCount = selectedIndices.Count;

            if (selectedIndicesCount <= 0)
            {
                return;
            }

            var assetInfoList = new AssetInfo[selectedIndicesCount];

            for (var i = 0; i < selectedIndices.Count; ++i)
            {
                var       hash = lvwManifest.Items[selectedIndices[i]].SubItems[2].Text;
                AssetInfo assetInfo;

                try {
                    assetInfo = _assetInfoList.Assets.SingleOrDefault(ai => ai.ContentHash == hash);
                } catch (InvalidOperationException) {
                    MessageBox.Show($"This should not happen. There are more than one asset having the content hash {hash}.", ApplicationHelper.GetApplicationTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    continue;
                }

                if (assetInfo == null)
                {
                    MessageBox.Show($"This should not happen. There is no asset having the content hash {hash}.", ApplicationHelper.GetApplicationTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    continue;
                }

                assetInfoList[i] = assetInfo;
            }

            FAssetDownload.ShowDownload(assetInfoList, this);
        }
Exemple #2
0
        public static DialogResult ShowDownload(IReadOnlyList <AssetInfo> assetInfoList, IWin32Window owner)
        {
            DialogResult r;

            using (var f = new FAssetDownload()) {
                f._assetInfoList = assetInfoList;
                r = f.ShowDialog(owner);
            }

            return(r);
        }