[RF] AquaMai configuration refactor (#82)

更新了配置文件格式,原有的配置文件将被自动无缝迁移,详情请见新的配置文件中的注释(例外:`SlideJudgeTweak` 不再默认启用)
旧配置文件将被重命名备份,如果更新到此版本遇到 Bug 请联系我们

Updated configuration file schema. The old config file will be migrated automatically and seamlessly. See the comments in the new configuration file for details. (Except for `SlideJudgeTweak` is no longer enabled by default)
Your old configuration file will be renamed as a backup. If you encounter any bug with this version, please contact us.
This commit is contained in:
Menci
2024-11-25 01:25:19 +08:00
committed by GitHub
parent e9ee31b22a
commit 37044dae01
217 changed files with 6051 additions and 3040 deletions

View File

@@ -0,0 +1,32 @@
using System.Globalization;
using System.Resources;
using HarmonyLib;
namespace AquaMai.Core.Resources;
public class I18nSingleAssemblyHook
{
[HarmonyPatch(typeof(ResourceManager), "InternalGetResourceSet", typeof(CultureInfo), typeof(bool), typeof(bool))]
[HarmonyPrefix]
public static bool GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents, ref ResourceSet __result, ResourceManager __instance)
{
var GetResourceFileName = __instance.GetType().GetMethod("GetResourceFileName", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var resourceFileName = (string)GetResourceFileName.Invoke(__instance, [culture]);
var ResourcesAssembly = typeof(I18nSingleAssemblyHook).Assembly;
var manifestResourceStream = ResourcesAssembly.GetManifestResourceStream(resourceFileName);
if (manifestResourceStream == null)
{
return true;
}
var resourceGroveler = __instance.GetType().GetField("resourceGroveler", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(__instance);
var CreateResourceSet = resourceGroveler.GetType().GetMethod("CreateResourceSet", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var resourceSet = CreateResourceSet.Invoke(resourceGroveler, [manifestResourceStream, ResourcesAssembly]);
var AddResourceSet = __instance.GetType().GetMethod("AddResourceSet", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
var localResourceSets = __instance.GetType().GetField("_resourceSets", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(__instance);
object[] args = [localResourceSets, culture.Name, resourceSet];
AddResourceSet.Invoke(null, args);
__result = (ResourceSet)args[2];
return false;
}
}

View File

@@ -0,0 +1,316 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AquaMai.Core.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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()]
public class Locale {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public Locale() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AquaMai.Core.Resources.Locale", typeof(Locale).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues..
/// </summary>
public static string CiBuildAlertContent {
get {
return ResourceManager.GetString("CiBuildAlertContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Important Notice: Test Version.
/// </summary>
public static string CiBuildAlertTitle {
get {
return ResourceManager.GetString("CiBuildAlertTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loaded!.
/// </summary>
public static string Loaded {
get {
return ResourceManager.GetString("Loaded", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Errors detected while loading!
///- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
///- Check for conflicting mods, or enabled incompatible options.
/// </summary>
public static string LoadError {
get {
return ResourceManager.GetString("LoadError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to End.
/// </summary>
public static string MarkRepeatEnd {
get {
return ResourceManager.GetString("MarkRepeatEnd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start.
/// </summary>
public static string MarkRepeatStart {
get {
return ResourceManager.GetString("MarkRepeatStart", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Aime reader error.
/// </summary>
public static string NetErrIsAliveAimeReader {
get {
return ResourceManager.GetString("NetErrIsAliveAimeReader", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Aime server error.
/// </summary>
public static string NetErrIsAliveAimeServer {
get {
return ResourceManager.GetString("NetErrIsAliveAimeServer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Server communication error.
/// </summary>
public static string NetErrIsAliveServer {
get {
return ResourceManager.GetString("NetErrIsAliveServer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Data download not success.
/// </summary>
public static string NetErrWasDownloadSuccessOnce {
get {
return ResourceManager.GetString("NetErrWasDownloadSuccessOnce", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pause.
/// </summary>
public static string Pause {
get {
return ResourceManager.GetString("Pause", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 游玩次数:{0}.
/// </summary>
public static string PlayCount {
get {
return ResourceManager.GetString("PlayCount", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SSS+ =&gt; DXRating += {0}.
/// </summary>
public static string RatingUpWhenSSSp {
get {
return ResourceManager.GetString("RatingUpWhenSSSp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Repeat end time cannot be less than repeat start time.
/// </summary>
public static string RepeatEndTimeLessThenStartTime {
get {
return ResourceManager.GetString("RepeatEndTimeLessThenStartTime", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loop Not Set.
/// </summary>
public static string RepeatNotSet {
get {
return ResourceManager.GetString("RepeatNotSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reset.
/// </summary>
public static string RepeatReset {
get {
return ResourceManager.GetString("RepeatReset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loop Set.
/// </summary>
public static string RepeatStartEndSet {
get {
return ResourceManager.GetString("RepeatStartEndSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loop Start Set.
/// </summary>
public static string RepeatStartSet {
get {
return ResourceManager.GetString("RepeatStartSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please set repeat start time first.
/// </summary>
public static string RepeatStartTimeNotSet {
get {
return ResourceManager.GetString("RepeatStartTimeNotSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Saving... Do not exit the game.
/// </summary>
public static string SavingDontExit {
get {
return ResourceManager.GetString("SavingDontExit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Seek &lt;&lt;.
/// </summary>
public static string SeekBackward {
get {
return ResourceManager.GetString("SeekBackward", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Seek &gt;&gt;.
/// </summary>
public static string SeekForward {
get {
return ResourceManager.GetString("SeekForward", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Skip.
/// </summary>
public static string Skip {
get {
return ResourceManager.GetString("Skip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &gt; Skipping incompatible patch: {0}.
/// </summary>
public static string SkipIncompatiblePatch {
get {
return ResourceManager.GetString("SkipIncompatiblePatch", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Speed.
/// </summary>
public static string Speed {
get {
return ResourceManager.GetString("Speed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Speed -.
/// </summary>
public static string SpeedDown {
get {
return ResourceManager.GetString("SpeedDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Speed Reset.
/// </summary>
public static string SpeedReset {
get {
return ResourceManager.GetString("SpeedReset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Speed +.
/// </summary>
public static string SpeedUp {
get {
return ResourceManager.GetString("SpeedUp", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SeekBackward" xml:space="preserve">
<value>Seek &lt;&lt;</value>
</data>
<data name="SeekForward" xml:space="preserve">
<value>Seek &gt;&gt;</value>
</data>
<data name="Pause" xml:space="preserve">
<value>Pause</value>
</data>
<data name="MarkRepeatStart" xml:space="preserve">
<value>Start</value>
</data>
<data name="MarkRepeatEnd" xml:space="preserve">
<value>End</value>
</data>
<data name="RepeatReset" xml:space="preserve">
<value>Reset</value>
</data>
<data name="RepeatNotSet" xml:space="preserve">
<value>Loop Not Set</value>
</data>
<data name="RepeatStartSet" xml:space="preserve">
<value>Loop Start Set</value>
</data>
<data name="RepeatStartEndSet" xml:space="preserve">
<value>Loop Set</value>
</data>
<data name="SpeedDown" xml:space="preserve">
<value>Speed -</value>
</data>
<data name="SpeedUp" xml:space="preserve">
<value>Speed +</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="SpeedReset" xml:space="preserve">
<value>Speed Reset</value>
</data>
<data name="LoadError" xml:space="preserve">
<value>Errors detected while loading!
- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
- Check for conflicting mods, or enabled incompatible options</value>
</data>
<data name="SavingDontExit" xml:space="preserve">
<value>Saving... Do not exit the game</value>
</data>
<data name="Loaded" xml:space="preserve">
<value>Loaded!</value>
</data>
<data name="NetErrIsAliveServer" xml:space="preserve">
<value>Server communication error</value>
</data>
<data name="NetErrIsAliveAimeReader" xml:space="preserve">
<value>Aime reader error</value>
</data>
<data name="NetErrIsAliveAimeServer" xml:space="preserve">
<value>Aime server error</value>
</data>
<data name="NetErrWasDownloadSuccessOnce" xml:space="preserve">
<value>Data download not success</value>
</data>
<data name="RatingUpWhenSSSp" xml:space="preserve">
<value>SSS+ =&gt; DXRating += {0}</value>
</data>
<data name="Skip" xml:space="preserve">
<value>Skip</value>
</data>
<data name="SkipIncompatiblePatch" xml:space="preserve">
<value>&gt; Skipping incompatible patch: {0}</value>
</data>
<data name="RepeatStartTimeNotSet" xml:space="preserve">
<value>Please set repeat start time first</value>
</data>
<data name="RepeatEndTimeLessThenStartTime" xml:space="preserve">
<value>Repeat end time cannot be less than repeat start time</value>
</data>
<data name="CiBuildAlertTitle" xml:space="preserve">
<value>Important Notice: Test Version</value>
</data>
<data name="CiBuildAlertContent" xml:space="preserve">
<value>You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues.</value>
</data>
<data name="PlayCount" xml:space="preserve">
<value>游玩次数:{0}</value>
</data>
</root>

View File

@@ -0,0 +1,100 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SeekBackward" xml:space="preserve">
<value>倒退 &lt;&lt;</value>
</data>
<data name="SeekForward" xml:space="preserve">
<value>快进 &gt;&gt;</value>
</data>
<data name="Pause" xml:space="preserve">
<value>暂停</value>
</data>
<data name="MarkRepeatEnd" xml:space="preserve">
<value>标记结尾</value>
</data>
<data name="MarkRepeatStart" xml:space="preserve">
<value>标记开头</value>
</data>
<data name="RepeatNotSet" xml:space="preserve">
<value>循环未设定</value>
</data>
<data name="RepeatReset" xml:space="preserve">
<value>循环解除</value>
</data>
<data name="RepeatStartEndSet" xml:space="preserve">
<value>循环已设定</value>
</data>
<data name="RepeatStartSet" xml:space="preserve">
<value>循环开头已设定</value>
</data>
<data name="Speed" xml:space="preserve">
<value>速度</value>
</data>
<data name="SpeedDown" xml:space="preserve">
<value>速度 -</value>
</data>
<data name="SpeedReset" xml:space="preserve">
<value>速度重置</value>
</data>
<data name="SpeedUp" xml:space="preserve">
<value>速度 +</value>
</data>
<data name="LoadError" xml:space="preserve">
<value>加载过程中检测到错误!
- 你是否正在使用魔改的 Assembly-CSharp.dll这会导致函数不一致而无法找到需要修改的函数
- 请检查是否有冲突的 Mod或者开启了不兼容的选项</value>
</data>
<data name="SavingDontExit" xml:space="preserve">
<value>正在保存… 请不要关闭游戏</value>
</data>
<data name="Loaded" xml:space="preserve">
<value>加载完成!</value>
</data>
<data name="NetErrIsAliveServer" xml:space="preserve">
<value>主服务器通信错误</value>
</data>
<data name="NetErrIsAliveAimeReader" xml:space="preserve">
<value>Aime 读卡器错误</value>
</data>
<data name="NetErrIsAliveAimeServer" xml:space="preserve">
<value>AimeDB 通信错误</value>
</data>
<data name="NetErrWasDownloadSuccessOnce" xml:space="preserve">
<value>数据下载不成功</value>
</data>
<data name="RatingUpWhenSSSp" xml:space="preserve">
<value>推到鸟加可上 {0} 分</value>
</data>
<data name="Skip" xml:space="preserve">
<value>跳过</value>
</data>
<data name="SkipIncompatiblePatch" xml:space="preserve">
<value>&gt; 已跳过加载不兼容的功能: {0}</value>
</data>
<data name="RepeatEndTimeLessThenStartTime" xml:space="preserve">
<value>循环结束时间不能早于开始时间</value>
</data>
<data name="RepeatStartTimeNotSet" xml:space="preserve">
<value>请先设置循环开始时间</value>
</data>
<data name="CiBuildAlertTitle" xml:space="preserve">
<value>重要提示:测试版本</value>
</data>
<data name="CiBuildAlertContent" xml:space="preserve">
<value>您正在使用的是 AquaMai CI 构建版本。由于该版本基于最新的主线代码构建,可能包含未通知的配置文件变更或潜在问题。</value>
</data>
<data name="PlayCount" xml:space="preserve">
<value>Play Count: {0}</value>
</data>
</root>