Clean up all code using CodeMaid

This commit is contained in:
2023-08-02 17:43:01 +08:00
parent e9a3f4014e
commit eef4687ed6
23 changed files with 176 additions and 43 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Windows.Forms;
using GrasscutterTools.Game;
using GrasscutterTools.Properties;
using GrasscutterTools.Utils;
@@ -98,4 +99,4 @@ namespace GrasscutterTools.Pages
GenSelected("/achievement progress", NUDProgress.Text);
}
}
}
}

View File

@@ -200,6 +200,5 @@ namespace GrasscutterTools.Pages
LnkNewVersion.Visible = false;
}
}
}
}

View File

@@ -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 <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -6,6 +25,7 @@ using System.Windows.Forms;
using GrasscutterTools.Properties;
using GrasscutterTools.Utils;
using Newtonsoft.Json;
namespace GrasscutterTools.Pages
@@ -61,7 +81,7 @@ namespace GrasscutterTools.Pages
{
Logger.I(TAG, "Cancel all HotKeys");
Common.KeyGo.UnRegAllKey();
if (!HotKeysChanged) return;
Logger.I(TAG, "Save all HotKeys to: " + HotKeysFilePath);
File.WriteAllText(HotKeysFilePath, JsonConvert.SerializeObject(Common.KeyGo.Items));
@@ -75,7 +95,8 @@ namespace GrasscutterTools.Pages
item.Tag,
item.HotKey,
item.Commands
}) { Checked = item.IsEnabled };
})
{ Checked = item.IsEnabled };
/// <summary>
/// 列表选中项改变时触发
@@ -225,7 +246,7 @@ namespace GrasscutterTools.Pages
{
// 如果操作失败,还原选项,禁止设置
e.NewValue = e.CurrentValue;
Logger.E(TAG, (isEnable ? "Enable" : "Disable") +" HotKey failed", ex);
Logger.E(TAG, (isEnable ? "Enable" : "Disable") + " HotKey failed", ex);
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@@ -240,4 +261,4 @@ namespace GrasscutterTools.Pages
TxtTag.Text = tag;
}
}
}
}

View File

@@ -75,7 +75,6 @@ namespace GrasscutterTools.Pages
Scenes = GameData.Dungeons.Lines;
}
/// <summary>
/// 选中过场时触发
/// </summary>

View File

@@ -1,7 +1,7 @@
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
using GrasscutterTools.Game.Props;
using GrasscutterTools.Properties;
@@ -94,4 +94,4 @@ namespace GrasscutterTools.Pages
LblPlayerPropertyDesc.Text = selectedItem.Description;
}
}
}
}

View File

@@ -4,11 +4,13 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GrasscutterTools.Game;
using GrasscutterTools.Game.Activity;
using GrasscutterTools.Game.CutScene;
using GrasscutterTools.Game.Dungeon;
using GrasscutterTools.Properties;
using Newtonsoft.Json;
namespace GrasscutterTools.Pages
@@ -77,8 +79,6 @@ namespace GrasscutterTools.Pages
}
}
private void BtnConvertCutScene_Click(object sender, EventArgs e)
{
var src = new OpenFileDialog
@@ -114,7 +114,7 @@ namespace GrasscutterTools.Pages
Settings.Default.ProjectResourcePath = TxtProjectResRoot.Text;
return true;
}
else
else
{
MessageBox.Show("请填写正确的Res路径", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
@@ -156,7 +156,7 @@ namespace GrasscutterTools.Pages
var dungeonFilePath = Path.Combine(TxtProjectResRoot.Text, language, "Dungeon.txt");
File.WriteAllLines(
dungeonFilePath,
dungeonFilePath,
dungeons.Select(it => $"{it.Id}:{TextMapData.GetText(it.NameTextMapHash)}"),
Encoding.UTF8);
}
@@ -214,4 +214,4 @@ namespace GrasscutterTools.Pages
// Encoding.UTF8);
}
}
}
}