static void LoadScripts() { var sw = new Stopwatch(); sw.Start(); int index = 0; configuredScripts.Clear(); foreach (string file in Directory.GetFiles(ScriptsDir, "Npp.???.*.cs").OrderBy(x => x)) { if (file.EndsWith(".disabled.cs", StringComparison.OrdinalIgnoreCase)) { continue; } if (file.EndsWith(".---.cs", StringComparison.OrdinalIgnoreCase)) { PluginBase.SetCommand(index++, "---", null); continue; } var scriptInfo = new ScriptInfo(file, index++); configuredScripts.Add(scriptInfo.Id, scriptInfo); if (scriptInfo.Shortcut == null) { PluginBase.SetCommand( scriptInfo.Id, scriptInfo.Name, () => { EnsureScriptLoaded(scriptInfo); scriptInfo.Script.Run(); }, scriptInfo.CheckedOnInit); } else { PluginBase.SetCommand( scriptInfo.Id, scriptInfo.Name, () => { EnsureScriptLoaded(scriptInfo); scriptInfo.Script.Run(); }, scriptInfo.Shortcut.Value, scriptInfo.CheckedOnInit); } } PluginBase.SetCommand(index++, "---", null); initailShowScriptManager = (Win32.GetPrivateProfileInt(sectionName, showScriptManagerKey, 0, IniFile) != 0); scriptManagerId = index++; PluginBase.SetCommand(scriptManagerId, "Script Manager", () => ManageScripts(), initailShowScriptManager); sw.Stop(); }