コード例 #1
0
ファイル: FMain.cs プロジェクト: gagho0/yeahhhhhhh
        private void MnuFileOpenLocal_Click(object sender, EventArgs e)
        {
            ofd.CheckFileExists              = true;
            ofd.DereferenceLinks             = true;
            ofd.Filter                       = "Asset Database (*.data)|*.data";
            ofd.Multiselect                  = false;
            ofd.ReadOnlyChecked              = false;
            ofd.ShowReadOnly                 = false;
            ofd.SupportMultiDottedExtensions = true;
            ofd.ValidateNames                = true;

            var r = ofd.ShowDialog(this);

            if (r == DialogResult.Cancel)
            {
                return;
            }

            var filePath = ofd.FileName;
            var data     = File.ReadAllBytes(filePath);

            var b = AssetInfoList.TryParse(data, out var assetInfoList);

            if (!b)
            {
                var message = $"'{filePath}' is not a valid asset database file.";
                MessageBox.Show(message, ApplicationHelper.GetApplicationTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Debug.Assert(assetInfoList != null);

            var opening = ManifestOpening.Local(filePath);

            var form = new FManifest(assetInfoList, opening, null);

            form.MdiParent = this;

            form.Show();
        }
コード例 #2
0
ファイル: FMain.cs プロジェクト: gagho0/yeahhhhhhh
        private async void MnuFileOpenRemote_Click(object sender, EventArgs e)
        {
            var(r, config) = FManifestDownload.ShowModal(this);

            if (r == DialogResult.Cancel)
            {
                return;
            }

            Debug.Assert(config != null);

            byte[] assetInfoListData;

            try {
                assetInfoListData = await TDDownloader.DownloadData(config.ResourceVersion, config.ManifestAssetName);
            } catch (Exception ex) {
                MessageBox.Show(ex.ToString(), ApplicationHelper.GetApplicationTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var b = AssetInfoList.TryParse(assetInfoListData, out var assetInfoList);

            if (!b)
            {
                const string message = "Received data is not a valid asset database file.";
                MessageBox.Show(message, ApplicationHelper.GetApplicationTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Debug.Assert(assetInfoList != null);

            var opening = ManifestOpening.Remote(config.ResourceVersion, config.IsLatest);

            var form = new FManifest(assetInfoList, opening, config);

            form.MdiParent = this;

            form.Show();
        }
コード例 #3
0
ファイル: FMain.cs プロジェクト: gagho0/yeahhhhhhh
        private void MnuToolsDiff_Click(object sender, EventArgs e)
        {
            var children = MdiChildren;

            if (children.Length < 2)
            {
                return;
            }

            var manifestForms = new FManifest[children.Length];

            for (var i = 0; i < manifestForms.Length; i += 1)
            {
                var form = children[i] as FManifest;

                Debug.Assert(form != null);

                manifestForms[i] = form;
            }

            using (var f = new FDiff(manifestForms)) {
                f.ShowDialog(this);
            }
        }