forked from Kezyma/ModOrganizer-Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ tools/*_log.txt | |
tools/temp | ||
web | ||
debug | ||
tools/meta-generator/obj | ||
tools/meta-generator/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=60552 | ||
fileID=350066 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=morrowind | ||
modID=52345 | ||
fileID=1000041309 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=59869 | ||
fileID=448756 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=60690 | ||
fileID=461278 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=59292 | ||
fileID=461962 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=31720 | ||
fileID=460345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[General] | ||
installed=true | ||
gameName=skyrimse | ||
modID=59827 | ||
fileID=461963 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Plugins.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_LastSelectedProfileId>D:\Repos\ModOrganizer-Plugins\tools\meta-generator\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Newtonsoft.Json; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace MetaGenerator | ||
{ | ||
internal class Program | ||
{ | ||
public static string FileIdRegex = $"file_id=(?<fileId>[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<List<Plugin>>(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); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
19 changes: 19 additions & 0 deletions
19
tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>..\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
<PublishTrimmed>false</PublishTrimmed> | ||
</PropertyGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
tools/meta-generator/Properties/PublishProfiles/FolderProfile.pubxml.user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<History>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;</History> | ||
<LastFailureDetails /> | ||
</PropertyGroup> | ||
</Project> |