diff --git a/.gitignore b/.gitignore index d86707f..b820aee 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ tools/*_log.txt tools/temp web debug +tools/meta-generator/obj +tools/meta-generator/bin diff --git a/tools/Meta/curationclub.meta b/tools/Meta/curationclub.meta new file mode 100644 index 0000000..b785abe --- /dev/null +++ b/tools/Meta/curationclub.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=60552 +fileID=350066 \ No newline at end of file diff --git a/tools/Meta/openmwplayer.meta b/tools/Meta/openmwplayer.meta new file mode 100644 index 0000000..975e086 --- /dev/null +++ b/tools/Meta/openmwplayer.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=morrowind +modID=52345 +fileID=1000041309 \ No newline at end of file diff --git a/tools/Meta/pluginfinder.meta b/tools/Meta/pluginfinder.meta new file mode 100644 index 0000000..772af4b --- /dev/null +++ b/tools/Meta/pluginfinder.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=59869 +fileID=448756 \ No newline at end of file diff --git a/tools/Meta/profilesync.meta b/tools/Meta/profilesync.meta new file mode 100644 index 0000000..07b7b57 --- /dev/null +++ b/tools/Meta/profilesync.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=60690 +fileID=461278 \ No newline at end of file diff --git a/tools/Meta/reinstaller.meta b/tools/Meta/reinstaller.meta new file mode 100644 index 0000000..849c239 --- /dev/null +++ b/tools/Meta/reinstaller.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=59292 +fileID=461962 \ No newline at end of file diff --git a/tools/Meta/rootbuilder.meta b/tools/Meta/rootbuilder.meta new file mode 100644 index 0000000..e336a33 --- /dev/null +++ b/tools/Meta/rootbuilder.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=31720 +fileID=460345 \ No newline at end of file diff --git a/tools/Meta/shortcutter.meta b/tools/Meta/shortcutter.meta new file mode 100644 index 0000000..075495d --- /dev/null +++ b/tools/Meta/shortcutter.meta @@ -0,0 +1,5 @@ +[General] +installed=true +gameName=skyrimse +modID=59827 +fileID=461963 \ No newline at end of file diff --git a/tools/MetaGenerator.exe b/tools/MetaGenerator.exe new file mode 100644 index 0000000..b35029b Binary files /dev/null and b/tools/MetaGenerator.exe differ diff --git a/tools/MetaGenerator.pdb b/tools/MetaGenerator.pdb new file mode 100644 index 0000000..f28bb8f Binary files /dev/null and b/tools/MetaGenerator.pdb differ diff --git a/tools/Plugins.json b/tools/Plugins.json new file mode 100644 index 0000000..7abd3c7 --- /dev/null +++ b/tools/Plugins.json @@ -0,0 +1,44 @@ +[ + { + "PluginId": "rootbuilder", + "GameId": "skyrimspecialedition", + "NexusId": 31720, + "MO2Game": "skyrimse" + }, + { + "PluginId": "reinstaller", + "GameId": "skyrimspecialedition", + "NexusId": 59292, + "MO2Game": "skyrimse" + }, + { + "PluginId": "shortcutter", + "GameId": "skyrimspecialedition", + "NexusId": 59827, + "MO2Game": "skyrimse" + }, + { + "PluginId": "pluginfinder", + "GameId": "skyrimspecialedition", + "NexusId": 59869, + "MO2Game": "skyrimse" + }, + { + "PluginId": "curationclub", + "GameId": "skyrimspecialedition", + "NexusId": 60552, + "MO2Game": "skyrimse" + }, + { + "PluginId": "profilesync", + "GameId": "skyrimspecialedition", + "NexusId": 60690, + "MO2Game": "skyrimse" + }, + { + "PluginId": "openmwplayer", + "GameId": "morrowind", + "NexusId": 52345, + "MO2Game": "morrowind" + } +] \ No newline at end of file diff --git a/tools/meta-generator/MetaGenerator.csproj b/tools/meta-generator/MetaGenerator.csproj new file mode 100644 index 0000000..3d6bae4 --- /dev/null +++ b/tools/meta-generator/MetaGenerator.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + PreserveNewest + + + + diff --git a/tools/meta-generator/MetaGenerator.csproj.user b/tools/meta-generator/MetaGenerator.csproj.user new file mode 100644 index 0000000..595e2dd --- /dev/null +++ b/tools/meta-generator/MetaGenerator.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>D:\Repos\ModOrganizer-Plugins\tools\meta-generator\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/tools/meta-generator/MetaGenerator.sln b/tools/meta-generator/MetaGenerator.sln new file mode 100644 index 0000000..8690d63 --- /dev/null +++ b/tools/meta-generator/MetaGenerator.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetaGenerator", "MetaGenerator.csproj", "{D5001B49-8F4D-497C-8137-40A0CFDF7CB0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5001B49-8F4D-497C-8137-40A0CFDF7CB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5001B49-8F4D-497C-8137-40A0CFDF7CB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5001B49-8F4D-497C-8137-40A0CFDF7CB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5001B49-8F4D-497C-8137-40A0CFDF7CB0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {32435DAB-024E-49A7-BB61-DA7F13E2AAAB} + EndGlobalSection +EndGlobal diff --git a/tools/meta-generator/Plugins.json b/tools/meta-generator/Plugins.json new file mode 100644 index 0000000..7abd3c7 --- /dev/null +++ b/tools/meta-generator/Plugins.json @@ -0,0 +1,44 @@ +[ + { + "PluginId": "rootbuilder", + "GameId": "skyrimspecialedition", + "NexusId": 31720, + "MO2Game": "skyrimse" + }, + { + "PluginId": "reinstaller", + "GameId": "skyrimspecialedition", + "NexusId": 59292, + "MO2Game": "skyrimse" + }, + { + "PluginId": "shortcutter", + "GameId": "skyrimspecialedition", + "NexusId": 59827, + "MO2Game": "skyrimse" + }, + { + "PluginId": "pluginfinder", + "GameId": "skyrimspecialedition", + "NexusId": 59869, + "MO2Game": "skyrimse" + }, + { + "PluginId": "curationclub", + "GameId": "skyrimspecialedition", + "NexusId": 60552, + "MO2Game": "skyrimse" + }, + { + "PluginId": "profilesync", + "GameId": "skyrimspecialedition", + "NexusId": 60690, + "MO2Game": "skyrimse" + }, + { + "PluginId": "openmwplayer", + "GameId": "morrowind", + "NexusId": 52345, + "MO2Game": "morrowind" + } +] \ No newline at end of file diff --git a/tools/meta-generator/Program.cs b/tools/meta-generator/Program.cs new file mode 100644 index 0000000..28c2024 --- /dev/null +++ b/tools/meta-generator/Program.cs @@ -0,0 +1,43 @@ +using Newtonsoft.Json; +using System.Text.RegularExpressions; + +namespace MetaGenerator +{ + internal class Program + { + public static string FileIdRegex = $"file_id=(?[0-9]*)"; + public class Plugin + { + public string PluginId { get; set; } + public string GameId { get; set; } + public int NexusId { get; set; } + public string MO2Game { get; set; } + } + + static void Main(string[] args) + { + var json = Path.GetFullPath("Plugins.json"); + var dest = Path.GetFullPath("Meta"); + if (!Directory.Exists(dest)) Directory.CreateDirectory(dest); + if (File.Exists(json)) + { + Console.WriteLine("Reading Plugins.json"); + var text = File.ReadAllText(json); + var plugins = JsonConvert.DeserializeObject>(text); + foreach (var plugin in plugins) + { + Console.WriteLine($"Generating meta file for {plugin.PluginId}"); + using var client = new HttpClient(); + var res = client.GetAsync($"https://www.nexusmods.com/{plugin.GameId}/mods/{plugin.NexusId}?tab=files").Result; + var html = res.Content.ReadAsStringAsync().Result; + var match = Regex.Match(html, FileIdRegex); + var fileId = match.Groups["fileId"].Value; + var metaString = $"[General]\ninstalled=true\ngameName={plugin.MO2Game}\nmodID={plugin.NexusId}\nfileID={fileId}"; + File.WriteAllText(Path.Combine(dest, $"{plugin.PluginId}.meta"), metaString); + } + } + } + } + + +} diff --git a/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml b/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..329e217 --- /dev/null +++ b/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,19 @@ + + + + + Release + Any CPU + ..\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + true + true + false + false + + \ No newline at end of file diff --git a/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml.user b/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..c161d50 --- /dev/null +++ b/tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2024-01-17T23:50:21.3986473Z;True|2024-01-17T23:50:04.9398037+00:00;True|2024-01-17T23:49:12.9538402+00:00;True|2024-01-17T23:44:49.7712607+00:00; + + + \ No newline at end of file