Implement import from GOOD dump (#86)

* Implement import from GOOD dump

* Optimized implementation

* Add available urls

* Add prompt

Co-authored-by: Leo <chun.huang@student.manchester.ac.uk>
Co-authored-by: 筱傑 <jie65535@qq.com>
This commit is contained in:
gotoAndDie
2022-07-23 10:18:51 +08:00
committed by GitHub
parent 9eba1d6368
commit 2cb9f08caa
18 changed files with 6281 additions and 5378 deletions

View File

@@ -35,6 +35,7 @@ namespace GrasscutterTools.Forms
this.GrpCommand = new System.Windows.Forms.GroupBox();
this.BtnInvokeOpenCommand = new System.Windows.Forms.Button();
this.TPRemoteCall = new System.Windows.Forms.TabPage();
this.ButtonOpenGOODImport = new System.Windows.Forms.Button();
this.LblHostTip = new System.Windows.Forms.Label();
this.GrpServerStatus = new System.Windows.Forms.GroupBox();
this.LnkOpenCommandLabel = new System.Windows.Forms.LinkLabel();
@@ -70,7 +71,6 @@ namespace GrasscutterTools.Forms
this.DTPBanEndTime = new System.Windows.Forms.DateTimePicker();
this.BtnUnban = new System.Windows.Forms.Button();
this.BtnBan = new System.Windows.Forms.Button();
this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP();
this.NUDBanUID = new System.Windows.Forms.NumericUpDown();
this.LblBanUID = new System.Windows.Forms.Label();
this.GrpAccount = new System.Windows.Forms.GroupBox();
@@ -221,6 +221,7 @@ namespace GrasscutterTools.Forms
this.ChkIncludeUID = new System.Windows.Forms.CheckBox();
this.LblDefaultUid = new System.Windows.Forms.Label();
this.TCMain = new System.Windows.Forms.TabControl();
this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP();
this.GrpCommand.SuspendLayout();
this.TPRemoteCall.SuspendLayout();
this.GrpServerStatus.SuspendLayout();
@@ -317,16 +318,24 @@ namespace GrasscutterTools.Forms
//
// TPRemoteCall
//
resources.ApplyResources(this.TPRemoteCall, "TPRemoteCall");
this.TPRemoteCall.Controls.Add(this.ButtonOpenGOODImport);
this.TPRemoteCall.Controls.Add(this.LblHostTip);
this.TPRemoteCall.Controls.Add(this.GrpServerStatus);
this.TPRemoteCall.Controls.Add(this.GrpRemoteCommand);
this.TPRemoteCall.Controls.Add(this.TxtHost);
this.TPRemoteCall.Controls.Add(this.BtnQueryServerStatus);
this.TPRemoteCall.Controls.Add(this.LblHost);
resources.ApplyResources(this.TPRemoteCall, "TPRemoteCall");
this.TPRemoteCall.Name = "TPRemoteCall";
this.TPRemoteCall.UseVisualStyleBackColor = true;
//
// ButtonOpenGOODImport
//
resources.ApplyResources(this.ButtonOpenGOODImport, "ButtonOpenGOODImport");
this.ButtonOpenGOODImport.Name = "ButtonOpenGOODImport";
this.ButtonOpenGOODImport.UseVisualStyleBackColor = true;
this.ButtonOpenGOODImport.Click += new System.EventHandler(this.ButtonOpenGOODImport_Click);
//
// LblHostTip
//
resources.ApplyResources(this.LblHostTip, "LblHostTip");
@@ -386,15 +395,14 @@ namespace GrasscutterTools.Forms
//
// TPOpenCommandCheck
//
resources.ApplyResources(this.TPOpenCommandCheck, "TPOpenCommandCheck");
this.TPOpenCommandCheck.Controls.Add(this.TPPlayerCheck);
this.TPOpenCommandCheck.Controls.Add(this.TPConsoleCheck);
resources.ApplyResources(this.TPOpenCommandCheck, "TPOpenCommandCheck");
this.TPOpenCommandCheck.Name = "TPOpenCommandCheck";
this.TPOpenCommandCheck.SelectedIndex = 0;
//
// TPPlayerCheck
//
resources.ApplyResources(this.TPPlayerCheck, "TPPlayerCheck");
this.TPPlayerCheck.Controls.Add(this.LnkRCHelp);
this.TPPlayerCheck.Controls.Add(this.NUDRemotePlayerId);
this.TPPlayerCheck.Controls.Add(this.BtnConnectOpenCommand);
@@ -402,6 +410,7 @@ namespace GrasscutterTools.Forms
this.TPPlayerCheck.Controls.Add(this.BtnSendVerificationCode);
this.TPPlayerCheck.Controls.Add(this.NUDVerificationCode);
this.TPPlayerCheck.Controls.Add(this.LblRemotePlayerId);
resources.ApplyResources(this.TPPlayerCheck, "TPPlayerCheck");
this.TPPlayerCheck.Name = "TPPlayerCheck";
this.TPPlayerCheck.UseVisualStyleBackColor = true;
//
@@ -473,11 +482,11 @@ namespace GrasscutterTools.Forms
//
// TPConsoleCheck
//
resources.ApplyResources(this.TPConsoleCheck, "TPConsoleCheck");
this.TPConsoleCheck.Controls.Add(this.BtnConsoleConnect);
this.TPConsoleCheck.Controls.Add(this.TxtToken);
this.TPConsoleCheck.Controls.Add(this.LblToken);
this.TPConsoleCheck.Controls.Add(this.LblConsoleTip);
resources.ApplyResources(this.TPConsoleCheck, "TPConsoleCheck");
this.TPConsoleCheck.Name = "TPConsoleCheck";
this.TPConsoleCheck.UseVisualStyleBackColor = true;
//
@@ -522,10 +531,10 @@ namespace GrasscutterTools.Forms
//
// TPAbout
//
resources.ApplyResources(this.TPAbout, "TPAbout");
this.TPAbout.Controls.Add(this.GrasscutterToolsSupport);
this.TPAbout.Controls.Add(this.LnkGithub);
this.TPAbout.Controls.Add(this.LblSupportDescription);
resources.ApplyResources(this.TPAbout, "TPAbout");
this.TPAbout.Name = "TPAbout";
this.TPAbout.UseVisualStyleBackColor = true;
//
@@ -550,10 +559,10 @@ namespace GrasscutterTools.Forms
//
// TPManage
//
resources.ApplyResources(this.TPManage, "TPManage");
this.TPManage.Controls.Add(this.GrpBanPlayer);
this.TPManage.Controls.Add(this.GrpAccount);
this.TPManage.Controls.Add(this.GrpPermission);
resources.ApplyResources(this.TPManage, "TPManage");
this.TPManage.Name = "TPManage";
this.TPManage.UseVisualStyleBackColor = true;
//
@@ -571,8 +580,8 @@ namespace GrasscutterTools.Forms
//
// DTPBanEndTime
//
resources.ApplyResources(this.DTPBanEndTime, "DTPBanEndTime");
this.DTPBanEndTime.Format = System.Windows.Forms.DateTimePickerFormat.Short;
resources.ApplyResources(this.DTPBanEndTime, "DTPBanEndTime");
this.DTPBanEndTime.MaxDate = new System.DateTime(2034, 12, 31, 0, 0, 0, 0);
this.DTPBanEndTime.MinDate = new System.DateTime(2022, 6, 28, 0, 0, 0, 0);
this.DTPBanEndTime.Name = "DTPBanEndTime";
@@ -592,14 +601,6 @@ namespace GrasscutterTools.Forms
this.BtnBan.UseVisualStyleBackColor = true;
this.BtnBan.Click += new System.EventHandler(this.BtnBan_Click);
//
// TxtBanReason
//
resources.ApplyResources(this.TxtBanReason, "TxtBanReason");
this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TxtBanReason.Maximum = 0F;
this.TxtBanReason.Minimum = 0F;
this.TxtBanReason.Name = "TxtBanReason";
//
// NUDBanUID
//
resources.ApplyResources(this.NUDBanUID, "NUDBanUID");
@@ -693,10 +694,10 @@ namespace GrasscutterTools.Forms
//
// CmbPerm
//
resources.ApplyResources(this.CmbPerm, "CmbPerm");
this.CmbPerm.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CmbPerm.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CmbPerm.FormattingEnabled = true;
resources.ApplyResources(this.CmbPerm, "CmbPerm");
this.CmbPerm.Name = "CmbPerm";
//
// NUDPermUID
@@ -742,7 +743,6 @@ namespace GrasscutterTools.Forms
//
// TPScene
//
resources.ApplyResources(this.TPScene, "TPScene");
this.TPScene.Controls.Add(this.TxtSceneFilter);
this.TPScene.Controls.Add(this.ChkIncludeSceneId);
this.TPScene.Controls.Add(this.LblTp);
@@ -757,6 +757,7 @@ namespace GrasscutterTools.Forms
this.TPScene.Controls.Add(this.LblClimateType);
this.TPScene.Controls.Add(this.LblSceneDescription);
this.TPScene.Controls.Add(this.ListScenes);
resources.ApplyResources(this.TPScene, "TPScene");
this.TPScene.Name = "TPScene";
this.TPScene.UseVisualStyleBackColor = true;
//
@@ -891,7 +892,6 @@ namespace GrasscutterTools.Forms
//
// TPItem
//
resources.ApplyResources(this.TPItem, "TPItem");
this.TPItem.Controls.Add(this.LblClearGiveItemLogs);
this.TPItem.Controls.Add(this.BtnSaveGiveItemLog);
this.TPItem.Controls.Add(this.BtnRemoveGiveItemLog);
@@ -904,6 +904,7 @@ namespace GrasscutterTools.Forms
this.TPItem.Controls.Add(this.NUDGameItemAmout);
this.TPItem.Controls.Add(this.NUDGameItemLevel);
this.TPItem.Controls.Add(this.LblGiveCommandDescription);
resources.ApplyResources(this.TPItem, "TPItem");
this.TPItem.Name = "TPItem";
this.TPItem.UseVisualStyleBackColor = true;
//
@@ -1021,7 +1022,6 @@ namespace GrasscutterTools.Forms
//
// TPWeapon
//
resources.ApplyResources(this.TPWeapon, "TPWeapon");
this.TPWeapon.Controls.Add(this.TxtWeaponFilter);
this.TPWeapon.Controls.Add(this.LblWeaponDescription);
this.TPWeapon.Controls.Add(this.LblWeaponRefinement);
@@ -1031,6 +1031,7 @@ namespace GrasscutterTools.Forms
this.TPWeapon.Controls.Add(this.NUDWeaponAmout);
this.TPWeapon.Controls.Add(this.NUDWeaponLevel);
this.TPWeapon.Controls.Add(this.ListWeapons);
resources.ApplyResources(this.TPWeapon, "TPWeapon");
this.TPWeapon.Name = "TPWeapon";
this.TPWeapon.UseVisualStyleBackColor = true;
//
@@ -1127,12 +1128,12 @@ namespace GrasscutterTools.Forms
//
// TPStats
//
resources.ApplyResources(this.TPStats, "TPStats");
this.TPStats.Controls.Add(this.LblResetStatsCommand);
this.TPStats.Controls.Add(this.LblResetStatsTip);
this.TPStats.Controls.Add(this.GrpSetStats);
this.TPStats.Controls.Add(this.GrpTalentLevel);
this.TPStats.Controls.Add(this.LblStatsDescription);
resources.ApplyResources(this.TPStats, "TPStats");
this.TPStats.Name = "TPStats";
this.TPStats.UseVisualStyleBackColor = true;
//
@@ -1161,9 +1162,9 @@ namespace GrasscutterTools.Forms
//
// LblStatTip
//
resources.ApplyResources(this.LblStatTip, "LblStatTip");
this.LblStatTip.AutoEllipsis = true;
this.LblStatTip.ForeColor = System.Drawing.SystemColors.GrayText;
resources.ApplyResources(this.LblStatTip, "LblStatTip");
this.LblStatTip.Name = "LblStatTip";
//
// LblStatPercent
@@ -1189,9 +1190,9 @@ namespace GrasscutterTools.Forms
//
// CmbStat
//
resources.ApplyResources(this.CmbStat, "CmbStat");
this.CmbStat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbStat.FormattingEnabled = true;
resources.ApplyResources(this.CmbStat, "CmbStat");
this.CmbStat.Name = "CmbStat";
this.CmbStat.SelectedIndexChanged += new System.EventHandler(this.SetStatsInputChanged);
//
@@ -1251,7 +1252,6 @@ namespace GrasscutterTools.Forms
//
// TPAvatar
//
resources.ApplyResources(this.TPAvatar, "TPAvatar");
this.TPAvatar.Controls.Add(this.BtnGiveAllChar);
this.TPAvatar.Controls.Add(this.LblConstellationTip);
this.TPAvatar.Controls.Add(this.LblAvatarConstellation);
@@ -1261,6 +1261,7 @@ namespace GrasscutterTools.Forms
this.TPAvatar.Controls.Add(this.LblAvatarLevel);
this.TPAvatar.Controls.Add(this.NUDAvatarLevel);
this.TPAvatar.Controls.Add(this.CmbAvatar);
resources.ApplyResources(this.TPAvatar, "TPAvatar");
this.TPAvatar.Name = "TPAvatar";
this.TPAvatar.UseVisualStyleBackColor = true;
//
@@ -1346,7 +1347,6 @@ namespace GrasscutterTools.Forms
//
// TPSpawn
//
resources.ApplyResources(this.TPSpawn, "TPSpawn");
this.TPSpawn.Controls.Add(this.LblClearSpawnLogs);
this.TPSpawn.Controls.Add(this.BtnSaveSpawnLog);
this.TPSpawn.Controls.Add(this.BtnRemoveSpawnLog);
@@ -1359,6 +1359,7 @@ namespace GrasscutterTools.Forms
this.TPSpawn.Controls.Add(this.NUDEntityLevel);
this.TPSpawn.Controls.Add(this.TxtEntityFilter);
this.TPSpawn.Controls.Add(this.ListEntity);
resources.ApplyResources(this.TPSpawn, "TPSpawn");
this.TPSpawn.Name = "TPSpawn";
this.TPSpawn.UseVisualStyleBackColor = true;
//
@@ -1499,13 +1500,13 @@ namespace GrasscutterTools.Forms
//
// TPQuest
//
resources.ApplyResources(this.TPQuest, "TPQuest");
this.TPQuest.Controls.Add(this.GrpQuestFilters);
this.TPQuest.Controls.Add(this.BtnFinishQuest);
this.TPQuest.Controls.Add(this.BtnAddQuest);
this.TPQuest.Controls.Add(this.LblQuestDescription);
this.TPQuest.Controls.Add(this.TxtQuestFilter);
this.TPQuest.Controls.Add(this.ListQuest);
resources.ApplyResources(this.TPQuest, "TPQuest");
this.TPQuest.Name = "TPQuest";
this.TPQuest.UseVisualStyleBackColor = true;
//
@@ -1577,7 +1578,6 @@ namespace GrasscutterTools.Forms
//
// TPArtifact
//
resources.ApplyResources(this.TPArtifact, "TPArtifact");
this.TPArtifact.Controls.Add(this.LblArtifactLevelTip);
this.TPArtifact.Controls.Add(this.BtnAddSubAttr);
this.TPArtifact.Controls.Add(this.LblArtifactName);
@@ -1597,6 +1597,7 @@ namespace GrasscutterTools.Forms
this.TPArtifact.Controls.Add(this.NUDArtifactLevel);
this.TPArtifact.Controls.Add(this.LblArtifactStars);
this.TPArtifact.Controls.Add(this.NUDArtifactStars);
resources.ApplyResources(this.TPArtifact, "TPArtifact");
this.TPArtifact.Name = "TPArtifact";
this.TPArtifact.UseVisualStyleBackColor = true;
//
@@ -1762,7 +1763,6 @@ namespace GrasscutterTools.Forms
//
// TPCustom
//
resources.ApplyResources(this.TPCustom, "TPCustom");
this.TPCustom.Controls.Add(this.BtnExportCustomCommands);
this.TPCustom.Controls.Add(this.BtnLoadCustomCommands);
this.TPCustom.Controls.Add(this.LblCustomName);
@@ -1770,6 +1770,7 @@ namespace GrasscutterTools.Forms
this.TPCustom.Controls.Add(this.BtnRemoveCustomCommand);
this.TPCustom.Controls.Add(this.BtnSaveCustomCommand);
this.TPCustom.Controls.Add(this.TxtCustomName);
resources.ApplyResources(this.TPCustom, "TPCustom");
this.TPCustom.Name = "TPCustom";
this.TPCustom.UseVisualStyleBackColor = true;
//
@@ -1833,12 +1834,12 @@ namespace GrasscutterTools.Forms
//
// TPHome
//
resources.ApplyResources(this.TPHome, "TPHome");
this.TPHome.Controls.Add(this.LblAbout);
this.TPHome.Controls.Add(this.BtnOpenTextMap);
this.TPHome.Controls.Add(this.BtnOpenGachaBannerEditor);
this.TPHome.Controls.Add(this.GrasscutterToolsIcon);
this.TPHome.Controls.Add(this.GrpSettings);
resources.ApplyResources(this.TPHome, "TPHome");
this.TPHome.Name = "TPHome";
this.TPHome.UseVisualStyleBackColor = true;
//
@@ -1897,9 +1898,9 @@ namespace GrasscutterTools.Forms
//
// CmbLanguage
//
resources.ApplyResources(this.CmbLanguage, "CmbLanguage");
this.CmbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbLanguage.FormattingEnabled = true;
resources.ApplyResources(this.CmbLanguage, "CmbLanguage");
this.CmbLanguage.Name = "CmbLanguage";
this.CmbLanguage.SelectedIndexChanged += new System.EventHandler(this.CmbLanguage_SelectedIndexChanged);
//
@@ -1953,6 +1954,14 @@ namespace GrasscutterTools.Forms
this.TCMain.Name = "TCMain";
this.TCMain.SelectedIndex = 0;
//
// TxtBanReason
//
this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
resources.ApplyResources(this.TxtBanReason, "TxtBanReason");
this.TxtBanReason.Maximum = 0F;
this.TxtBanReason.Minimum = 0F;
this.TxtBanReason.Name = "TxtBanReason";
//
// FormMain
//
resources.ApplyResources(this, "$this");
@@ -2244,5 +2253,6 @@ namespace GrasscutterTools.Forms
private System.Windows.Forms.Label LblConstellationTip;
private System.Windows.Forms.Button BtnGiveAllChar;
private System.Windows.Forms.Label LblHostTip;
private System.Windows.Forms.Button ButtonOpenGOODImport;
}
}

View File

@@ -21,6 +21,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@@ -28,8 +29,11 @@ using System.Windows.Forms;
using GrasscutterTools.DispatchServer;
using GrasscutterTools.Game;
using GrasscutterTools.GOOD;
using GrasscutterTools.OpenCommand;
using GrasscutterTools.Properties;
using GrasscutterTools.Utils;
using Newtonsoft.Json;
namespace GrasscutterTools.Forms
{
@@ -202,6 +206,125 @@ namespace GrasscutterTools.Forms
TextMapBrowser.TopMost = false;
}
}
async private void ButtonOpenGOODImport_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog
{
Filter = "GOOD file (*.GOOD;*.json)|*.GOOD;*.json|All files (*.*)|*.*",
};
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (DialogResult.Yes != MessageBox.Show(Resources.GOODImportText + openFileDialog1.FileName + "?",
Resources.GOODImportTitle, MessageBoxButtons.YesNo))
return;
try
{
GOOD.GOOD good = JsonConvert.DeserializeObject<GOOD.GOOD>(File.ReadAllText(openFileDialog1.FileName));
var commands_list = new List<string>();
var missingItems = new List<string>();
if (good.Characters != null)
{
foreach (var character in good.Characters)
{
if (character.Name != "Traveler")
{
if (GOODData.Avatars.TryGetValue(character.Name, out var character_id))
commands_list.Add("/give " + character_id + " lv" + character.Level + "c" + character.Constellation);
else
missingItems.Add(character.Name);
// TODO: Implement command to set talent level when giving character in Grasscutter
}
}
}
if (good.Weapons != null)
{
foreach (var weapon in good.Weapons)
{
if (GOODData.Weapons.TryGetValue(weapon.Name, out var weapon_id))
commands_list.Add("/give " + weapon_id + " lv" + weapon.Level + "r" + weapon.RefinementLevel);
else
missingItems.Add(weapon.Name);
// TODO: Implement command to give weapon directly to character in Grasscutter
}
}
if (good.Artifacts != null)
{
foreach (var artifact in good.Artifacts)
{
// Format: set rarity slot
if (!GOODData.ArtifactCats.TryGetValue(artifact.SetName, out var artifact_set_id))
{
missingItems.Add(artifact.SetName);
continue;
}
var artifact_id = artifact_set_id.ToString() + artifact.Rarity.ToString() + GOODData.ArtifactSlotMap[artifact.GearSlot] + "4";
var artifact_mainStat_id = GOODData.ArtifactMainAttribution[artifact.MainStat];
var artifact_substats = "";
var artifact_substat_prefix = artifact.Rarity + "0";
int substat_count = 0;
foreach (var substat in artifact.SubStats)
{
if (substat.Value <= 0)
continue;
substat_count++;
var substat_key = substat.Stat;
var substat_key_id = GOODData.ArtifactSubAttribution[substat_key];
var substat_indices = ArtifactUtils.SplitSubstats(substat_key, artifact.Rarity, substat.Value);
foreach (int index in substat_indices)
{
artifact_substats += artifact_substat_prefix + substat_key_id + index.ToString() + " ";
}
}
// HACK: Add def+2 substat to counteract Grasscutter automatically adding another substat
if (substat_count == 4)
artifact_substats += "101081 ";
commands_list.Add("/give " + artifact_id + " lv" + artifact.Level + " " + artifact_mainStat_id + " " + artifact_substats);
// TODO: Implement command to give artifact directly to character in Grasscutter
}
}
// TODO: Materials
//if (good.Materials != null)
//{
// foreach (var material in good.Materials)
// {
// }
//}
var msg = string.Format("Loaded {0} Characters\nLoaded {1} Weapons\nLoaded {2} Artifacts\n",
good.Characters?.Count ?? 0,
good.Weapons?.Count ?? 0,
good.Artifacts?.Count ?? 0
);
if (missingItems.Count > 0)
{
msg += string.Format("There are {0} pieces of data that cannot be parsed, including:\n{1}",
missingItems.Count,
string.Join("\n", missingItems.Take(10)));
if (missingItems.Count > 10)
msg += "......";
}
msg += "Do you want to start?";
if (DialogResult.Yes != MessageBox.Show(msg, Resources.Tips, MessageBoxButtons.YesNo, MessageBoxIcon.Information))
return;
if (await RunCommands(commands_list.ToArray()))
MessageBox.Show(Resources.GOODImportSuccess);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CmbLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -1093,42 +1216,55 @@ namespace GrasscutterTools.Forms
private async void BtnInvokeOpenCommand_Click(object sender, EventArgs e)
{
if (OC == null || !OC.CanInvoke)
{
ShowTip(Resources.RequireOpenCommandTip, BtnInvokeOpenCommand);
TCMain.SelectedTab = TPRemoteCall;
return;
}
if (!BtnInvokeOpenCommand.Enabled) return;
if (TxtCommand.Text.Length < 2)
{
ShowTip(Resources.CommandContentCannotBeEmpty, TxtCommand);
return;
}
await RunCommands(TxtCommand.Text);
}
private async Task<bool> RunCommands(params string[] commands)
{
if (OC == null || !OC.CanInvoke)
{
ShowTip(Resources.RequireOpenCommandTip, BtnInvokeOpenCommand);
TCMain.SelectedTab = TPRemoteCall;
return false;
}
ExpandCommandRunLog();
TxtCommandRunLog.AppendText(">");
TxtCommandRunLog.AppendText(TxtCommand.Text);
TxtCommandRunLog.AppendText(Environment.NewLine);
var cmd = TxtCommand.Text.Substring(1);
var btn = sender as Button;
btn.Enabled = false;
try
BtnInvokeOpenCommand.Enabled = false;
BtnInvokeOpenCommand.Cursor = Cursors.WaitCursor;
int i = 0;
foreach (var command in commands)
{
var msg = await OC.Invoke(cmd);
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
TxtCommandRunLog.AppendText(">");
TxtCommandRunLog.AppendText(command);
if (commands.Length > 1)
TxtCommandRunLog.AppendText($" ({++i}/{commands.Length})");
TxtCommandRunLog.AppendText(Environment.NewLine);
//ShowTip(string.IsNullOrEmpty(msg) ? "OK" : msg, btn);
var cmd = command.Substring(1);
try
{
var msg = await OC.Invoke(cmd);
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
TxtCommandRunLog.AppendText(Environment.NewLine);
}
catch (Exception ex)
{
TxtCommandRunLog.AppendText("Error: ");
TxtCommandRunLog.AppendText(ex.Message);
TxtCommandRunLog.AppendText(Environment.NewLine);
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
TxtCommandRunLog.ScrollToCaret();
}
catch (Exception ex)
{
TxtCommandRunLog.AppendText("Error: ");
TxtCommandRunLog.AppendText(ex.Message);
TxtCommandRunLog.AppendText(Environment.NewLine);
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
TxtCommandRunLog.ScrollToCaret();
btn.Cursor = Cursors.Default;
btn.Enabled = true;
BtnInvokeOpenCommand.Cursor = Cursors.Default;
BtnInvokeOpenCommand.Enabled = true;
return true;
}
private const int TxtCommandRunLogMinHeight = 150;
@@ -1332,6 +1468,7 @@ namespace GrasscutterTools.Forms
GrpRemoteCommand.Enabled = false;
BtnInvokeOpenCommand.Focus();
ShowTip(Resources.ConnectedTip, BtnInvokeOpenCommand);
ButtonOpenGOODImport.Enabled = true;
}
catch (Exception ex)
{
@@ -1412,6 +1549,5 @@ namespace GrasscutterTools.Forms
}
#endregion - -
}
}

View File

@@ -856,4 +856,7 @@ Therefore, the quest can be added and finished, but not necessarily work.</value
<data name="ChkIncludeUID.Text" xml:space="preserve">
<value>Include UID</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>Import GOOD</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@@ -218,7 +218,7 @@
<value>Подключить</value>
</data>
<data name="LblConsoleTip.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt, style=Italic</value>
<value>Microsoft YaHei, 8pt, style=Italic</value>
</data>
<data name="LblConsoleTip.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 34</value>
@@ -397,7 +397,7 @@
<value>False</value>
</data>
<data name="LblTp.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
<value>Microsoft YaHei, 8pt</value>
</data>
<data name="LblTp.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 89</value>
@@ -980,4 +980,7 @@
<data name="$this.Text" xml:space="preserve">
<value>GrasscutterTools - перевод Юрий Дворецкий</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>импорт GOOD</value>
</data>
</root>

View File

@@ -406,4 +406,7 @@
<data name="TPHome.Text" xml:space="preserve">
<value>主頁</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>導入GOOD檔案</value>
</data>
</root>