Example #1
0
        /// <summary>
        /// Creates and writes the mod information to a text file at the specified path
        /// </summary>
        /// <param name="categoriesData"></param>
        /// <param name="directoryPath"></param>
        public void GenerateReadMeAtPath(CategoriesData categoriesData, string directoryPath)
        {
            if (!Directory.Exists(directoryPath))
            {
                _ = Directory.CreateDirectory(directoryPath);
            }

            // Create contents and write them to readme file
            File.WriteAllLines(Path.Combine(directoryPath, "README.txt"), new string[]
            {
                "Mod ID: #" + Id.ToString(),
                "Category: " + categoriesData.GetCategoryById(GameId).Title,
                "Name: " + Name,
                "System Type: " + string.Join(", ", Firmwares),
                "Mod Type: " + Type,
                "Version: " + Version,
                "Region: " + string.Join(", ", GameRegions),
                "Created By: " + Author,
                "Submitted By: " + SubmittedBy,
                "Game Type: " + string.Join(", ", GameModes),
                "Downloads: " + string.Join(", ", DownloadFiles.Select(x => x.URL)),
                "-------------------------------------------------",
                "Description:\n" + Description
            });
        }
Example #2
0
        /// <summary>
        /// Get the download url specified by the user if there are multiple types
        /// </summary>
        /// <returns>Download Archive URL</returns>
        public DownloadFiles GetDownloadFiles()
        {
            if (DownloadFiles.Count > 1)
            {
                var downloadNames = DownloadFiles.Select(x => x.Name).ToList();
                var downloadName  = DialogExtensions.ShowListInputDialog("Install Downloads", downloadNames);

                if (string.IsNullOrEmpty(downloadName))
                {
                    return(null);
                }

                return(DownloadFiles.First(x => x.Name.Equals(downloadName)));
            }
            else
            {
                return(DownloadFiles.First());
            }
        }