Clean up all files

This commit is contained in:
2022-05-13 11:39:07 +08:00
parent 3defcbbdc1
commit 2a3ba29b1d
18 changed files with 68 additions and 88 deletions

View File

@ -7,12 +7,10 @@ namespace GrasscutterTools.DispatchServer
{ {
public static class DispatchServerAPI public static class DispatchServerAPI
{ {
public static async Task<ServerStatus> QueryServerStatus(string host) public static async Task<ServerStatus> QueryServerStatus(string host)
{ {
var response = await HttpHelper.GetAsync<ServerStatusResponse>(host + "/status/server"); var response = await HttpHelper.GetAsync<ServerStatusResponse>(host + "/status/server");
return response?.Status; return response?.Status;
} }
} }
} }

View File

@ -1,5 +1,4 @@
 using Newtonsoft.Json;
using Newtonsoft.Json;
namespace GrasscutterTools.DispatchServer.Model namespace GrasscutterTools.DispatchServer.Model
{ {

View File

@ -53,7 +53,6 @@ namespace GrasscutterTools
SaveSettings(); SaveSettings();
} }
private readonly string[] LanguageNames = new string[] { "简体中文", "English" }; private readonly string[] LanguageNames = new string[] { "简体中文", "English" };
private readonly string[] Languages = new string[] { "zh-CN", "en-US" }; private readonly string[] Languages = new string[] { "zh-CN", "en-US" };
@ -99,8 +98,8 @@ namespace GrasscutterTools
#region - - #region - -
private FormGachaBannerEditor FormGachaBannerEditor;
FormGachaBannerEditor FormGachaBannerEditor;
private void BtnOpenGachaBannerEditor_Click(object sender, EventArgs e) private void BtnOpenGachaBannerEditor_Click(object sender, EventArgs e)
{ {
if (FormGachaBannerEditor == null || FormGachaBannerEditor.IsDisposed) if (FormGachaBannerEditor == null || FormGachaBannerEditor.IsDisposed)
@ -115,7 +114,8 @@ namespace GrasscutterTools
} }
} }
FormTextMapBrowser FormTextMapBrowser; private FormTextMapBrowser FormTextMapBrowser;
private void BtnOpenTextMap_Click(object sender, EventArgs e) private void BtnOpenTextMap_Click(object sender, EventArgs e)
{ {
if (FormTextMapBrowser == null || FormTextMapBrowser.IsDisposed) if (FormTextMapBrowser == null || FormTextMapBrowser.IsDisposed)
@ -139,6 +139,7 @@ namespace GrasscutterTools
#endregion - - #endregion - -
#region - - #region - -
private readonly string CustomCommandsFilePath = Path.Combine(Application.LocalUserAppDataPath, "CustomCommands.txt"); private readonly string CustomCommandsFilePath = Path.Combine(Application.LocalUserAppDataPath, "CustomCommands.txt");
private bool CustomCommandsChanged; private bool CustomCommandsChanged;
@ -351,7 +352,6 @@ namespace GrasscutterTools
NUDArtifactStars.Minimum = GameData.Artifacts.Ids[beginIndex] / 100 % 10; 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; var i = CmbArtifactPart.SelectedIndex;
CmbArtifactPart.Items.Clear(); CmbArtifactPart.Items.Clear();
@ -362,7 +362,8 @@ namespace GrasscutterTools
ArtifactInputChanged(sender, e); ArtifactInputChanged(sender, e);
} }
readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙"}; private readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙" };
private void CmbArtifactPart_SelectedIndexChanged(object sender, EventArgs e) private void CmbArtifactPart_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (CmbArtifactPart.SelectedIndex < 0) if (CmbArtifactPart.SelectedIndex < 0)
@ -523,8 +524,9 @@ namespace GrasscutterTools
#region -- -- #region -- --
readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt"); private readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt");
List<GameCommand> GiveItemCommands; private List<GameCommand> GiveItemCommands;
private void InitGiveItemRecord() private void InitGiveItemRecord()
{ {
if (File.Exists(GiveItemCommandsRecordPath)) if (File.Exists(GiveItemCommandsRecordPath))
@ -574,7 +576,8 @@ namespace GrasscutterTools
ListGiveItemLogs.Items.RemoveAt(ListGiveItemLogs.SelectedIndex); ListGiveItemLogs.Items.RemoveAt(ListGiveItemLogs.SelectedIndex);
} }
} }
#endregion
#endregion -- --
#endregion - - #endregion - -
@ -672,8 +675,9 @@ namespace GrasscutterTools
#region -- -- #region -- --
readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt"); private readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt");
List<GameCommand> SpawnCommands; private List<GameCommand> SpawnCommands;
private void InitSpawnRecord() private void InitSpawnRecord()
{ {
if (File.Exists(SpawnCommandsRecordPath)) if (File.Exists(SpawnCommandsRecordPath))
@ -686,6 +690,7 @@ namespace GrasscutterTools
SpawnCommands = new List<GameCommand>(); SpawnCommands = new List<GameCommand>();
} }
} }
private void SaveSpawnRecord() private void SaveSpawnRecord()
{ {
File.WriteAllText(SpawnCommandsRecordPath, GetCommandsText(SpawnCommands)); File.WriteAllText(SpawnCommandsRecordPath, GetCommandsText(SpawnCommands));
@ -723,7 +728,7 @@ namespace GrasscutterTools
} }
} }
#endregion #endregion -- --
#endregion - - #endregion - -
@ -834,7 +839,7 @@ namespace GrasscutterTools
} }
} }
#endregion #endregion - -
#region - - #region - -
@ -897,7 +902,7 @@ namespace GrasscutterTools
#region - - #region - -
List<GameCommand> GetCommands(string commandsText) private List<GameCommand> GetCommands(string commandsText)
{ {
var lines = commandsText.Split('\n'); var lines = commandsText.Split('\n');
List<GameCommand> commands = new List<GameCommand>(lines.Length / 2); List<GameCommand> commands = new List<GameCommand>(lines.Length / 2);
@ -906,7 +911,7 @@ namespace GrasscutterTools
return commands; return commands;
} }
string GetCommandsText(List<GameCommand> commands) private string GetCommandsText(List<GameCommand> commands)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
foreach (var cmd in commands) foreach (var cmd in commands)
@ -917,7 +922,7 @@ namespace GrasscutterTools
return builder.ToString(); return builder.ToString();
} }
#endregion #endregion - -
#region - - #region - -
@ -1080,7 +1085,6 @@ namespace GrasscutterTools
MessageBox.Show(Resources.OpenCommandHelp, Resources.Help, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Resources.OpenCommandHelp, Resources.Help, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
#endregion #endregion - -
} }
} }

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@ -150,7 +149,8 @@ namespace GrasscutterTools
.Select(kv => new { Hash = kv.Key, Id = kv.Value, Text = data.TextMap[kv.Key] }) .Select(kv => new { Hash = kv.Key, Id = kv.Value, Text = data.TextMap[kv.Key] })
.Concat( .Concat(
data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success) data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success)
.Select(kv => new { .Select(kv => new
{
Hash = kv.Key, Hash = kv.Key,
Id = data.ManualTextMap.TryGetValue(kv.Key, out string id) ? id : "", Id = data.ManualTextMap.TryGetValue(kv.Key, out string id) ? id : "",
Text = kv.Value Text = kv.Value
@ -179,6 +179,5 @@ namespace GrasscutterTools
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
BtnSearch_Click(sender, e); BtnSearch_Click(sender, e);
} }
} }
} }

View File

@ -1,10 +1,4 @@
using System; namespace GrasscutterTools.Game.Gacha
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrasscutterTools.Game.Gacha
{ {
public enum BannerType public enum BannerType
{ {

View File

@ -117,6 +117,5 @@ namespace GrasscutterTools.Game.Gacha
/// </summary> /// </summary>
[JsonProperty("hardPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(90)] [JsonProperty("hardPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(90)]
public int HardPity { get; set; } = 90; public int HardPity { get; set; } = 90;
} }
} }

View File

@ -52,6 +52,5 @@ namespace GrasscutterTools.Game
public static ItemMap Ornaments { get; private set; } public static ItemMap Ornaments { get; private set; }
public static ItemMap GachaBannerPrefabs { get; private set; } public static ItemMap GachaBannerPrefabs { get; private set; }
} }
} }

View File

@ -41,7 +41,6 @@ namespace GrasscutterTools.Game
//List<int> IdList; //List<int> IdList;
//List<string> NameList; //List<string> NameList;
public int Count => Ids.Length; public int Count => Ids.Length;
//public string this[int id] => IdMap[id]; //public string this[int id] => IdMap[id];

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Text;
using System.Text;
using GrasscutterTools.Properties; using GrasscutterTools.Properties;

View File

@ -1,9 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -22,7 +19,7 @@ namespace GrasscutterTools.Game
public string[] TextMapFilePaths; public string[] TextMapFilePaths;
public string[] TextMapFiles; public string[] TextMapFiles;
void LoadManualTextMap(string manualTextMapPath) private void LoadManualTextMap(string manualTextMapPath)
{ {
using (var fs = File.OpenRead(manualTextMapPath)) using (var fs = File.OpenRead(manualTextMapPath))
using (var sr = new StreamReader(fs)) 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"); TextMapFilePaths = Directory.GetFiles(textMapDirPath, "TextMap*.json");
if (TextMapFilePaths.Length == 0) if (TextMapFilePaths.Length == 0)
@ -65,6 +62,5 @@ namespace GrasscutterTools.Game
} }
} }
} }
} }
} }

View File

@ -3,9 +3,8 @@ using System.Windows.Forms;
namespace GrasscutterTools namespace GrasscutterTools
{ {
static class MultiLanguage internal static class MultiLanguage
{ {
public static string DefaultLanguage = "zh-CN"; public static string DefaultLanguage = "zh-CN";
public static void SetDefaultLanguage(string lang) public static void SetDefaultLanguage(string lang)
@ -16,7 +15,6 @@ namespace GrasscutterTools
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
/// <summary> /// <summary>
/// 加载语言 /// 加载语言
/// </summary> /// </summary>

View File

@ -95,7 +95,6 @@ namespace GrasscutterTools.OpenCommand
public object Data { get; set; } public object Data { get; set; }
} }
internal class InvokeException : Exception internal class InvokeException : Exception
{ {
public InvokeException(string message) : base(message) public InvokeException(string message) : base(message)

View File

@ -1,18 +1,15 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace GrasscutterTools namespace GrasscutterTools
{ {
static class Program internal static class Program
{ {
/// <summary> /// <summary>
/// 应用程序的主入口点。 /// 应用程序的主入口点。
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() private static void Main()
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);

View File

@ -10,7 +10,7 @@ namespace GrasscutterTools.Utils
{ {
public static class HttpHelper public static class HttpHelper
{ {
static readonly HttpClient httpClient = new HttpClient(); private static readonly HttpClient httpClient = new HttpClient();
static HttpHelper() static HttpHelper()
{ {