Skip to content

Commit

Permalink
修改外置模组分类的设置方式
Browse files Browse the repository at this point in the history
模组分类更新 #8
内容模组:
AMerchantsLegend, niko_morePlanetaryConditions, planet_search, secretsofthefrontier, StopGapMeasures3, The_Lengend_Of_Tenshi
派系模组:
jc_asm, star_federation, HMI, HMI_brighton, HMI_SV, mik, Templars, adversary, fairyempire, Mayasuran Navy, Prasrity_Scrap_Master
美化模组:
synDawnSkinPack, BlueArchive Portrait Packv
功能模组:
fast_engine_rendering, leadingPip, speedUp, dynamictariffs, sun_flux_reticle, presmattdamon_takenoprisoners, whichmod, capturecrew
闲杂模组:
stop_remove_dmod, ly_this_is_trash
  • Loading branch information
Hakoyu authored and Hakoyu committed May 6, 2023
1 parent 4845046 commit c725294
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
31 changes: 30 additions & 1 deletion Resources/ModTypeGroup.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
"luddenhance",
"swp",
"ApproLightPlus",
"SEEKER"
"SEEKER",
"AMerchantsLegend",
"niko_morePlanetaryConditions",
"planet_search",
"secretsofthefrontier",
"StopGapMeasures3",
"The_Lengend_Of_Tenshi",
]
# 派系模组
"FactionMods" = [
Expand Down Expand Up @@ -54,6 +60,17 @@
"underworld",
"diableavionics",
"shadow_ships",
"jc_asm",
"star_federation",
"HMI",
"HMI_brighton",
"HMI_SV",
"mik",
"Templars",
"adversary",
"fairyempire",
"Mayasuran Navy",
"Prasrity_Scrap_Master",
]
# 美化模组
"BeautifyMods" = [
Expand All @@ -63,6 +80,8 @@
"Touhou Portrait Mod",
"intothebreachportraitpack",
"Gia_Portrait_Pack",
"synDawnSkinPack",
"BlueArchive Portrait Packv",
]
# 功能模组
"UtilityMods" = [
Expand All @@ -86,6 +105,14 @@
"advanced_gunnery_control_dbeaa06e",
"TAR",
"VariantAcknowledged",
"fast_engine_rendering",
"leadingPip",
"speedUp",
"dynamictariffs",
"sun_flux_reticle",
"presmattdamon_takenoprisoners",
"whichmod",
"capturecrew"
]
# 闲杂模组
"MiscellaneousMods" = [
Expand All @@ -110,4 +137,6 @@
"more_hullmods",
"US",
"efficientPop",
"stop_remove_dmod",
"ly_this_is_trash",
]
28 changes: 21 additions & 7 deletions ViewModels/ModManager/ModManagerPageVMController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,21 +775,35 @@ private static void TryGetModTypeGroup(string file)

private static void GetModTypeGroup(string file)
{
CreateModTypeGroup(file);
CheckModTypeGroup(file);
using var sr = new StreamReader(file);
TomlTable table = TOML.Parse(sr);
var table = TOML.Parse(sr);
TomlDeserializer.DeserializeStatic(table, typeof(ModTypeGroup));
}

private static void CreateModTypeGroup(string file)
private static void CheckModTypeGroup(string file)
{
using var resourceStream = ResourceDictionary
.GetResourceStream(ResourceDictionary.ModTypeGroup_toml)
.BaseStream;
if (File.Exists(file) is false)
{
using var sw = new StreamWriter(file);
ResourceDictionary
.GetResourceStream(ResourceDictionary.ModTypeGroup_toml)
.BaseStream.CopyTo(sw.BaseStream);
CreateModTypeGroup(file, resourceStream);
}
else
{
var fileInfo = new FileInfo(file);
if (resourceStream.Length != fileInfo.Length)
{
CreateModTypeGroup(file, resourceStream);
}
}
}

private static void CreateModTypeGroup(string file, Stream resourceStream)
{
using var sw = new StreamWriter(file);
resourceStream.CopyTo(sw.BaseStream);
}

#endregion TypeGroup
Expand Down

0 comments on commit c725294

Please sign in to comment.