diff --git a/CEMU Mod Importer.sln b/CEMU Mod Importer.sln new file mode 100644 index 0000000..f7b2636 --- /dev/null +++ b/CEMU Mod Importer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29609.76 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CEMU Mod Importer", "CEMU Mod Importer\CEMU Mod Importer.csproj", "{C26CBCF1-9205-45EE-A555-1353E92AEF27}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C26CBCF1-9205-45EE-A555-1353E92AEF27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C26CBCF1-9205-45EE-A555-1353E92AEF27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C26CBCF1-9205-45EE-A555-1353E92AEF27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C26CBCF1-9205-45EE-A555-1353E92AEF27}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {301C8A62-DF9C-4A1F-A600-0E4CD227C02F} + EndGlobalSection +EndGlobal diff --git a/CEMU Mod Importer/App.config b/CEMU Mod Importer/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/CEMU Mod Importer/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CEMU Mod Importer/CEMU Mod Importer.csproj b/CEMU Mod Importer/CEMU Mod Importer.csproj new file mode 100644 index 0000000..d0a642d --- /dev/null +++ b/CEMU Mod Importer/CEMU Mod Importer.csproj @@ -0,0 +1,91 @@ + + + + + Debug + AnyCPU + {C26CBCF1-9205-45EE-A555-1353E92AEF27} + WinExe + CEMU_Mod_Importer + CEMU Mod Importer + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + Form + + + Main.cs + + + + + + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/CEMU Mod Importer/GameInfo.cs b/CEMU Mod Importer/GameInfo.cs new file mode 100644 index 0000000..109f11d --- /dev/null +++ b/CEMU Mod Importer/GameInfo.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace CEMU_Mod_Importer +{ + class GameInfo : IComparable + { + public string Name; + public List Ids = new List(); + + public override string ToString() + { + return Name; + } + public int CompareTo(GameInfo that) + { + if (Name == that.Name) return 0; + List names = new List{ Name, that.Name }; + names.Sort(); + if (names[0] == Name) + return -1; + return 1; + } + } +} \ No newline at end of file diff --git a/CEMU Mod Importer/JSON_importer.cs b/CEMU Mod Importer/JSON_importer.cs new file mode 100644 index 0000000..4731df7 --- /dev/null +++ b/CEMU Mod Importer/JSON_importer.cs @@ -0,0 +1,70 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; + +namespace CEMU_Mod_Importer +{ + class GameInfoJSON + { + public string titleID; + public string titleKey; + public string name; + public string region; + public string ticket; + } + class JSON_importer + { + private static JSON_importer instance = null; + private static readonly object padlock = new object(); + + public static JSON_importer Instance + { + get + { + lock (padlock) + { + if (instance == null) + { + instance = new JSON_importer(); + } + return instance; + } + } + } + public List gameInfos = new List(); + public void Import(string JSONfile) + { + GameInfoJSON[] infoJSON = JsonConvert.DeserializeObject(JSONfile); + + foreach (GameInfoJSON gameInfoJSON in infoJSON) + { + if (gameInfoJSON.name == null) + continue; + gameInfoJSON.name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(gameInfoJSON.name.ToLower()); + bool added = false; + if(gameInfoJSON.titleID[7] == '0') + { + foreach (GameInfo info in gameInfos) + { + if(info.Name == gameInfoJSON.name) + { + info.Ids.Add(gameInfoJSON.titleID + " [" + gameInfoJSON.region + "]"); + added = true; + break; + } + } + if (added == false) + { + GameInfo gameInfo = new GameInfo(); + gameInfo.Name = gameInfoJSON.name; + gameInfo.Ids.Add(gameInfoJSON.titleID + " [" + gameInfoJSON.region + "]"); + gameInfos.Add(gameInfo); + } + } + } + gameInfos.Sort(); + } + } +} diff --git a/CEMU Mod Importer/Main.Designer.cs b/CEMU Mod Importer/Main.Designer.cs new file mode 100644 index 0000000..98d5566 --- /dev/null +++ b/CEMU Mod Importer/Main.Designer.cs @@ -0,0 +1,268 @@ +namespace CEMU_Mod_Importer +{ + partial class Main + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.NewModButton = new System.Windows.Forms.Button(); + this.NameBox = new System.Windows.Forms.TextBox(); + this.DescriptionBox = new System.Windows.Forms.RichTextBox(); + this.TitleIdBox = new System.Windows.Forms.TextBox(); + this.CEMU_path = new System.Windows.Forms.OpenFileDialog(); + this.CEMU_path_button = new System.Windows.Forms.Button(); + this.FsPriority = new System.Windows.Forms.NumericUpDown(); + this.FsPriorityBox = new System.Windows.Forms.TextBox(); + this.GameNameTextbox = new System.Windows.Forms.TextBox(); + this.ImportGameInfoButton = new System.Windows.Forms.Button(); + this.TitlekeysJSON_path = new System.Windows.Forms.OpenFileDialog(); + this.GameDropdown = new System.Windows.Forms.ComboBox(); + this.DragDrop = new System.Windows.Forms.TextBox(); + this.ClearModFiles = new System.Windows.Forms.Button(); + this.Debug = new System.Windows.Forms.RichTextBox(); + ((System.ComponentModel.ISupportInitialize)(this.FsPriority)).BeginInit(); + this.SuspendLayout(); + // + // NewModButton + // + this.NewModButton.Location = new System.Drawing.Point(12, 12); + this.NewModButton.Name = "NewModButton"; + this.NewModButton.Size = new System.Drawing.Size(75, 23); + this.NewModButton.TabIndex = 0; + this.NewModButton.Text = "Export Mod"; + this.NewModButton.UseVisualStyleBackColor = true; + this.NewModButton.Click += new System.EventHandler(this.NewModButton_Click); + // + // NameBox + // + this.NameBox.BackColor = System.Drawing.Color.Gray; + this.NameBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.NameBox.Location = new System.Drawing.Point(12, 41); + this.NameBox.Name = "NameBox"; + this.NameBox.Size = new System.Drawing.Size(75, 20); + this.NameBox.TabIndex = 1; + this.NameBox.Text = "Mod name"; + this.NameBox.TextChanged += new System.EventHandler(this.NameBox_TextChanged); + // + // DescriptionBox + // + this.DescriptionBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.DescriptionBox.BackColor = System.Drawing.Color.Gray; + this.DescriptionBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.DescriptionBox.Location = new System.Drawing.Point(12, 67); + this.DescriptionBox.Name = "DescriptionBox"; + this.DescriptionBox.Size = new System.Drawing.Size(776, 74); + this.DescriptionBox.TabIndex = 2; + this.DescriptionBox.Text = "Description"; + this.DescriptionBox.TextChanged += new System.EventHandler(this.DescriptionBox_TextChanged); + // + // TitleIdBox + // + this.TitleIdBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TitleIdBox.BackColor = System.Drawing.Color.Gray; + this.TitleIdBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TitleIdBox.Location = new System.Drawing.Point(93, 41); + this.TitleIdBox.Name = "TitleIdBox"; + this.TitleIdBox.Size = new System.Drawing.Size(476, 20); + this.TitleIdBox.TabIndex = 3; + this.TitleIdBox.Text = "Titleids seperated by ,"; + this.TitleIdBox.TextChanged += new System.EventHandler(this.TitleIdBox_TextChanged); + // + // CEMU_path + // + this.CEMU_path.FileName = "cemu.exe"; + this.CEMU_path.Filter = "cemu|cemu.exe"; + // + // CEMU_path_button + // + this.CEMU_path_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.CEMU_path_button.Location = new System.Drawing.Point(677, 12); + this.CEMU_path_button.Name = "CEMU_path_button"; + this.CEMU_path_button.Size = new System.Drawing.Size(111, 23); + this.CEMU_path_button.TabIndex = 4; + this.CEMU_path_button.Text = "Set CEMU Location"; + this.CEMU_path_button.UseVisualStyleBackColor = true; + this.CEMU_path_button.Click += new System.EventHandler(this.CEMU_path_button_Click); + // + // FsPriority + // + this.FsPriority.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.FsPriority.BackColor = System.Drawing.Color.Lime; + this.FsPriority.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.FsPriority.Location = new System.Drawing.Point(93, 147); + this.FsPriority.Maximum = new decimal(new int[] { + 1661992959, + 1808227885, + 5, + 0}); + this.FsPriority.Name = "FsPriority"; + this.FsPriority.Size = new System.Drawing.Size(75, 20); + this.FsPriority.TabIndex = 5; + this.FsPriority.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.FsPriority.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // FsPriorityBox + // + this.FsPriorityBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.FsPriorityBox.BackColor = System.Drawing.Color.Lime; + this.FsPriorityBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.FsPriorityBox.Location = new System.Drawing.Point(12, 147); + this.FsPriorityBox.Name = "FsPriorityBox"; + this.FsPriorityBox.ReadOnly = true; + this.FsPriorityBox.Size = new System.Drawing.Size(75, 20); + this.FsPriorityBox.TabIndex = 6; + this.FsPriorityBox.Text = "Priority"; + // + // GameNameTextbox + // + this.GameNameTextbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.GameNameTextbox.BackColor = System.Drawing.Color.Gray; + this.GameNameTextbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.GameNameTextbox.Location = new System.Drawing.Point(575, 41); + this.GameNameTextbox.Name = "GameNameTextbox"; + this.GameNameTextbox.Size = new System.Drawing.Size(213, 20); + this.GameNameTextbox.TabIndex = 7; + this.GameNameTextbox.Text = "Game Name"; + this.GameNameTextbox.TextChanged += new System.EventHandler(this.GameNameTextbox_TextChanged); + // + // ImportGameInfoButton + // + this.ImportGameInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ImportGameInfoButton.Location = new System.Drawing.Point(575, 12); + this.ImportGameInfoButton.Name = "ImportGameInfoButton"; + this.ImportGameInfoButton.Size = new System.Drawing.Size(96, 23); + this.ImportGameInfoButton.TabIndex = 8; + this.ImportGameInfoButton.Text = "Import Game Info"; + this.ImportGameInfoButton.UseVisualStyleBackColor = true; + this.ImportGameInfoButton.Click += new System.EventHandler(this.ImportGameInfoButton_Click); + // + // TitlekeysJSON_path + // + this.TitlekeysJSON_path.FileName = "titlekeys.json"; + this.TitlekeysJSON_path.Filter = "titlekeys|*.json"; + // + // GameDropdown + // + this.GameDropdown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.GameDropdown.FormattingEnabled = true; + this.GameDropdown.Location = new System.Drawing.Point(174, 14); + this.GameDropdown.Name = "GameDropdown"; + this.GameDropdown.Size = new System.Drawing.Size(395, 21); + this.GameDropdown.TabIndex = 9; + this.GameDropdown.SelectedIndexChanged += new System.EventHandler(this.GameDropdown_SelectedIndexChanged); + // + // DragDrop + // + this.DragDrop.AllowDrop = true; + this.DragDrop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.DragDrop.Location = new System.Drawing.Point(174, 147); + this.DragDrop.Name = "DragDrop"; + this.DragDrop.ReadOnly = true; + this.DragDrop.Size = new System.Drawing.Size(497, 20); + this.DragDrop.TabIndex = 10; + this.DragDrop.Text = "Drop mod folder on me (the folder containing \"meta/content/aoc\")"; + this.DragDrop.DragDrop += new System.Windows.Forms.DragEventHandler(this.DragDrop_DragDrop); + this.DragDrop.DragEnter += new System.Windows.Forms.DragEventHandler(this.DragDrop_DragEnter); + // + // ClearModFiles + // + this.ClearModFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ClearModFiles.Location = new System.Drawing.Point(677, 147); + this.ClearModFiles.Name = "ClearModFiles"; + this.ClearModFiles.Size = new System.Drawing.Size(111, 20); + this.ClearModFiles.TabIndex = 11; + this.ClearModFiles.Text = "Clear list"; + this.ClearModFiles.UseVisualStyleBackColor = true; + this.ClearModFiles.Click += new System.EventHandler(this.ClearModFiles_Click); + // + // Debug + // + this.Debug.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Debug.Location = new System.Drawing.Point(12, 173); + this.Debug.Name = "Debug"; + this.Debug.ReadOnly = true; + this.Debug.Size = new System.Drawing.Size(776, 265); + this.Debug.TabIndex = 12; + this.Debug.Text = ""; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(29)))), ((int)(((byte)(29))))); + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.Debug); + this.Controls.Add(this.ClearModFiles); + this.Controls.Add(this.DragDrop); + this.Controls.Add(this.GameDropdown); + this.Controls.Add(this.ImportGameInfoButton); + this.Controls.Add(this.GameNameTextbox); + this.Controls.Add(this.FsPriorityBox); + this.Controls.Add(this.FsPriority); + this.Controls.Add(this.CEMU_path_button); + this.Controls.Add(this.TitleIdBox); + this.Controls.Add(this.DescriptionBox); + this.Controls.Add(this.NameBox); + this.Controls.Add(this.NewModButton); + this.Name = "Main"; + this.Text = "CEMU Mod Importer"; + ((System.ComponentModel.ISupportInitialize)(this.FsPriority)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button NewModButton; + private System.Windows.Forms.TextBox NameBox; + private System.Windows.Forms.RichTextBox DescriptionBox; + private System.Windows.Forms.TextBox TitleIdBox; + private System.Windows.Forms.OpenFileDialog CEMU_path; + private System.Windows.Forms.Button CEMU_path_button; + private System.Windows.Forms.NumericUpDown FsPriority; + private System.Windows.Forms.TextBox FsPriorityBox; + private System.Windows.Forms.TextBox GameNameTextbox; + private System.Windows.Forms.Button ImportGameInfoButton; + private System.Windows.Forms.OpenFileDialog TitlekeysJSON_path; + private System.Windows.Forms.ComboBox GameDropdown; + private System.Windows.Forms.TextBox DragDrop; + private System.Windows.Forms.Button ClearModFiles; + private System.Windows.Forms.RichTextBox Debug; + } +} + diff --git a/CEMU Mod Importer/Main.cs b/CEMU Mod Importer/Main.cs new file mode 100644 index 0000000..8e7c0e4 --- /dev/null +++ b/CEMU Mod Importer/Main.cs @@ -0,0 +1,186 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace CEMU_Mod_Importer +{ + public partial class Main : Form + { + Mod CurrentMod = new Mod(); + string[] titleids; + int wrongids = 0; + bool CEMU_Set = false; + public Main() + { + InitializeComponent(); + } + + private void NewModButton_Click(object sender, EventArgs e) + { + if (CurrentMod.Name == null || CurrentMod.TitleIds == null || CurrentMod.Description == null) + return; + if (CEMU_Set == false) + { + if (CEMU_path.ShowDialog() != DialogResult.OK) + return; + } + if(wrongids != 0) + { + return; + } + string ModRules = $"[Definition]\ntitleIds = {string.Join(", ", CurrentMod.TitleIds)}\nname = {CurrentMod.Name}\npath = \"{GameNameTextbox.Text}\\Mods\\{CurrentMod.Name}\ndescription = {CurrentMod.Description}\nversion = {CurrentMod.Version}\nfsPriority = {CurrentMod.fsPriority}"; + Debug.AppendText(ModRules + "\n"); + FileInfo file = new FileInfo(Path.GetDirectoryName(CEMU_path.FileName) + "\\graphicPacks\\mods\\" + GameNameTextbox.Text + " "+ CurrentMod.Name + "\\rules.txt"); + Debug.AppendText(file.FullName); + Directory.CreateDirectory(file.DirectoryName); + File.WriteAllText(file.FullName, ModRules); + foreach (String folder in ModFolders) + { + Copy(folder, file.DirectoryName); + } + } + + private void NameBox_TextChanged(object sender, EventArgs e) + { + CurrentMod.Name = NameBox.Text; + NameBox.BackColor = Color.FromArgb(0x00, 0xff, 0x00); + } + + private void DescriptionBox_TextChanged(object sender, EventArgs e) + { + CurrentMod.Description = DescriptionBox.Text; + DescriptionBox.BackColor = Color.FromArgb(0x00, 0xff, 0x00); + } + + private void TitleIdBox_TextChanged(object sender, EventArgs e) + { + titleids = Regex.Replace(TitleIdBox.Text, @"\ \[[^[\]]*\]", "").Replace(" ", "").Split(','); + wrongids = 0; + foreach (string titleid in titleids) + { + if (titleid.Length != 16) + { + wrongids++; + } + } + if (wrongids == 0) + { + CurrentMod.TitleIds = titleids; + TitleIdBox.BackColor = Color.FromArgb(0x00, 0xff, 0x00); + } + else if (wrongids != 0 && wrongids != titleids.Length) + { + TitleIdBox.BackColor = Color.FromArgb(0xf4, 0x65, 0x00); + } + else if (wrongids == titleids.Length) + { + TitleIdBox.BackColor = Color.FromArgb(0xff, 0x00, 0x00); + } + } + + private void CEMU_path_button_Click(object sender, EventArgs e) + { + CEMU_Set = CEMU_path.ShowDialog() == DialogResult.OK; + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + CurrentMod.fsPriority = Convert.ToInt32(FsPriority.Value); + } + + private void ImportGameInfoButton_Click(object sender, EventArgs e) + { + TitlekeysJSON_path.ShowDialog(); + if (File.Exists(TitlekeysJSON_path.FileName)) + { + JSON_importer.Instance.Import(File.ReadAllText(TitlekeysJSON_path.FileName)); + foreach (GameInfo item in JSON_importer.Instance.gameInfos) + { + GameDropdown.Items.Add(item); + } + } + } + + private void GameDropdown_SelectedIndexChanged(object sender, EventArgs e) + { + GameInfo selected = (GameInfo)GameDropdown.SelectedItem; + TitleIdBox.Text = string.Join(",", selected.Ids); + GameNameTextbox.Text = selected.Name; + } + + public List ModFolders = new List(); + private void DragDrop_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + private void DragDrop_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + + foreach (string file in files) + { + if (Directory.Exists(file)) + { + if(!ModFolders.Contains(file)) + ModFolders.Add(file); + } + } + DragDrop.Text = string.Join(", ", ModFolders); + DragDrop.BackColor = Color.FromArgb(0x00, 0xff, 0x00); + } + } + + private void ClearModFiles_Click(object sender, EventArgs e) + { + ModFolders.Clear(); + DragDrop.Text = "Drop mod folder on me (the folder containing \"meta / content / aoc\")"; + DragDrop.BackColor = Color.FromArgb(0xFF, 0x00, 0x00); + } + + private void GameNameTextbox_TextChanged(object sender, EventArgs e) + { + GameNameTextbox.BackColor = Color.FromArgb(0x00, 0xff, 0x00); + } + + public static void Copy(string sourceDirectory, string targetDirectory) + { + DirectoryInfo diSource = new DirectoryInfo(sourceDirectory); + DirectoryInfo diTarget = new DirectoryInfo(targetDirectory); + + CopyAll(diSource, diTarget); + } + + public static void CopyAll(DirectoryInfo source, DirectoryInfo target) + { + Directory.CreateDirectory(target.FullName); + + // Copy each file into the new directory. + foreach (FileInfo fi in source.GetFiles()) + { + fi.CopyTo(Path.Combine(target.FullName, fi.Name), true); + } + + // Copy each subdirectory using recursion. + foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) + { + DirectoryInfo nextTargetSubDir = + target.CreateSubdirectory(diSourceSubDir.Name); + CopyAll(diSourceSubDir, nextTargetSubDir); + } + } + } +} diff --git a/CEMU Mod Importer/Main.resx b/CEMU Mod Importer/Main.resx new file mode 100644 index 0000000..4588aa8 --- /dev/null +++ b/CEMU Mod Importer/Main.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 132, 17 + + \ No newline at end of file diff --git a/CEMU Mod Importer/Mod.cs b/CEMU Mod Importer/Mod.cs new file mode 100644 index 0000000..a559505 --- /dev/null +++ b/CEMU Mod Importer/Mod.cs @@ -0,0 +1,12 @@ +namespace CEMU_Mod_Importer +{ + class Mod + { + public string Name; + public string[] TitleIds; + public string Path; + public string Description; + public int Version = 3; + public int fsPriority = 100; + } +} diff --git a/CEMU Mod Importer/Program.cs b/CEMU Mod Importer/Program.cs new file mode 100644 index 0000000..3b83186 --- /dev/null +++ b/CEMU Mod Importer/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CEMU_Mod_Importer +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} diff --git a/CEMU Mod Importer/Properties/AssemblyInfo.cs b/CEMU Mod Importer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8506610 --- /dev/null +++ b/CEMU Mod Importer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CEMU Mod Importer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CEMU Mod Importer")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c26cbcf1-9205-45ee-a555-1353e92aef27")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CEMU Mod Importer/Properties/Resources.Designer.cs b/CEMU Mod Importer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..6293a69 --- /dev/null +++ b/CEMU Mod Importer/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CEMU_Mod_Importer.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CEMU_Mod_Importer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/CEMU Mod Importer/Properties/Resources.resx b/CEMU Mod Importer/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/CEMU Mod Importer/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CEMU Mod Importer/Properties/Settings.Designer.cs b/CEMU Mod Importer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..cdbc194 --- /dev/null +++ b/CEMU Mod Importer/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CEMU_Mod_Importer.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/CEMU Mod Importer/Properties/Settings.settings b/CEMU Mod Importer/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/CEMU Mod Importer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CEMU Mod Importer/packages.config b/CEMU Mod Importer/packages.config new file mode 100644 index 0000000..a9de8b5 --- /dev/null +++ b/CEMU Mod Importer/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index 4ffbda7..9496bcd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # CEMU Mod Importer - This program converts a mod to a CEMU graphics pack + This program converts a mod to a CEMU graphics pack \ No newline at end of file