示例#1
0
        /// <summary>
        /// Handler for clicking extract selected file.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">EventArgs data</param>
        private void SelectedFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.destFile) || fileType == CompressedFileType.Unknown)
            {
                return;
            }

            string         filename       = null;
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "TQ files (*.txt;*.dbr;*.tex;*.msh;*.anm;*.fnt;*.qst;*.pfx;*.ssh)|*.txt;*.dbr;*.tex;*.msh;*.anm;*.fnt;*.qst;*.pfx;*.ssh|All files (*.*)|*.*";
            saveFileDialog.FilterIndex      = 1;
            saveFileDialog.RestoreDirectory = true;
            saveFileDialog.Title            = "Save the Titan Quest File";
            string startPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "My Games"), "Titan Quest");

            saveFileDialog.InitialDirectory = startPath;
            saveFileDialog.FileName         = Path.GetFileName(this.destFile);

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                filename = saveFileDialog.FileName;
            }

            if (fileType == CompressedFileType.ArzFile)
            {
                DBRecordCollectionProvider.Write(this.record, Path.GetDirectoryName(filename), Path.GetFileName(filename));
            }
            else if (fileType == CompressedFileType.ArcFile)
            {
                arcFile.Write(Path.GetDirectoryName(filename), this.destFile, Path.GetFileName(filename));
            }
        }