void CboxScriptNameChangedHandler(object sender, EventArgs args) { var name = cboxScriptName.Text; if (name == preScriptName) { return; } if (IsChanged() && !VgcApis.Misc.UI.Confirm(I18N.DiscardUnsavedChanges)) { cboxScriptName.Text = preScriptName; return; } preScriptName = name; preScriptContent = settings.GetLuaCoreSettings() .Where(s => s.name == name) .FirstOrDefault() ?.script ?? string.Empty; editor.Text = preScriptContent; SetCurFileName(""); }
string LoadScriptByName(string name) => settings.GetLuaCoreSettings() .Where(s => s.name == name) .FirstOrDefault() ?.script ?? string.Empty;