diff --git a/Source/GrasscutterTools/App.config b/Source/GrasscutterTools/App.config index 786f460..2bd8f33 100644 --- a/Source/GrasscutterTools/App.config +++ b/Source/GrasscutterTools/App.config @@ -2,11 +2,11 @@ -
+
- - + + @@ -33,4 +33,4 @@ - + \ No newline at end of file diff --git a/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs b/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs index bf71a00..e4319d2 100644 --- a/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs +++ b/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs @@ -7,12 +7,10 @@ namespace GrasscutterTools.DispatchServer { public static class DispatchServerAPI { - public static async Task QueryServerStatus(string host) { var response = await HttpHelper.GetAsync(host + "/status/server"); return response?.Status; } - } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs b/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs index bcb7477..69920bc 100644 --- a/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs +++ b/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs @@ -1,5 +1,4 @@ - -using Newtonsoft.Json; +using Newtonsoft.Json; namespace GrasscutterTools.DispatchServer.Model { @@ -20,4 +19,4 @@ namespace GrasscutterTools.DispatchServer.Model [JsonProperty("status")] public ServerStatus Status { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/FormGachaBannerEditor.cs b/Source/GrasscutterTools/FormGachaBannerEditor.cs index 36db7c2..ead7257 100644 --- a/Source/GrasscutterTools/FormGachaBannerEditor.cs +++ b/Source/GrasscutterTools/FormGachaBannerEditor.cs @@ -202,7 +202,7 @@ namespace GrasscutterTools foreach (string item in list.CheckedItems) builder.Append(item.Substring(0, item.IndexOf(':'))) .Append(", "); - txt.Text = builder.ToString(0, builder.Length-2); + txt.Text = builder.ToString(0, builder.Length - 2); } } diff --git a/Source/GrasscutterTools/FormMain.cs b/Source/GrasscutterTools/FormMain.cs index b2cdd73..daf8c79 100644 --- a/Source/GrasscutterTools/FormMain.cs +++ b/Source/GrasscutterTools/FormMain.cs @@ -53,7 +53,6 @@ namespace GrasscutterTools SaveSettings(); } - private readonly string[] LanguageNames = new string[] { "简体中文", "English" }; private readonly string[] Languages = new string[] { "zh-CN", "en-US" }; @@ -99,8 +98,8 @@ namespace GrasscutterTools #region - 主页 - + private FormGachaBannerEditor FormGachaBannerEditor; - FormGachaBannerEditor FormGachaBannerEditor; private void BtnOpenGachaBannerEditor_Click(object sender, EventArgs e) { if (FormGachaBannerEditor == null || FormGachaBannerEditor.IsDisposed) @@ -115,7 +114,8 @@ namespace GrasscutterTools } } - FormTextMapBrowser FormTextMapBrowser; + private FormTextMapBrowser FormTextMapBrowser; + private void BtnOpenTextMap_Click(object sender, EventArgs e) { if (FormTextMapBrowser == null || FormTextMapBrowser.IsDisposed) @@ -139,6 +139,7 @@ namespace GrasscutterTools #endregion - 主页 - #region - 自定义 - + private readonly string CustomCommandsFilePath = Path.Combine(Application.LocalUserAppDataPath, "CustomCommands.txt"); private bool CustomCommandsChanged; @@ -155,8 +156,8 @@ namespace GrasscutterTools { FLPCustomCommands.Controls.Clear(); var lines = commands.Split('\n'); - for (int i = 0; i < lines.Length-1; i += 2) - AddCustomCommand(lines[i].Trim(), lines[i+1].Trim()); + for (int i = 0; i < lines.Length - 1; i += 2) + AddCustomCommand(lines[i].Trim(), lines[i + 1].Trim()); } private void SaveCustomCommands() @@ -349,10 +350,9 @@ namespace GrasscutterTools // 限制星级输入范围 NUDArtifactStars.Minimum = GameData.Artifacts.Ids[beginIndex] / 100 % 10; - NUDArtifactStars.Maximum = GameData.Artifacts.Ids[endIndex] / 100 % 10; + NUDArtifactStars.Maximum = GameData.Artifacts.Ids[endIndex] / 100 % 10; - - var parts = GameData.Artifacts.Names.Skip(beginIndex).Take(endIndex-beginIndex+1).Distinct().ToArray(); + var parts = GameData.Artifacts.Names.Skip(beginIndex).Take(endIndex - beginIndex + 1).Distinct().ToArray(); var i = CmbArtifactPart.SelectedIndex; CmbArtifactPart.Items.Clear(); CmbArtifactPart.Items.AddRange(parts); @@ -362,7 +362,8 @@ namespace GrasscutterTools ArtifactInputChanged(sender, e); } - readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙"}; + private readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙" }; + private void CmbArtifactPart_SelectedIndexChanged(object sender, EventArgs e) { if (CmbArtifactPart.SelectedIndex < 0) @@ -386,7 +387,7 @@ namespace GrasscutterTools //var setId = GameData.ArtifactCats.Ids[CmbArtifactSet.SelectedIndex]; //var part = CmbArtifactPart.SelectedIndex+1; //var index = Array.FindLastIndex( - // GameData.Artifacts.Ids, + // GameData.Artifacts.Ids, // it => it / 1000 == setId // 套装ID // //&& it / 100 % 10 == NUDArtifactStars.Value // 星级 // && it / 10 % 10 == part // 部位 @@ -407,7 +408,7 @@ namespace GrasscutterTools foreach (string item in ListSubAttributionChecked.Items) { var subId = item.Substring(0, item.IndexOf(':')).Trim(); - var times = int.Parse(item.Substring(item.LastIndexOf('x')+1)); + var times = int.Parse(item.Substring(item.LastIndexOf('x') + 1)); if (subAttrDir.ContainsKey(subId)) subAttrDir[subId] += times; else @@ -523,8 +524,9 @@ namespace GrasscutterTools #region -- 物品记录 -- - readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt"); - List GiveItemCommands; + private readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt"); + private List GiveItemCommands; + private void InitGiveItemRecord() { if (File.Exists(GiveItemCommandsRecordPath)) @@ -574,7 +576,8 @@ namespace GrasscutterTools ListGiveItemLogs.Items.RemoveAt(ListGiveItemLogs.SelectedIndex); } } - #endregion + + #endregion -- 物品记录 -- #endregion - 物品 - @@ -672,8 +675,9 @@ namespace GrasscutterTools #region -- 生成记录 -- - readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt"); - List SpawnCommands; + private readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt"); + private List SpawnCommands; + private void InitSpawnRecord() { if (File.Exists(SpawnCommandsRecordPath)) @@ -686,6 +690,7 @@ namespace GrasscutterTools SpawnCommands = new List(); } } + private void SaveSpawnRecord() { File.WriteAllText(SpawnCommandsRecordPath, GetCommandsText(SpawnCommands)); @@ -723,7 +728,7 @@ namespace GrasscutterTools } } - #endregion + #endregion -- 生成记录 -- #endregion - 生成 - @@ -775,7 +780,7 @@ namespace GrasscutterTools LblStatPercent.Visible = stat.Percent; LblStatTip.Text = stat.Tip; - SetCommand("/setstats", $"{stat.ArgName} {NUDStat.Value}{(stat.Percent?"%":"")}"); + SetCommand("/setstats", $"{stat.ArgName} {NUDStat.Value}{(stat.Percent ? "%" : "")}"); } private void LnkSetTalentClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -834,7 +839,7 @@ namespace GrasscutterTools } } - #endregion + #endregion - 关于 - #region - 命令 - @@ -897,16 +902,16 @@ namespace GrasscutterTools #region - 命令记录 - - List GetCommands(string commandsText) + private List GetCommands(string commandsText) { var lines = commandsText.Split('\n'); - List commands = new List(lines.Length/2); - for (int i = 0; i < lines.Length-1; i += 2) - commands.Add(new GameCommand(lines[i].Trim(), lines[i+1].Trim())); + List commands = new List(lines.Length / 2); + for (int i = 0; i < lines.Length - 1; i += 2) + commands.Add(new GameCommand(lines[i].Trim(), lines[i + 1].Trim())); return commands; } - string GetCommandsText(List commands) + private string GetCommandsText(List commands) { StringBuilder builder = new StringBuilder(); foreach (var cmd in commands) @@ -917,7 +922,7 @@ namespace GrasscutterTools return builder.ToString(); } - #endregion + #endregion - 命令记录 - #region - 远程 - @@ -1080,7 +1085,6 @@ namespace GrasscutterTools MessageBox.Show(Resources.OpenCommandHelp, Resources.Help, MessageBoxButtons.OK, MessageBoxIcon.Information); } - #endregion - + #endregion - 远程 - } } \ No newline at end of file diff --git a/Source/GrasscutterTools/FormTextMapBrowser.cs b/Source/GrasscutterTools/FormTextMapBrowser.cs index 9bda9a0..d1333a5 100644 --- a/Source/GrasscutterTools/FormTextMapBrowser.cs +++ b/Source/GrasscutterTools/FormTextMapBrowser.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Data; -using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; @@ -150,7 +149,8 @@ namespace GrasscutterTools .Select(kv => new { Hash = kv.Key, Id = kv.Value, Text = data.TextMap[kv.Key] }) .Concat( data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success) - .Select(kv => new { + .Select(kv => new + { Hash = kv.Key, Id = data.ManualTextMap.TryGetValue(kv.Key, out string id) ? id : "", Text = kv.Value @@ -179,6 +179,5 @@ namespace GrasscutterTools if (e.KeyCode == Keys.Enter) BtnSearch_Click(sender, e); } - } } \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Gacha/BannerType.cs b/Source/GrasscutterTools/Game/Gacha/BannerType.cs index 0e693a5..cc46f8c 100644 --- a/Source/GrasscutterTools/Game/Gacha/BannerType.cs +++ b/Source/GrasscutterTools/Game/Gacha/BannerType.cs @@ -1,13 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GrasscutterTools.Game.Gacha +namespace GrasscutterTools.Game.Gacha { public enum BannerType { STANDARD, EVENT, WEAPON } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs b/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs index 0d57b00..544f0a7 100644 --- a/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs +++ b/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs @@ -117,6 +117,5 @@ namespace GrasscutterTools.Game.Gacha /// [JsonProperty("hardPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(90)] public int HardPity { get; set; } = 90; - } } \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/GameCommand.cs b/Source/GrasscutterTools/Game/GameCommand.cs index 2a230c9..9465b67 100644 --- a/Source/GrasscutterTools/Game/GameCommand.cs +++ b/Source/GrasscutterTools/Game/GameCommand.cs @@ -4,12 +4,12 @@ { public GameCommand(string name, string command) { - Name=name; - Command=command; + Name = name; + Command = command; } public string Name { get; set; } public string Command { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/GameData.cs b/Source/GrasscutterTools/Game/GameData.cs index b944086..a76a57c 100644 --- a/Source/GrasscutterTools/Game/GameData.cs +++ b/Source/GrasscutterTools/Game/GameData.cs @@ -52,6 +52,5 @@ namespace GrasscutterTools.Game public static ItemMap Ornaments { get; private set; } public static ItemMap GachaBannerPrefabs { get; private set; } - } } \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/ItemMap.cs b/Source/GrasscutterTools/Game/ItemMap.cs index 638e679..d0b8daf 100644 --- a/Source/GrasscutterTools/Game/ItemMap.cs +++ b/Source/GrasscutterTools/Game/ItemMap.cs @@ -19,7 +19,7 @@ namespace GrasscutterTools.Game var si = line.IndexOf(':'); if (si > 0 && int.TryParse(line.Substring(0, si).Trim(), out int id)) { - var name = line.Substring(si+1).Trim(); + var name = line.Substring(si + 1).Trim(); if (!string.IsNullOrEmpty(name)) { //IdMap[id] = name; @@ -41,17 +41,16 @@ namespace GrasscutterTools.Game //List IdList; //List NameList; - public int Count => Ids.Length; //public string this[int id] => IdMap[id]; - + //public int this[string name] => NameMap[name]; - + public int[] Ids { get; } public string[] Names { get; } public string[] Lines { get; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/SetStatsCommand.cs b/Source/GrasscutterTools/Game/SetStatsCommand.cs index 33a7b6b..90f2601 100644 --- a/Source/GrasscutterTools/Game/SetStatsCommand.cs +++ b/Source/GrasscutterTools/Game/SetStatsCommand.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Text; +using System.Text; using GrasscutterTools.Properties; @@ -13,9 +12,9 @@ namespace GrasscutterTools.Game { public Stat(string name, string argName, bool percent, string tip = "") { - Name=name; - ArgName=argName; - Percent=percent; + Name = name; + ArgName = argName; + Percent = percent; Tip = tip; } diff --git a/Source/GrasscutterTools/Game/TextMapData.cs b/Source/GrasscutterTools/Game/TextMapData.cs index 9adb539..5c1d9b0 100644 --- a/Source/GrasscutterTools/Game/TextMapData.cs +++ b/Source/GrasscutterTools/Game/TextMapData.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Newtonsoft.Json; @@ -22,7 +19,7 @@ namespace GrasscutterTools.Game public string[] TextMapFilePaths; public string[] TextMapFiles; - void LoadManualTextMap(string manualTextMapPath) + private void LoadManualTextMap(string manualTextMapPath) { using (var fs = File.OpenRead(manualTextMapPath)) using (var sr = new StreamReader(fs)) @@ -41,7 +38,7 @@ namespace GrasscutterTools.Game } } - void LoadTextMaps(string textMapDirPath) + private void LoadTextMaps(string textMapDirPath) { TextMapFilePaths = Directory.GetFiles(textMapDirPath, "TextMap*.json"); if (TextMapFilePaths.Length == 0) @@ -65,6 +62,5 @@ namespace GrasscutterTools.Game } } } - } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/MultiLanguage.cs b/Source/GrasscutterTools/MultiLanguage.cs index 27f9e57..9113594 100644 --- a/Source/GrasscutterTools/MultiLanguage.cs +++ b/Source/GrasscutterTools/MultiLanguage.cs @@ -3,9 +3,8 @@ using System.Windows.Forms; namespace GrasscutterTools { - static class MultiLanguage + internal static class MultiLanguage { - public static string DefaultLanguage = "zh-CN"; public static void SetDefaultLanguage(string lang) @@ -16,7 +15,6 @@ namespace GrasscutterTools Properties.Settings.Default.Save(); } - /// /// 加载语言 /// @@ -80,4 +78,4 @@ namespace GrasscutterTools } } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs b/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs index 5c8f89d..b4346d1 100644 --- a/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs +++ b/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs @@ -95,7 +95,6 @@ namespace GrasscutterTools.OpenCommand public object Data { get; set; } } - internal class InvokeException : Exception { public InvokeException(string message) : base(message) @@ -103,4 +102,4 @@ namespace GrasscutterTools.OpenCommand } } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Program.cs b/Source/GrasscutterTools/Program.cs index 329af0d..eef00ce 100644 --- a/Source/GrasscutterTools/Program.cs +++ b/Source/GrasscutterTools/Program.cs @@ -1,22 +1,19 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace GrasscutterTools { - static class Program + internal static class Program { /// /// 应用程序的主入口点。 /// [STAThread] - static void Main() + private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Properties/AssemblyInfo.cs b/Source/GrasscutterTools/Properties/AssemblyInfo.cs index 8f028df..ae66c51 100644 --- a/Source/GrasscutterTools/Properties/AssemblyInfo.cs +++ b/Source/GrasscutterTools/Properties/AssemblyInfo.cs @@ -21,7 +21,7 @@ using System.Runtime.InteropServices; // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("b26333ff-5560-4cba-af3c-4b80db6f8025")] -// 程序集的版本信息由下列四个值组成: +// 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 @@ -32,4 +32,4 @@ using System.Runtime.InteropServices; //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyFileVersion("1.0.0")] \ No newline at end of file diff --git a/Source/GrasscutterTools/Utils/HttpHelper.cs b/Source/GrasscutterTools/Utils/HttpHelper.cs index c3787ad..eb43bd1 100644 --- a/Source/GrasscutterTools/Utils/HttpHelper.cs +++ b/Source/GrasscutterTools/Utils/HttpHelper.cs @@ -10,7 +10,7 @@ namespace GrasscutterTools.Utils { public static class HttpHelper { - static readonly HttpClient httpClient = new HttpClient(); + private static readonly HttpClient httpClient = new HttpClient(); static HttpHelper() { @@ -64,4 +64,4 @@ namespace GrasscutterTools.Utils } } } -} +} \ No newline at end of file