コード例 #1
0
        /// <summary>
        /// Called when clicking Extrack Pack button, extracts current IPF
        /// file to selected destination.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnExtractPack_Click(object sender, EventArgs e)
        {
            FbdExtractPack.Description         = "Select folder to extract pack to.";
            FbdExtractPack.ShowNewFolderButton = true;

            if (FbdExtractPack.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var extractPath = FbdExtractPack.SelectedPath;

            if (!Directory.Exists(extractPath))
            {
                MessageBox.Show("Directory not found.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ExtractFiles(_openedIpf.Files, extractPath);
        }
コード例 #2
0
        /// <summary>
        /// Called when clicking Extract Client button, extracts selected
        /// TOS client to selected destination.
        /// </summary>
        /// <remarks>
        /// Loads data first, followed by patch, to get the latest version
        /// of all files found.
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnExtractClient_Click(object sender, EventArgs e)
        {
            FbdExtractPack.Description         = "Select TOS folder.";
            FbdExtractPack.ShowNewFolderButton = false;

            if (FbdExtractPack.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var tosPath     = FbdExtractPack.SelectedPath;
            var dataPath    = Path.Combine(tosPath, "data");
            var patchPath   = Path.Combine(tosPath, "patch");
            var releasePath = Path.Combine(tosPath, "release");

            if (!Directory.Exists(dataPath) || !Directory.Exists(patchPath) || !Directory.Exists(releasePath))
            {
                MessageBox.Show("Please select the TOS folder that contains 'data', 'patch', and 'release'.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            FbdExtractPack.Description         = "Select folder to extract to.";
            FbdExtractPack.ShowNewFolderButton = true;

            if (FbdExtractPack.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var extractPath = FbdExtractPack.SelectedPath;

            if (!Directory.Exists(tosPath))
            {
                MessageBox.Show("Directory not found.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var col = new IpfCollection(tosPath);

            ExtractFiles(col.Files.Values, extractPath);
        }