Exemple #1
0
        private void VerifyPath(LauncherPath path, bool throwErrors)
        {
            bool exists = Directory.Exists(path.GetFullPath());

            if (throwErrors && !exists)
            {
                throw new DirectoryNotFoundException(path.GetPossiblyRelativePath());
            }

            if (!exists)
            {
                Directory.CreateDirectory(path.GetFullPath());
            }
        }
Exemple #2
0
        private bool HandleGameFileIWad(IGameFile gameFile, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory)
        {
            try
            {
                using (ZipArchive za = ZipFile.OpenRead(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
                {
                    ZipArchiveEntry zae         = za.Entries.First();
                    string          extractFile = Path.Combine(tempDirectory.GetFullPath(), zae.Name);
                    if (ExtractFiles)
                    {
                        zae.ExtractToFile(extractFile, true);
                    }

                    sb.Append(string.Format(" -iwad \"{0}\" ", extractFile));
                }
            }
            catch (FileNotFoundException)
            {
                LastError = string.Format("File not found: {0}", gameFile.FileName);
                return(false);
            }
            catch
            {
                LastError = string.Format("There was an issue with the IWad: {0}. Corrupted file?", gameFile.FileName);
                return(false);
            }

            return(true);
        }
Exemple #3
0
 private void VerifyPath(LauncherPath path, bool throwErrors)
 {
     if (throwErrors && !Directory.Exists(path.GetFullPath()))
     {
         throw new DirectoryNotFoundException(path.GetPossiblyRelativePath());
     }
 }
Exemple #4
0
        private List <string> GetFilesFromGameFileSettings(IGameFile gameFile, LauncherPath gameFileDirectory, LauncherPath tempDirectory, bool checkSpecific, string[] extensions)
        {
            List <string> files = new List <string>();

            using (ZipArchive za = ZipFile.OpenRead(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
            {
                var entries = za.Entries.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.Contains('.') &&
                                               extensions.Any(y => y.Equals(Path.GetExtension(x.Name), StringComparison.OrdinalIgnoreCase)));

                foreach (ZipArchiveEntry zae in entries)
                {
                    bool useFile = true;

                    if (checkSpecific && SpecificFiles != null && SpecificFiles.Length > 0)
                    {
                        useFile = SpecificFiles.Contains(zae.FullName);
                    }

                    if (useFile)
                    {
                        string extractFile = Path.Combine(tempDirectory.GetFullPath(), zae.Name);
                        if (ExtractFiles)
                        {
                            zae.ExtractToFile(extractFile, true);
                        }
                        files.Add(extractFile);
                    }
                }
            }

            return(files);
        }
        private void SetGridTask()
        {
            m_filePaths.Clear();

            foreach (IGameFile gameFile in m_gameFiles)
            {
                string file = Path.Combine(m_directory.GetFullPath(), gameFile.FileName);
                if (!File.Exists(file))
                {
                    continue;
                }

                IArchiveReader reader;
                if (Path.GetExtension(file).Equals(".zip", StringComparison.OrdinalIgnoreCase))
                {
                    reader = new ZipArchiveReader(file);
                }
                else
                {
                    reader = new FileArchiveReader(file);
                }

                using (reader)
                {
                    if (m_ct.IsCancellationRequested)
                    {
                        break;
                    }

                    try
                    {
                        if (m_specificFiles == null || m_specificFiles.Length == 0)
                        {
                            HandleDefaultSelection(file, reader);
                        }
                        else
                        {
                            foreach (IArchiveEntry entry in reader.Entries)
                            {
                                if (!string.IsNullOrEmpty(entry.Name))
                                {
                                    if (m_ct.IsCancellationRequested)
                                    {
                                        break;
                                    }
                                    HandleAddItem(file, entry.FullName, entry.Name, m_specificFiles.Contains(entry.FullName));
                                }
                            }
                        }
                    }
                    catch
                    {
                        //this is laziness, sometimes it throws an exception when the form is closing in the middle of loading. But were closing the form so who cares
                    }
                }
            }
        }
Exemple #6
0
        public static List <IFileData> CreateFileAssociation(IWin32Window parent, IDataSourceAdapter adapter, LauncherPath directory, FileType type, IGameFile gameFile,
                                                             ISourcePortData sourcePort, bool multiSelect = false)
        {
            List <IFileData> fileDataList = new List <IFileData>();
            OpenFileDialog   dialog       = new OpenFileDialog();

            dialog.Multiselect = multiSelect;

            if (dialog.ShowDialog(parent) == DialogResult.OK)
            {
                bool isMultiImport = dialog.FileNames.Length > 1;

                FileDetailsEditForm detailsForm = new FileDetailsEditForm();
                detailsForm.Initialize(adapter);
                detailsForm.StartPosition = FormStartPosition.CenterParent;
                detailsForm.ShowDescription(!isMultiImport);
                if (sourcePort != null)
                {
                    detailsForm.SourcePort = sourcePort;
                }
                if (!isMultiImport)
                {
                    detailsForm.Description = Path.GetFileName(dialog.FileNames[0]);
                }

                if (detailsForm.ShowDialog(parent) == DialogResult.OK && detailsForm.SourcePort != null)
                {
                    foreach (string file in dialog.FileNames)
                    {
                        FileInfo  fi       = new FileInfo(file);
                        IFileData fileData = CreateNewFileDataSource(detailsForm, fi, type, gameFile);
                        if (isMultiImport)
                        {
                            fileData.Description = Path.GetFileName(file);
                        }

                        fi.CopyTo(Path.Combine(directory.GetFullPath(), fileData.FileName));

                        adapter.InsertFile(fileData);
                        var fileSearch = adapter.GetFiles(gameFile, type).FirstOrDefault(x => x.FileName == fileData.FileName);
                        if (fileSearch != null)
                        {
                            fileData = fileSearch;
                        }
                        fileDataList.Add(fileData);
                    }
                }
                else if (detailsForm.SourcePort == null)
                {
                    MessageBox.Show(parent, "A source port must be selected.", "Error", MessageBoxButtons.OK);
                }
            }

            return(fileDataList);
        }
        public override bool Equals(object obj)
        {
            LauncherPath path = obj as LauncherPath;

            if (path != null)
            {
                return(GetFullPath() == path.GetFullPath());
            }

            return(false);
        }
Exemple #8
0
        private void browseButton_Click(object sender, EventArgs e)
        {
            LauncherPath        path   = new LauncherPath(this.m_gameFileDirectory.Text);
            FolderBrowserDialog dialog = new FolderBrowserDialog {
                SelectedPath = path.GetFullPath()
            };

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                this.m_gameFileDirectory.Text = new LauncherPath(dialog.SelectedPath).GetPossiblyRelativePath();
            }
        }
Exemple #9
0
        private IArchiveReader CreateArchiveReader(IGameFile gameFile, LauncherPath gameFileDirectory)
        {
            string file = Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName);

            // If the unmanaged file is a pk3 then ArchiveReader.Create will read it as a zip and try to unpack
            // Return FileArchiveReader instead so the pk3 will be added as a file
            // Zip extensions are ignored in this case since Doom Launcher's base functionality revovles around reading zip contents
            // SpecificFilesForm will also read zip files explicitly to allow user to select files in the archive
            if (gameFile.IsUnmanaged() && !Path.GetExtension(gameFile.FileName).Equals(".zip", StringComparison.OrdinalIgnoreCase))
            {
                return(new FileArchiveReader(file));
            }

            return(ArchiveReader.Create(file));
        }
Exemple #10
0
        private List <string> GetFilesFromGameFileSettings(IGameFile gameFile, LauncherPath gameFileDirectory, LauncherPath tempDirectory,
                                                           bool checkSpecific, string[] extensions)
        {
            List <string> files = new List <string>();

            using (IArchiveReader reader = CreateArchiveReader(gameFile, gameFileDirectory))
            {
                IEnumerable <IArchiveEntry> entries;
                if (checkSpecific && SpecificFiles != null && SpecificFiles.Length > 0)
                {
                    entries = reader.Entries;
                }
                else
                {
                    entries = reader.Entries.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.Contains('.') &&
                                                   extensions.Any(y => y.Equals(Path.GetExtension(x.Name), StringComparison.OrdinalIgnoreCase)));
                }

                foreach (IArchiveEntry entry in entries)
                {
                    bool useFile = true;
                    if (checkSpecific && SpecificFiles != null && SpecificFiles.Length > 0)
                    {
                        useFile = SpecificFiles.Contains(entry.FullName);
                    }

                    if (useFile)
                    {
                        if (entry.ExtractRequired)
                        {
                            string extractFile = Path.Combine(tempDirectory.GetFullPath(), entry.Name);
                            if (ExtractFiles)
                            {
                                entry.ExtractToFile(extractFile, true);
                            }
                            files.Add(extractFile);
                        }
                        else
                        {
                            files.Add(entry.FullName);
                        }
                    }
                }
            }

            return(files);
        }
        private void SetGridTask()
        {
            m_filePaths.Clear();

            foreach (IGameFile gameFile in m_gameFiles)
            {
                string file = Path.Combine(m_directory.GetFullPath(), gameFile.FileName);
                if (!File.Exists(file))
                {
                    continue;
                }

                using (ZipArchive za = ZipFile.OpenRead(file))
                {
                    if (m_ct.IsCancellationRequested)
                    {
                        break;
                    }

                    try
                    {
                        if (m_specificFiles == null || m_specificFiles.Length == 0)
                        {
                            HandleDefaultSelection(file, za);
                        }
                        else
                        {
                            foreach (ZipArchiveEntry zae in za.Entries)
                            {
                                if (!string.IsNullOrEmpty(zae.Name))
                                {
                                    if (m_ct.IsCancellationRequested)
                                    {
                                        break;
                                    }
                                    HandleAddItem(file, zae.FullName, zae.Name, m_specificFiles.Contains(zae.FullName));
                                }
                            }
                        }
                    }
                    catch
                    {
                        //this is laziness, sometimes it throws an exception when the form is closing in the middle of loading. But were closing the form so who cares
                    }
                }
            }
        }
Exemple #12
0
 private bool HandleGameFileIWad(IGameFileDataSource gameFile, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory)
 {
     try
     {
         using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
         {
             ZipArchiveEntry source = archive.Entries.First <ZipArchiveEntry>();
             string          destinationFileName = Path.Combine(tempDirectory.GetFullPath(), source.Name);
             source.ExtractToFile(destinationFileName, true);
             sb.Append($" -iwad " { destinationFileName } " ");
         }
     }
     catch
     {
         this.LastError = $"There was an issue with the IWad: {gameFile.FileName}";
         return(false);
     }
     return(true);
 }
Exemple #13
0
        private bool HandleGameFileIWad(IGameFile gameFile, ISourcePort sourcePort, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory)
        {
            try
            {
                using (ZipArchive za = ZipFile.OpenRead(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
                {
                    ZipArchiveEntry zae         = za.Entries.First();
                    string          extractFile = Path.Combine(tempDirectory.GetFullPath(), zae.Name);
                    if (ExtractFiles)
                    {
                        if (File.Exists(extractFile))
                        {
                            TrySetFileAttributes(extractFile);
                        }
                        zae.ExtractToFile(extractFile, true);
                    }

                    sb.Append(sourcePort.IwadParameter(new SpData(extractFile, gameFile, AdditionalFiles)));
                }
            }
            catch (FileNotFoundException)
            {
                LastError = string.Format("File not found: {0}", gameFile.FileName);
                return(false);
            }
            catch (IOException)
            {
                LastError = string.Format("File in use: {0}", gameFile.FileName);
                return(false);
            }
            catch (UnauthorizedAccessException)
            {
                LastError = string.Format("Could not overwrite temporary file: {0}", gameFile.FileName);
                return(false);
            }
            catch (Exception)
            {
                LastError = string.Format("There was an issue with the IWad: {0}. Corrupted file?", gameFile.FileName);
                return(false);
            }

            return(true);
        }
Exemple #14
0
        private bool HandleGameFileIWad(IGameFile gameFile, ISourcePort sourcePort, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory)
        {
            try
            {
                using (IArchiveReader reader = ArchiveReader.Create(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
                {
                    IArchiveEntry entry       = reader.Entries.First();
                    string        extractFile = Path.Combine(tempDirectory.GetFullPath(), entry.Name);
                    if (ExtractFiles && entry.ExtractRequired)
                    {
                        entry.ExtractToFile(extractFile, true);
                    }

                    if (!entry.ExtractRequired)
                    {
                        extractFile = entry.FullName;
                    }

                    sb.Append(sourcePort.IwadParameter(new SpData(extractFile, gameFile, AdditionalFiles)));
                }
            }
            catch (FileNotFoundException)
            {
                LastError = string.Format("File not found: {0}", gameFile.FileName);
                return(false);
            }
            catch (IOException)
            {
                LastError = string.Format("File in use: {0}", gameFile.FileName);
                return(false);
            }
            catch (Exception)
            {
                LastError = string.Format("There was an issue with the IWad: {0}. Corrupted file?", gameFile.FileName);
                return(false);
            }

            return(true);
        }
Exemple #15
0
        //This function is currently only used for loading files by utility (which also uses ISourcePort).
        //This uses Util.ExtractTempFile to avoid extracting files with the same name where the user can have the previous file locked.
        //E.g. opening MAP01 from a pk3, and then opening another MAP01 from a different pk3
        public bool HandleGameFile(IGameFile gameFile, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory,
                                   ISourcePort sourcePort, List <SpecificFilesForm.SpecificFilePath> pathFiles)
        {
            try
            {
                List <string> files = new List <string>();

                foreach (var pathFile in pathFiles)
                {
                    if (File.Exists(pathFile.ExtractedFile))
                    {
                        using (ZipArchive za = ZipFile.OpenRead(pathFile.ExtractedFile))
                        {
                            var entry = za.Entries.FirstOrDefault(x => x.FullName == pathFile.InternalFilePath);
                            if (entry != null)
                            {
                                files.Add(Util.ExtractTempFile(tempDirectory.GetFullPath(), entry));
                            }
                        }
                    }
                }

                BuildLaunchString(sb, sourcePort, files);
            }
            catch (FileNotFoundException)
            {
                LastError = string.Format("The game file was not found: {0}", gameFile.FileName);
                return(false);
            }
            catch (InvalidDataException)
            {
                LastError = string.Format("The game file does not appear to be a valid zip file: {0}", gameFile.FileName);
                return(false);
            }

            return(true);
        }
Exemple #16
0
        public string GetLaunchParameters(LauncherPath gameFileDirectory, LauncherPath tempDirectory,
                                          IGameFile gameFile, ISourcePort sourcePort, bool isGameFileIwad)
        {
            StringBuilder sb = new StringBuilder();

            List <IGameFile> loadFiles = AdditionalFiles.ToList();

            if (isGameFileIwad)
            {
                loadFiles.Remove(gameFile);
            }
            else if (!loadFiles.Contains(gameFile))
            {
                loadFiles.Add(gameFile);
            }

            if (IWad != null)
            {
                if (!AssertFile(gameFileDirectory.GetFullPath(), gameFile.FileName, "game file"))
                {
                    return(null);
                }
                if (!HandleGameFileIWad(IWad, sb, gameFileDirectory, tempDirectory))
                {
                    return(null);
                }
            }

            List <string> launchFiles = new List <string>();

            foreach (IGameFile loadFile in loadFiles)
            {
                if (!AssertFile(gameFileDirectory.GetFullPath(), loadFile.FileName, "game file"))
                {
                    return(null);
                }
                if (!HandleGameFile(loadFile, launchFiles, gameFileDirectory, tempDirectory, sourcePort, true))
                {
                    return(null);
                }
            }

            string[] extensions = sourcePort.SupportedExtensions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            launchFiles = SortParameters(launchFiles, extensions).ToList();

            BuildLaunchString(sb, sourcePort, launchFiles);

            if (Map != null)
            {
                sb.Append(BuildWarpParamter(Map));

                if (Skill != null)
                {
                    sb.Append(string.Format(" -skill {0}", Skill));
                }
            }

            if (Record)
            {
                RecordedFileName = Path.Combine(tempDirectory.GetFullPath(), Guid.NewGuid().ToString());
                sb.Append(string.Format(" -record \"{0}\"", RecordedFileName));
            }

            if (PlayDemo && PlayDemoFile != null)
            {
                if (!AssertFile(PlayDemoFile, "", "demo file"))
                {
                    return(null);
                }
                sb.Append(string.Format(" -playdemo \"{0}\"", PlayDemoFile));
            }

            if (ExtraParameters != null)
            {
                sb.Append(" " + ExtraParameters);
            }

            if (!string.IsNullOrEmpty(sourcePort.ExtraParameters))
            {
                sb.Append(" " + sourcePort.ExtraParameters);
            }

            return(sb.ToString());
        }
Exemple #17
0
        public string GetLaunchParameters(LauncherPath gameFileDirectory, LauncherPath tempDirectory, IGameFileDataSource gameFile, ISourcePortDataSource sourcePort, bool isGameFileIwad)
        {
            StringBuilder sb = new StringBuilder();
            List <IGameFileDataSource> list = this.AdditionalFiles.ToList <IGameFileDataSource>();

            if (isGameFileIwad)
            {
                list.Remove(gameFile);
            }
            if (this.AdditionalFiles != null)
            {
                foreach (IGameFileDataSource source in this.AdditionalFiles)
                {
                    if (!this.AssertFile(gameFileDirectory.GetFullPath(), source.FileName, "game file"))
                    {
                        return(null);
                    }
                    if (!this.HandleGameFile(source, sb, gameFileDirectory, tempDirectory, sourcePort, true))
                    {
                        return(null);
                    }
                }
            }
            if (this.IWad != null)
            {
                if (!this.AssertFile(gameFileDirectory.GetFullPath(), gameFile.FileName, "game file"))
                {
                    return(null);
                }
                if (!this.HandleGameFileIWad(this.IWad, sb, gameFileDirectory, tempDirectory))
                {
                    return(null);
                }
            }
            if (this.Map != null)
            {
                sb.Append($" -warp {BuildWarpParamter(this.Map)}");
                if (this.Skill != null)
                {
                    sb.Append($" -skill {this.Skill}");
                }
            }
            if (this.Record)
            {
                this.RecordedFileName = Path.Combine(tempDirectory.GetFullPath(), Guid.NewGuid().ToString());
                sb.Append($" -record " { this.RecordedFileName } "");
            }
            if (this.PlayDemo && (this.PlayDemoFile != null))
            {
                if (!this.AssertFile(this.PlayDemoFile, "", "demo file"))
                {
                    return(null);
                }
                sb.Append($" -playdemo " { this.PlayDemoFile } "");
            }
            if (this.ExtraParameters != null)
            {
                sb.Append(" " + this.ExtraParameters);
            }
            return(sb.ToString());
        }
Exemple #18
0
 private bool HandleGameFile(IGameFileDataSource gameFile, StringBuilder sb, LauncherPath gameFileDirectory, LauncherPath tempDirectory, ISourcePortDataSource sourcePort, bool checkSpecific)
 {
     try
     {
         char[]        separator  = new char[] { ',' };
         string[]      extensions = sourcePort.SupportedExtensions.Split(separator, StringSplitOptions.RemoveEmptyEntries);
         List <string> parameters = new List <string>();
         using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(gameFileDirectory.GetFullPath(), gameFile.FileName)))
         {
             foreach (ZipArchiveEntry entry in from item in archive.Entries
                      where (!string.IsNullOrEmpty(item.Name) && item.Name.Contains <char>('.')) && extensions.Any <string>(x => x.Equals(new FileInfo(item.Name).Extension, StringComparison.OrdinalIgnoreCase))
                      select item)
             {
                 bool flag = true;
                 if ((checkSpecific && (this.SpecificFiles != null)) && (this.SpecificFiles.Length != 0))
                 {
                     flag = this.SpecificFiles.Contains <string>(entry.Name);
                 }
                 if (flag)
                 {
                     string destinationFileName = Path.Combine(tempDirectory.GetFullPath(), entry.Name);
                     entry.ExtractToFile(destinationFileName, true);
                     parameters.Add(destinationFileName);
                 }
             }
         }
         parameters = this.SortParameters(parameters, extensions).ToList <string>();
         string[]      source = new string[] { ".deh", ".bex" };
         List <string> list2  = new List <string>();
         if (parameters.Count > 0)
         {
             sb.Append(" -file ");
             foreach (string str2 in parameters)
             {
                 FileInfo info = new FileInfo(str2);
                 if (!source.Contains <string>(info.Extension.ToLower()))
                 {
                     sb.Append($"" { str2 } " ");
                 }
                 else
                 {
                     list2.Add(str2);
                 }
             }
         }
         if (list2.Count > 0)
         {
             sb.Append(" -deh ");
             foreach (string str3 in list2)
             {
                 sb.Append($"" { str3 } " ");
             }
         }
     }
     catch (FileNotFoundException exception1)
     {
         string message = exception1.Message;
         this.LastError = $"The game file was not found: {gameFile.FileName}";
         return(false);
     }
     catch (InvalidDataException exception2)
     {
         string text2 = exception2.Message;
         this.LastError = $"The game file does not appear to be a valid zip file: {gameFile.FileName}";
         return(false);
     }
     return(true);
 }
Exemple #19
0
        public string GetLaunchParameters(LauncherPath gameFileDirectory, LauncherPath tempDirectory,
                                          IGameFile gameFile, ISourcePortData sourcePortData, bool isGameFileIwad)
        {
            ISourcePort   sourcePort = SourcePortUtil.CreateSourcePort(sourcePortData);
            StringBuilder sb         = new StringBuilder();

            List <IGameFile> loadFiles = AdditionalFiles.ToList();

            if (isGameFileIwad)
            {
                loadFiles.Remove(gameFile);
            }
            else if (!loadFiles.Contains(gameFile))
            {
                loadFiles.Add(gameFile);
            }

            if (IWad != null)
            {
                if (!AssertFile(gameFileDirectory.GetFullPath(), gameFile.FileName, "game file"))
                {
                    return(null);
                }
                if (!HandleGameFileIWad(IWad, sourcePort, sb, gameFileDirectory, tempDirectory))
                {
                    return(null);
                }
            }

            List <string> launchFiles = new List <string>();

            foreach (IGameFile loadFile in loadFiles)
            {
                if (!AssertFile(gameFileDirectory.GetFullPath(), loadFile.FileName, "game file"))
                {
                    return(null);
                }
                if (!HandleGameFile(loadFile, launchFiles, gameFileDirectory, tempDirectory, sourcePortData, true))
                {
                    return(null);
                }
            }

            string[] extensions = sourcePortData.SupportedExtensions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            launchFiles = SortParameters(launchFiles, extensions).ToList();

            BuildLaunchString(sb, sourcePort, launchFiles);

            if (Map != null)
            {
                sb.Append(sourcePort.WarpParameter(new SpData(Map)));

                if (Skill != null)
                {
                    sb.Append(sourcePort.SkillParameter(new SpData(Skill)));
                }
            }

            if (Record)
            {
                RecordedFileName = Path.Combine(tempDirectory.GetFullPath(), Guid.NewGuid().ToString());
                sb.Append(sourcePort.RecordParameter(new SpData(RecordedFileName)));
            }

            if (PlayDemo && PlayDemoFile != null)
            {
                if (!AssertFile(PlayDemoFile, "", "demo file"))
                {
                    return(null);
                }
                sb.Append(sourcePort.PlayDemoParameter(new SpData(PlayDemoFile)));
            }

            if (ExtraParameters != null)
            {
                sb.Append(" " + ExtraParameters);
            }

            if (!string.IsNullOrEmpty(sourcePortData.ExtraParameters))
            {
                sb.Append(" " + sourcePortData.ExtraParameters);
            }

            IStatisticsReader statsReader = sourcePort.CreateStatisticsReader(gameFile, new IStatsData[] { });

            if (SaveStatistics && statsReader != null && !string.IsNullOrEmpty(statsReader.LaunchParameter))
            {
                sb.Append(" " + statsReader.LaunchParameter);
            }

            return(sb.ToString());
        }