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

@ -2,11 +2,11 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="GrasscutterTools.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="GrasscutterTools.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<userSettings>
<GrasscutterTools.Properties.Settings>
@ -33,4 +33,4 @@
</setting>
</GrasscutterTools.Properties.Settings>
</userSettings>
</configuration>
</configuration>

View File

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

View File

@ -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; }
}
}
}

View File

@ -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);
}
}

View File

@ -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<GameCommand> GiveItemCommands;
private readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt");
private List<GameCommand> 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<GameCommand> SpawnCommands;
private readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt");
private List<GameCommand> SpawnCommands;
private void InitSpawnRecord()
{
if (File.Exists(SpawnCommandsRecordPath))
@ -686,6 +690,7 @@ namespace GrasscutterTools
SpawnCommands = new List<GameCommand>();
}
}
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<GameCommand> GetCommands(string commandsText)
private List<GameCommand> GetCommands(string commandsText)
{
var lines = commandsText.Split('\n');
List<GameCommand> commands = new List<GameCommand>(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<GameCommand> commands = new List<GameCommand>(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<GameCommand> commands)
private string GetCommandsText(List<GameCommand> 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 - -
}
}

View File

@ -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);
}
}
}

View File

@ -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
}
}
}

View File

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

View File

@ -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; }
}
}
}

View File

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

View File

@ -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<int> IdList;
//List<string> 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; }
}
}
}

View File

@ -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;
}

View File

@ -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
}
}
}
}
}
}

View File

@ -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();
}
/// <summary>
/// 加载语言
/// </summary>
@ -80,4 +78,4 @@ namespace GrasscutterTools
}
}
}
}
}

View File

@ -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
}
}
}
}
}

View File

@ -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
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
}
}

View File

@ -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")]

View File

@ -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
}
}
}
}
}