From 1e695eff804f9fa28e051ed03582e91da421e914 Mon Sep 17 00:00:00 2001 From: Scighost Date: Mon, 16 Sep 2024 20:47:46 +0800 Subject: [PATCH] clean code --- src/Starward.Core/EnumExtension.cs | 49 ------------------ .../SelfQuery/SelfQueryTpyeEnumExtension.cs | 50 +++++++++++++++++++ ...oApiException.cs => miHoYoApiException.cs} | 0 ...ihoyoApiWrapper.cs => miHoYoApiWrapper.cs} | 0 4 files changed, 50 insertions(+), 49 deletions(-) create mode 100644 src/Starward.Core/SelfQuery/SelfQueryTpyeEnumExtension.cs rename src/Starward.Core/{MihoyoApiException.cs => miHoYoApiException.cs} (100%) rename src/Starward.Core/{MihoyoApiWrapper.cs => miHoYoApiWrapper.cs} (100%) diff --git a/src/Starward.Core/EnumExtension.cs b/src/Starward.Core/EnumExtension.cs index 43697aa69..2845d6888 100644 --- a/src/Starward.Core/EnumExtension.cs +++ b/src/Starward.Core/EnumExtension.cs @@ -1,5 +1,4 @@ using Starward.Core.Launcher; -using Starward.Core.SelfQuery; using System.ComponentModel; using System.Reflection; @@ -36,52 +35,4 @@ public static string ToLocalization(this PostType postType) }; } - - - public static string ToLocalization(this GenshinQueryType genshinQueryType) - { - return genshinQueryType switch - { - GenshinQueryType.Crystal => CoreLang.GenshinQueryType_GenesisCrystal, - GenshinQueryType.Primogem => CoreLang.GenshinQueryType_Primogem, - GenshinQueryType.Resin => CoreLang.GenshinQueryType_OriginalResin, - GenshinQueryType.Artifact => CoreLang.GenshinQueryType_Artifact, - GenshinQueryType.Weapon => CoreLang.GenshinQueryType_Weapon, - _ => "", - }; - } - - - - public static string ToLocalization(this StarRailQueryType starRailQueryType) - { - return starRailQueryType switch - { - StarRailQueryType.Stellar => CoreLang.StarRailQueryType_StellarJade, - StarRailQueryType.Dreams => CoreLang.StarRailQueryType_OneiricShared, - StarRailQueryType.Relic => CoreLang.StarRailQueryType_Relic, - StarRailQueryType.Cone => CoreLang.StarRailQueryType_LightCone, - StarRailQueryType.Power => CoreLang.StarRailQueryType_TrailblazePower, - _ => "", - }; - } - - - - public static string ToLocalization(this ZZZQueryType zZZQueryType) - { - return zZZQueryType switch - { - ZZZQueryType.Monochrome => CoreLang.ZZZQueryType_Monochrome, - ZZZQueryType.Ploychrome => CoreLang.ZZZQueryType_Ploychrome, - ZZZQueryType.PurchaseGift => CoreLang.ZZZQueryType_Bundle, - ZZZQueryType.Battery => CoreLang.ZZZQueryType_BatteryCharge, - ZZZQueryType.Engine => CoreLang.ZZZQueryType_WEngine, - ZZZQueryType.Disk => CoreLang.ZZZQueryType_DriveDisc, - _ => "", - }; - } - - - } diff --git a/src/Starward.Core/SelfQuery/SelfQueryTpyeEnumExtension.cs b/src/Starward.Core/SelfQuery/SelfQueryTpyeEnumExtension.cs new file mode 100644 index 000000000..5b9c554fb --- /dev/null +++ b/src/Starward.Core/SelfQuery/SelfQueryTpyeEnumExtension.cs @@ -0,0 +1,50 @@ +namespace Starward.Core.SelfQuery; + +public static class SelfQueryTpyeEnumExtension +{ + + public static string ToLocalization(this GenshinQueryType genshinQueryType) + { + return genshinQueryType switch + { + GenshinQueryType.Crystal => CoreLang.GenshinQueryType_GenesisCrystal, + GenshinQueryType.Primogem => CoreLang.GenshinQueryType_Primogem, + GenshinQueryType.Resin => CoreLang.GenshinQueryType_OriginalResin, + GenshinQueryType.Artifact => CoreLang.GenshinQueryType_Artifact, + GenshinQueryType.Weapon => CoreLang.GenshinQueryType_Weapon, + _ => "", + }; + } + + + + public static string ToLocalization(this StarRailQueryType starRailQueryType) + { + return starRailQueryType switch + { + StarRailQueryType.Stellar => CoreLang.StarRailQueryType_StellarJade, + StarRailQueryType.Dreams => CoreLang.StarRailQueryType_OneiricShared, + StarRailQueryType.Relic => CoreLang.StarRailQueryType_Relic, + StarRailQueryType.Cone => CoreLang.StarRailQueryType_LightCone, + StarRailQueryType.Power => CoreLang.StarRailQueryType_TrailblazePower, + _ => "", + }; + } + + + + public static string ToLocalization(this ZZZQueryType zZZQueryType) + { + return zZZQueryType switch + { + ZZZQueryType.Monochrome => CoreLang.ZZZQueryType_Monochrome, + ZZZQueryType.Ploychrome => CoreLang.ZZZQueryType_Ploychrome, + ZZZQueryType.PurchaseGift => CoreLang.ZZZQueryType_Bundle, + ZZZQueryType.Battery => CoreLang.ZZZQueryType_BatteryCharge, + ZZZQueryType.Engine => CoreLang.ZZZQueryType_WEngine, + ZZZQueryType.Disk => CoreLang.ZZZQueryType_DriveDisc, + _ => "", + }; + } + +} \ No newline at end of file diff --git a/src/Starward.Core/MihoyoApiException.cs b/src/Starward.Core/miHoYoApiException.cs similarity index 100% rename from src/Starward.Core/MihoyoApiException.cs rename to src/Starward.Core/miHoYoApiException.cs diff --git a/src/Starward.Core/MihoyoApiWrapper.cs b/src/Starward.Core/miHoYoApiWrapper.cs similarity index 100% rename from src/Starward.Core/MihoyoApiWrapper.cs rename to src/Starward.Core/miHoYoApiWrapper.cs