From 2a8cebcbb57ea4f8a71908aa295118caa9ed28bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E5=82=91?= Date: Thu, 24 Aug 2023 15:18:12 +0800 Subject: [PATCH] Clean up all code --- .../DispatchServer/DispatchServerAPI.cs | 2 +- .../DispatchServer/Model/ServerStatus.cs | 4 +- Source/GrasscutterTools/GOOD/Artifact.cs | 2 +- Source/GrasscutterTools/GOOD/Character.cs | 2 +- Source/GrasscutterTools/GOOD/GOOD.cs | 2 +- Source/GrasscutterTools/GOOD/GOODData.cs | 2 +- Source/GrasscutterTools/GOOD/Weapon.cs | 2 +- .../Game/Activity/ActivityConfigItem.cs | 2 +- .../Game/Data/Excels/AchievementData.cs | 23 +++++++- .../Game/Data/Excels/AvatarData.cs | 23 +++++++- .../Game/Data/Excels/DungeonData.cs | 23 +++++++- .../Game/Data/Excels/GadgetData.cs | 25 ++++++--- .../Game/Data/Excels/HomeWorldBgmData.cs | 23 +++++++- .../Data/Excels/HomeWorldFurnitureData.cs | 23 +++++++- .../Game/Data/Excels/MainQuestData.cs | 21 +++++++- .../Game/Data/Excels/MaterialData.cs | 24 ++++++++- .../Game/Data/Excels/MonsterData.cs | 24 ++++++++- .../Game/Data/Excels/QuestData.cs | 23 +++++++- .../Game/Data/Excels/ReliquaryData.cs | 23 +++++++- .../Game/Data/Excels/SceneData.cs | 24 ++++++++- .../Game/Data/Excels/WeaponData.cs | 23 +++++++- .../Game/Data/GameResource.cs | 21 +++++++- .../Game/Data/GameResources.cs | 40 +++++++++----- .../Game/Data/ResourceTypeAttribute.cs | 25 +++++++-- .../Game/Gacha/GachaBanner.cs | 2 +- .../Game/Gacha/GachaBanner2.cs | 2 +- .../Game/Gacha/GachaBanner3.cs | 2 +- Source/GrasscutterTools/Game/GameCommand.cs | 2 +- Source/GrasscutterTools/Game/ItemMap.cs | 2 +- Source/GrasscutterTools/Game/ItemMapGroup.cs | 2 +- Source/GrasscutterTools/Game/Mail/Mail.cs | 2 +- .../Game/Props/ItemUseData.cs | 23 +++++++- .../Game/Props/MonsterType.cs | 24 +++++++-- .../Game/Props/QualityType.cs | 22 +++++++- .../GrasscutterTools/Game/Props/SceneType.cs | 22 +++++++- .../Game/Shop/ShopGoodsData.cs | 2 +- Source/GrasscutterTools/Game/Shop/ShopInfo.cs | 2 +- .../GrasscutterTools/Game/Shop/ShopTable.cs | 2 +- Source/GrasscutterTools/Game/TextMapData.cs | 2 +- .../GrasscutterTools/GrasscutterTools.csproj | 1 + .../GrasscutterTools.licenseheader | 19 +++++++ .../OpenCommand/OpenCommandAPI.cs | 2 +- Source/GrasscutterTools/Pages/PageTools.cs | 36 +++++++------ Source/GrasscutterTools/Utils/AppHotKey.cs | 2 +- Source/GrasscutterTools/Utils/Common.cs | 21 +++++++- Source/GrasscutterTools/Utils/GuiRedirect.cs | 2 +- Source/GrasscutterTools/Utils/HotKeyItem.cs | 2 +- Source/GrasscutterTools/Utils/HttpHelper.cs | 2 +- Source/GrasscutterTools/Utils/KeyGo.cs | 2 +- Source/GrasscutterTools/Utils/Logger.cs | 2 +- Source/GrasscutterTools/Utils/SparseSet.cs | 54 ++++++++++++------- Source/GrasscutterTools/Utils/UIUtil.cs | 2 +- 52 files changed, 547 insertions(+), 119 deletions(-) create mode 100644 Source/GrasscutterTools/GrasscutterTools.licenseheader diff --git a/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs b/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs index 243d44e..b50fa83 100644 --- a/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs +++ b/Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs @@ -24,7 +24,7 @@ using GrasscutterTools.Utils; namespace GrasscutterTools.DispatchServer { - public static class DispatchServerAPI + internal static class DispatchServerAPI { public static async Task QueryServerStatus(string host) { diff --git a/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs b/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs index 7133f8c..5306173 100644 --- a/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs +++ b/Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs @@ -21,7 +21,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.DispatchServer.Model { - public class ServerStatus + internal class ServerStatus { [JsonProperty("playerCount")] public int PlayerCount { get; set; } @@ -33,7 +33,7 @@ namespace GrasscutterTools.DispatchServer.Model public string Version { get; set; } } - public class ServerStatusResponse + internal class ServerStatusResponse { [JsonProperty("retcode")] public int RetCode { get; set; } diff --git a/Source/GrasscutterTools/GOOD/Artifact.cs b/Source/GrasscutterTools/GOOD/Artifact.cs index a78a87f..8dec3d8 100644 --- a/Source/GrasscutterTools/GOOD/Artifact.cs +++ b/Source/GrasscutterTools/GOOD/Artifact.cs @@ -26,7 +26,7 @@ namespace GrasscutterTools.GOOD /// Doc: https://frzyc.github.io/genshin-optimizer/#/doc /// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Artifact.cs /// - public class Artifact + internal class Artifact { /// /// e.g. "GladiatorsFinale" diff --git a/Source/GrasscutterTools/GOOD/Character.cs b/Source/GrasscutterTools/GOOD/Character.cs index 93b2c1f..e10fe50 100644 --- a/Source/GrasscutterTools/GOOD/Character.cs +++ b/Source/GrasscutterTools/GOOD/Character.cs @@ -26,7 +26,7 @@ namespace GrasscutterTools.GOOD /// Doc: https://frzyc.github.io/genshin-optimizer/#/doc /// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Character.cs /// - public class Character + internal class Character { /// /// e.g. "Rosaria" diff --git a/Source/GrasscutterTools/GOOD/GOOD.cs b/Source/GrasscutterTools/GOOD/GOOD.cs index 2c95386..ef33c5b 100644 --- a/Source/GrasscutterTools/GOOD/GOOD.cs +++ b/Source/GrasscutterTools/GOOD/GOOD.cs @@ -38,7 +38,7 @@ namespace GrasscutterTools.GOOD /// https://genshin.mingyulab.com/ /// https://genshin-center.com/ /// - public class GOOD + internal class GOOD { [JsonProperty("format")] public string Format { get; set; } diff --git a/Source/GrasscutterTools/GOOD/GOODData.cs b/Source/GrasscutterTools/GOOD/GOODData.cs index 07ff520..733c48e 100644 --- a/Source/GrasscutterTools/GOOD/GOODData.cs +++ b/Source/GrasscutterTools/GOOD/GOODData.cs @@ -26,7 +26,7 @@ using GrasscutterTools.Properties; namespace GrasscutterTools.GOOD { - public static class GOODData + internal static class GOODData { static GOODData() { diff --git a/Source/GrasscutterTools/GOOD/Weapon.cs b/Source/GrasscutterTools/GOOD/Weapon.cs index f83858f..3a48ed3 100644 --- a/Source/GrasscutterTools/GOOD/Weapon.cs +++ b/Source/GrasscutterTools/GOOD/Weapon.cs @@ -28,7 +28,7 @@ namespace GrasscutterTools.GOOD /// Doc: https://frzyc.github.io/genshin-optimizer/#/doc /// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Weapon.cs /// - public class Weapon + internal class Weapon { /// /// e.g. "CrescentPike" diff --git a/Source/GrasscutterTools/Game/Activity/ActivityConfigItem.cs b/Source/GrasscutterTools/Game/Activity/ActivityConfigItem.cs index 41cb95e..fdbaa61 100644 --- a/Source/GrasscutterTools/Game/Activity/ActivityConfigItem.cs +++ b/Source/GrasscutterTools/Game/Activity/ActivityConfigItem.cs @@ -24,7 +24,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.Game.Activity { - public class ActivityConfigItem + internal class ActivityConfigItem { /// /// 活动ID diff --git a/Source/GrasscutterTools/Game/Data/Excels/AchievementData.cs b/Source/GrasscutterTools/Game/Data/Excels/AchievementData.cs index c4e7e47..929ffcd 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/AchievementData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/AchievementData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels { @@ -10,4 +29,4 @@ namespace GrasscutterTools.Game.Data.Excels public bool IsUsed => !IsDisuse; } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/AvatarData.cs b/Source/GrasscutterTools/Game/Data/Excels/AvatarData.cs index 95ddbe3..4a60332 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/AvatarData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/AvatarData.cs @@ -1,4 +1,23 @@ -using GrasscutterTools.Game.Props; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using GrasscutterTools.Game.Props; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -11,4 +30,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("qualityType"), JsonConverter(typeof(StringEnumConverter))] public QualityType QualityType { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/DungeonData.cs b/Source/GrasscutterTools/Game/Data/Excels/DungeonData.cs index d91e0b3..dc6ee30 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/DungeonData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/DungeonData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels { @@ -8,4 +27,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("sceneId")] public int SceneId { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/GadgetData.cs b/Source/GrasscutterTools/Game/Data/Excels/GadgetData.cs index d13eab3..14a8d43 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/GadgetData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/GadgetData.cs @@ -1,8 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ namespace GrasscutterTools.Game.Data.Excels { @@ -10,4 +23,4 @@ namespace GrasscutterTools.Game.Data.Excels internal class GadgetData { } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/HomeWorldBgmData.cs b/Source/GrasscutterTools/Game/Data/Excels/HomeWorldBgmData.cs index ac407bf..48f3aeb 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/HomeWorldBgmData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/HomeWorldBgmData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels { @@ -11,4 +30,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("bgmNameTextMapHash")] public long BgmNameTextMapHash { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/HomeWorldFurnitureData.cs b/Source/GrasscutterTools/Game/Data/Excels/HomeWorldFurnitureData.cs index 98ea3e4..aa65dec 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/HomeWorldFurnitureData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/HomeWorldFurnitureData.cs @@ -1,7 +1,26 @@ -namespace GrasscutterTools.Game.Data.Excels +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +namespace GrasscutterTools.Game.Data.Excels { [ResourceType("HomeWorldFurnitureExcelConfigData.json")] internal class HomeWorldFurnitureData : GameResource { } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/MainQuestData.cs b/Source/GrasscutterTools/Game/Data/Excels/MainQuestData.cs index b1f69e1..6ccc939 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/MainQuestData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/MainQuestData.cs @@ -1,4 +1,21 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ namespace GrasscutterTools.Game.Data.Excels { @@ -6,4 +23,4 @@ namespace GrasscutterTools.Game.Data.Excels internal class MainQuestData : GameResource { } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/MaterialData.cs b/Source/GrasscutterTools/Game/Data/Excels/MaterialData.cs index 40744e2..ccf8adf 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/MaterialData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/MaterialData.cs @@ -1,4 +1,24 @@ -using System.Collections.Generic; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System.Collections.Generic; + using GrasscutterTools.Game.Inventory; using GrasscutterTools.Game.Props; @@ -19,4 +39,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("itemUse")] public List ItemUse { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/MonsterData.cs b/Source/GrasscutterTools/Game/Data/Excels/MonsterData.cs index 834a168..6f2d588 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/MonsterData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/MonsterData.cs @@ -1,4 +1,24 @@ -using GrasscutterTools.Game.Props; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using GrasscutterTools.Game.Props; + using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels @@ -12,4 +32,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("type")] public MonsterType Type { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/QuestData.cs b/Source/GrasscutterTools/Game/Data/Excels/QuestData.cs index 12b78ff..577d2b3 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/QuestData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/QuestData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels { @@ -14,4 +33,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("order")] public int Order { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/ReliquaryData.cs b/Source/GrasscutterTools/Game/Data/Excels/ReliquaryData.cs index c64e068..24fbea9 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/ReliquaryData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/ReliquaryData.cs @@ -1,7 +1,26 @@ -namespace GrasscutterTools.Game.Data.Excels +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +namespace GrasscutterTools.Game.Data.Excels { [ResourceType("ReliquaryExcelConfigData.json")] internal class ReliquaryData : GameResource { } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/SceneData.cs b/Source/GrasscutterTools/Game/Data/Excels/SceneData.cs index fd47b5a..1c763b2 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/SceneData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/SceneData.cs @@ -1,4 +1,24 @@ -using GrasscutterTools.Game.Props; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using GrasscutterTools.Game.Props; + using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels @@ -12,4 +32,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("scriptData")] public string ScriptData { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/Excels/WeaponData.cs b/Source/GrasscutterTools/Game/Data/Excels/WeaponData.cs index 2609468..e5ff7fa 100644 --- a/Source/GrasscutterTools/Game/Data/Excels/WeaponData.cs +++ b/Source/GrasscutterTools/Game/Data/Excels/WeaponData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data.Excels { @@ -8,4 +27,4 @@ namespace GrasscutterTools.Game.Data.Excels [JsonProperty("rankLevel")] public int RankLevel { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/GameResource.cs b/Source/GrasscutterTools/Game/Data/GameResource.cs index 80ef28d..b8ce3c4 100644 --- a/Source/GrasscutterTools/Game/Data/GameResource.cs +++ b/Source/GrasscutterTools/Game/Data/GameResource.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Data { diff --git a/Source/GrasscutterTools/Game/Data/GameResources.cs b/Source/GrasscutterTools/Game/Data/GameResources.cs index 167136b..093cb31 100644 --- a/Source/GrasscutterTools/Game/Data/GameResources.cs +++ b/Source/GrasscutterTools/Game/Data/GameResources.cs @@ -1,4 +1,23 @@ -using System; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -6,10 +25,10 @@ using System.IO; using System.Linq; using System.Text; using System.Threading; + using GrasscutterTools.Game.Data.Excels; using GrasscutterTools.Game.Inventory; using GrasscutterTools.Game.Props; -using GrasscutterTools.GOOD; using GrasscutterTools.Utils; using Newtonsoft.Json; @@ -27,7 +46,7 @@ namespace GrasscutterTools.Game.Data public Dictionary DungeonData { get; set; } public Dictionary HomeWorldFurnitureData { get; set; } - + public Dictionary MainQuestData { get; set; } public Dictionary QuestData { get; set; } @@ -37,15 +56,13 @@ namespace GrasscutterTools.Game.Data public Dictionary MonsterData { get; set; } public Dictionary ReliquaryData { get; set; } - + public Dictionary SceneData { get; set; } public Dictionary WeaponData { get; set; } public TextMapData TextMapData { get; set; } - - public GameResources(string resourcesDirPath, TextMapData textMapData) { TextMapData = textMapData; @@ -63,7 +80,6 @@ namespace GrasscutterTools.Game.Data property.SetValue(this, data, null); } - var illegalWeaponIds = new SparseSet( "10000-10008, 11411, 11506-11508, 12505, 12506, 12508, 12509," + "13503, 13506, 14411, 14503, 14508, 15504-15506, 20001"); @@ -110,8 +126,8 @@ namespace GrasscutterTools.Game.Data { ["zh-cn"] = "TextMapCHS", ["zh-tw"] = "TextMapCHT", - ["en-us"] = "TextMapEN", - ["ru-ru"] = "TextMapRU", + ["en-us"] = "TextMapEN", + ["ru-ru"] = "TextMapRU", }; public void ConvertResources(string projectResourcesDir) @@ -195,7 +211,6 @@ namespace GrasscutterTools.Game.Data File.WriteAllText(Path.Combine(dir, "Item.txt"), sb.ToString(), Encoding.UTF8); - sb.Clear(); foreach (var monsterType in MonsterData.Values.OrderBy(it => it.Id) .GroupBy(it => it.Type) @@ -247,7 +262,6 @@ namespace GrasscutterTools.Game.Data sb.ToString(), Encoding.UTF8); - sb.Clear(); foreach (var it in DungeonData.Values) { @@ -275,7 +289,6 @@ namespace GrasscutterTools.Game.Data Encoding.UTF8); } - File.WriteAllLines( Path.Combine(projectResourcesDir, "AvatarColor.txt"), AvatarData.Values.Select(it => $"{it.Id % 1000 + 1000}:{(int)it.QualityType}"), @@ -285,7 +298,6 @@ namespace GrasscutterTools.Game.Data Path.Combine(projectResourcesDir, "WeaponColor.txt"), WeaponData.Values.Select(it => $"{it.Id}:{(it.RankLevel >= 5 ? "yellow" : it.RankLevel >= 4 ? "purple" : "blue")}"), Encoding.UTF8); - } finally { @@ -293,4 +305,4 @@ namespace GrasscutterTools.Game.Data } } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Data/ResourceTypeAttribute.cs b/Source/GrasscutterTools/Game/Data/ResourceTypeAttribute.cs index 569fdb0..b283c86 100644 --- a/Source/GrasscutterTools/Game/Data/ResourceTypeAttribute.cs +++ b/Source/GrasscutterTools/Game/Data/ResourceTypeAttribute.cs @@ -1,9 +1,28 @@ -using System; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System; namespace GrasscutterTools.Game.Data { [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class ResourceTypeAttribute : Attribute + internal class ResourceTypeAttribute : Attribute { public string Name { get; set; } @@ -12,4 +31,4 @@ namespace GrasscutterTools.Game.Data Name = name; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs b/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs index cab568c..e29ab34 100644 --- a/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs +++ b/Source/GrasscutterTools/Game/Gacha/GachaBanner.cs @@ -28,7 +28,7 @@ namespace GrasscutterTools.Game.Gacha /// 使用这个只需替换掉你原来的的data/banner.json文件, /// 然后重启服务器和客户端,即可享受全卡池抽卡,卡池的选择方式是点击左右箭头进行切换 /// - public class GachaBanner + internal class GachaBanner { /// /// 添加卡池请从400开始增加id数值进行添加,这个id需要每个池子不一样, diff --git a/Source/GrasscutterTools/Game/Gacha/GachaBanner2.cs b/Source/GrasscutterTools/Game/Gacha/GachaBanner2.cs index 20921ca..1528885 100644 --- a/Source/GrasscutterTools/Game/Gacha/GachaBanner2.cs +++ b/Source/GrasscutterTools/Game/Gacha/GachaBanner2.cs @@ -25,7 +25,7 @@ namespace GrasscutterTools.Game.Gacha /// /// https://github.com/Grasscutters/Grasscutter/pull/639 /// - public class GachaBanner2 + internal class GachaBanner2 { /// /// 添加卡池请从400开始增加id数值进行添加,这个id需要每个池子不一样, diff --git a/Source/GrasscutterTools/Game/Gacha/GachaBanner3.cs b/Source/GrasscutterTools/Game/Gacha/GachaBanner3.cs index fafc1b8..c804947 100644 --- a/Source/GrasscutterTools/Game/Gacha/GachaBanner3.cs +++ b/Source/GrasscutterTools/Game/Gacha/GachaBanner3.cs @@ -28,7 +28,7 @@ namespace GrasscutterTools.Game.Gacha /// /// https://github.com/Grasscutters/Grasscutter/pull/639 /// - public class GachaBanner3 + internal class GachaBanner3 { /// /// 备注 diff --git a/Source/GrasscutterTools/Game/GameCommand.cs b/Source/GrasscutterTools/Game/GameCommand.cs index 8d67ad4..2ba888d 100644 --- a/Source/GrasscutterTools/Game/GameCommand.cs +++ b/Source/GrasscutterTools/Game/GameCommand.cs @@ -22,7 +22,7 @@ using System.Text; namespace GrasscutterTools.Game { - public class GameCommand + internal class GameCommand { public GameCommand(string name, string command) { diff --git a/Source/GrasscutterTools/Game/ItemMap.cs b/Source/GrasscutterTools/Game/ItemMap.cs index 3def395..15510cc 100644 --- a/Source/GrasscutterTools/Game/ItemMap.cs +++ b/Source/GrasscutterTools/Game/ItemMap.cs @@ -22,7 +22,7 @@ using System.Collections.Generic; namespace GrasscutterTools.Game { - public class ItemMap + internal class ItemMap { public ItemMap(string idNamePairs) { diff --git a/Source/GrasscutterTools/Game/ItemMapGroup.cs b/Source/GrasscutterTools/Game/ItemMapGroup.cs index a93b985..8695fc1 100644 --- a/Source/GrasscutterTools/Game/ItemMapGroup.cs +++ b/Source/GrasscutterTools/Game/ItemMapGroup.cs @@ -25,7 +25,7 @@ namespace GrasscutterTools.Game /// /// ID映射组,Key为分类,双斜杠构造 /// - public class ItemMapGroup : Dictionary + internal class ItemMapGroup : Dictionary { public ItemMapGroup(string idNamePairs) { diff --git a/Source/GrasscutterTools/Game/Mail/Mail.cs b/Source/GrasscutterTools/Game/Mail/Mail.cs index c898c8a..7169a09 100644 --- a/Source/GrasscutterTools/Game/Mail/Mail.cs +++ b/Source/GrasscutterTools/Game/Mail/Mail.cs @@ -27,7 +27,7 @@ namespace GrasscutterTools.Game.Mail /// /// 邮件 /// - public class Mail + internal class Mail { /// /// 发件人 diff --git a/Source/GrasscutterTools/Game/Props/ItemUseData.cs b/Source/GrasscutterTools/Game/Props/ItemUseData.cs index b8679e6..977cc42 100644 --- a/Source/GrasscutterTools/Game/Props/ItemUseData.cs +++ b/Source/GrasscutterTools/Game/Props/ItemUseData.cs @@ -1,4 +1,23 @@ -using Newtonsoft.Json; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using Newtonsoft.Json; namespace GrasscutterTools.Game.Props { @@ -7,4 +26,4 @@ namespace GrasscutterTools.Game.Props [JsonProperty("useParam")] public string[] UseParam { get; set; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Props/MonsterType.cs b/Source/GrasscutterTools/Game/Props/MonsterType.cs index bb94ceb..153860a 100644 --- a/Source/GrasscutterTools/Game/Props/MonsterType.cs +++ b/Source/GrasscutterTools/Game/Props/MonsterType.cs @@ -1,4 +1,22 @@ - +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + // ReSharper disable InconsistentNaming using System.Collections.Generic; @@ -19,7 +37,6 @@ namespace GrasscutterTools.Game.Props MONSTER_PARTNER = 6, } - internal static class ItemTypeExtension { private static readonly Dictionary TextMapCHS = new Dictionary @@ -32,6 +49,7 @@ namespace GrasscutterTools.Game.Props [MonsterType.MONSTER_FISH] = "鱼", [MonsterType.MONSTER_PARTNER] = "友军", }; + private static readonly Dictionary TextMapEN = new Dictionary { [MonsterType.MONSTER_NONE] = "None", @@ -48,4 +66,4 @@ namespace GrasscutterTools.Game.Props return language.StartsWith("zh") ? TextMapCHS[materialType] : TextMapEN[materialType]; } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Props/QualityType.cs b/Source/GrasscutterTools/Game/Props/QualityType.cs index af43aaa..51055a2 100644 --- a/Source/GrasscutterTools/Game/Props/QualityType.cs +++ b/Source/GrasscutterTools/Game/Props/QualityType.cs @@ -1,4 +1,22 @@ - +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + // ReSharper disable InconsistentNaming namespace GrasscutterTools.Game.Props @@ -41,4 +59,4 @@ namespace GrasscutterTools.Game.Props //QUALITY_ORANGE_SP = 105, QUALITY_ORANGE_SP = 5, } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Props/SceneType.cs b/Source/GrasscutterTools/Game/Props/SceneType.cs index 9b5b9d8..fc40737 100644 --- a/Source/GrasscutterTools/Game/Props/SceneType.cs +++ b/Source/GrasscutterTools/Game/Props/SceneType.cs @@ -1,4 +1,22 @@ - +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + // ReSharper disable InconsistentNaming namespace GrasscutterTools.Game.Props @@ -13,4 +31,4 @@ namespace GrasscutterTools.Game.Props SCENE_HOME_ROOM = 5, SCENE_ACTIVITY = 6, } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Game/Shop/ShopGoodsData.cs b/Source/GrasscutterTools/Game/Shop/ShopGoodsData.cs index 127f72d..1a10ad1 100644 --- a/Source/GrasscutterTools/Game/Shop/ShopGoodsData.cs +++ b/Source/GrasscutterTools/Game/Shop/ShopGoodsData.cs @@ -25,7 +25,7 @@ using Newtonsoft.Json.Converters; namespace GrasscutterTools.Game.Shop { - public class ShopGoodsData + internal class ShopGoodsData { [JsonProperty("goodsId")] public int GoodsId { get; set; } diff --git a/Source/GrasscutterTools/Game/Shop/ShopInfo.cs b/Source/GrasscutterTools/Game/Shop/ShopInfo.cs index 6eb581f..5e8fe43 100644 --- a/Source/GrasscutterTools/Game/Shop/ShopInfo.cs +++ b/Source/GrasscutterTools/Game/Shop/ShopInfo.cs @@ -26,7 +26,7 @@ using Newtonsoft.Json.Converters; namespace GrasscutterTools.Game.Shop { - public class ShopInfo + internal class ShopInfo { public ShopInfo() { diff --git a/Source/GrasscutterTools/Game/Shop/ShopTable.cs b/Source/GrasscutterTools/Game/Shop/ShopTable.cs index 2b52895..6dc0663 100644 --- a/Source/GrasscutterTools/Game/Shop/ShopTable.cs +++ b/Source/GrasscutterTools/Game/Shop/ShopTable.cs @@ -23,7 +23,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.Game.Shop { - public class ShopTable + internal class ShopTable { [JsonProperty("shopId")] public int ShopType { get; set; } diff --git a/Source/GrasscutterTools/Game/TextMapData.cs b/Source/GrasscutterTools/Game/TextMapData.cs index 735bbef..68f4f5a 100644 --- a/Source/GrasscutterTools/Game/TextMapData.cs +++ b/Source/GrasscutterTools/Game/TextMapData.cs @@ -26,7 +26,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.Game { - public class TextMapData + internal class TextMapData { public TextMapData(string resourcesDirPath) { diff --git a/Source/GrasscutterTools/GrasscutterTools.csproj b/Source/GrasscutterTools/GrasscutterTools.csproj index 4ed0532..25f595c 100644 --- a/Source/GrasscutterTools/GrasscutterTools.csproj +++ b/Source/GrasscutterTools/GrasscutterTools.csproj @@ -665,6 +665,7 @@ Resources.resx True + SettingsSingleFileGenerator diff --git a/Source/GrasscutterTools/GrasscutterTools.licenseheader b/Source/GrasscutterTools/GrasscutterTools.licenseheader new file mode 100644 index 0000000..d74a6c4 --- /dev/null +++ b/Source/GrasscutterTools/GrasscutterTools.licenseheader @@ -0,0 +1,19 @@ +extensions: .cs +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ diff --git a/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs b/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs index 0c21531..0a406c6 100644 --- a/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs +++ b/Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs @@ -26,7 +26,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.OpenCommand { - public class OpenCommandAPI + internal class OpenCommandAPI { public OpenCommandAPI(string host, string token = "") { diff --git a/Source/GrasscutterTools/Pages/PageTools.cs b/Source/GrasscutterTools/Pages/PageTools.cs index e5ad773..98c49b6 100644 --- a/Source/GrasscutterTools/Pages/PageTools.cs +++ b/Source/GrasscutterTools/Pages/PageTools.cs @@ -1,4 +1,23 @@ -using System; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -9,7 +28,6 @@ using GrasscutterTools.Game; using GrasscutterTools.Game.Activity; using GrasscutterTools.Game.CutScene; using GrasscutterTools.Game.Data; -using GrasscutterTools.Game.Dungeon; using GrasscutterTools.Properties; using Newtonsoft.Json; @@ -122,10 +140,6 @@ namespace GrasscutterTools.Pages } } - - - - private TextMapData TextMapData; private GameResources GameResources; @@ -134,7 +148,7 @@ namespace GrasscutterTools.Pages try { if (!CheckInputPaths()) return; - + if (TextMapData == null) TextMapData = new TextMapData(TxtGcResRoot.Text); if (GameResources == null) @@ -149,13 +163,6 @@ namespace GrasscutterTools.Pages } } - - - - - - - private void BtnUpdateActivity_Click(object sender, EventArgs e) { try @@ -208,6 +215,5 @@ namespace GrasscutterTools.Pages // activityItems.Select(it => $"{it.ActivityId}:{TextMapData.GetText(it.NameTextMapHash)}"), // Encoding.UTF8); } - } } \ No newline at end of file diff --git a/Source/GrasscutterTools/Utils/AppHotKey.cs b/Source/GrasscutterTools/Utils/AppHotKey.cs index 898b019..6e88f28 100644 --- a/Source/GrasscutterTools/Utils/AppHotKey.cs +++ b/Source/GrasscutterTools/Utils/AppHotKey.cs @@ -24,7 +24,7 @@ using System.Windows.Forms; namespace GrasscutterTools.Utils { - public static class AppHotKey + internal static class AppHotKey { /// /// 注册热键 diff --git a/Source/GrasscutterTools/Utils/Common.cs b/Source/GrasscutterTools/Utils/Common.cs index 20bc111..eb94cdc 100644 --- a/Source/GrasscutterTools/Utils/Common.cs +++ b/Source/GrasscutterTools/Utils/Common.cs @@ -1,4 +1,23 @@ -using System; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System; using System.IO; using GrasscutterTools.Game; diff --git a/Source/GrasscutterTools/Utils/GuiRedirect.cs b/Source/GrasscutterTools/Utils/GuiRedirect.cs index 04d8d95..a383bcc 100644 --- a/Source/GrasscutterTools/Utils/GuiRedirect.cs +++ b/Source/GrasscutterTools/Utils/GuiRedirect.cs @@ -25,7 +25,7 @@ namespace GrasscutterTools.Utils /// /// /// - public class GuiRedirect + internal class GuiRedirect { [DllImport("kernel32.dll", SetLastError = true)] private static extern bool AttachConsole(int dwProcessId); diff --git a/Source/GrasscutterTools/Utils/HotKeyItem.cs b/Source/GrasscutterTools/Utils/HotKeyItem.cs index 4ccc98e..3d70f82 100644 --- a/Source/GrasscutterTools/Utils/HotKeyItem.cs +++ b/Source/GrasscutterTools/Utils/HotKeyItem.cs @@ -24,7 +24,7 @@ namespace GrasscutterTools.Utils /// /// 热键项 /// - public class HotKeyItem + internal class HotKeyItem { /// /// Gets or sets the hot key identifier. diff --git a/Source/GrasscutterTools/Utils/HttpHelper.cs b/Source/GrasscutterTools/Utils/HttpHelper.cs index f068a3b..4de0ee5 100644 --- a/Source/GrasscutterTools/Utils/HttpHelper.cs +++ b/Source/GrasscutterTools/Utils/HttpHelper.cs @@ -27,7 +27,7 @@ using Newtonsoft.Json; namespace GrasscutterTools.Utils { - public static class HttpHelper + internal static class HttpHelper { public static readonly HttpClient HttpClient = new HttpClient { diff --git a/Source/GrasscutterTools/Utils/KeyGo.cs b/Source/GrasscutterTools/Utils/KeyGo.cs index f6f4010..dd977be 100644 --- a/Source/GrasscutterTools/Utils/KeyGo.cs +++ b/Source/GrasscutterTools/Utils/KeyGo.cs @@ -261,7 +261,7 @@ namespace GrasscutterTools.Utils /// /// 热键触发事件参数 /// - public class HotKeyTriggerEventArgs + internal class HotKeyTriggerEventArgs { public HotKeyItem HotKeyItem { get; set; } diff --git a/Source/GrasscutterTools/Utils/Logger.cs b/Source/GrasscutterTools/Utils/Logger.cs index a14d6ca..e65e99d 100644 --- a/Source/GrasscutterTools/Utils/Logger.cs +++ b/Source/GrasscutterTools/Utils/Logger.cs @@ -23,7 +23,7 @@ using System.Windows.Forms; namespace GrasscutterTools.Utils { - public static class Logger + internal static class Logger { public static bool IsSaveLogs = false; diff --git a/Source/GrasscutterTools/Utils/SparseSet.cs b/Source/GrasscutterTools/Utils/SparseSet.cs index c9775ae..3d3dc9e 100644 --- a/Source/GrasscutterTools/Utils/SparseSet.cs +++ b/Source/GrasscutterTools/Utils/SparseSet.cs @@ -1,44 +1,65 @@ -using System; +/** + * Grasscutter Tools + * Copyright (C) 2023 jie65535 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + **/ + +using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace GrasscutterTools.Utils { - public class SparseSet + internal class SparseSet { - private struct Range + private readonly struct Range { - public int Min; - public int Max; + private readonly int Min; + private readonly int Max; public Range(int min, int max) { Min = min; Max = max; } + public bool Check(int value) => Min <= value && value <= Max; } - private readonly List rangeEntries; - private readonly HashSet denseEntries; + private readonly List RangeEntries; + private readonly HashSet DenseEntries; + public SparseSet(string csv) { - rangeEntries = new List(); - denseEntries = new HashSet(); + RangeEntries = new List(); + DenseEntries = new HashSet(); foreach (var token in csv.Replace("\n", "").Replace(" ", "").Split(',')) { var tokens = token.Split('-'); switch (tokens.Length) { case 1: - denseEntries.Add(int.Parse(tokens[0])); + DenseEntries.Add(int.Parse(tokens[0])); break; + case 2: - rangeEntries.Add(new Range(int.Parse(tokens[0]), int.Parse(tokens[1]))); + RangeEntries.Add(new Range(int.Parse(tokens[0]), int.Parse(tokens[1]))); break; + default: throw new ArgumentException($"Invalid token passed to SparseSet initializer - {token} (split length {tokens.Length})"); } @@ -47,10 +68,7 @@ namespace GrasscutterTools.Utils public bool Contains(int i) { - foreach (var range in rangeEntries) - if (range.Check(i)) - return true; - return denseEntries.Contains(i); + return RangeEntries.Any(range => range.Check(i)) || DenseEntries.Contains(i); } } -} +} \ No newline at end of file diff --git a/Source/GrasscutterTools/Utils/UIUtil.cs b/Source/GrasscutterTools/Utils/UIUtil.cs index e2bb76b..74e0a4b 100644 --- a/Source/GrasscutterTools/Utils/UIUtil.cs +++ b/Source/GrasscutterTools/Utils/UIUtil.cs @@ -8,7 +8,7 @@ using GrasscutterTools.Properties; namespace GrasscutterTools.Utils { - public static class UIUtil + internal static class UIUtil { /// /// 播放按钮完成动画