internal static void DisplayEdit() { DialogResult buttonPress = (IBMi.GetConfig("dspfNotice") == "yes" ? DialogResult.Yes : DialogResult.No); if (buttonPress == DialogResult.No) { buttonPress = MessageBox.Show("Do you understand that you use the Display File Editor at your own risk? Currently, the Display File Editor is not ready for production use and therefore holds no responsibility of changes made to source when saving.", "Notice!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (buttonPress == DialogResult.Yes) { IBMi.SetConfig("dspfNotice", "yes"); } } if (buttonPress == DialogResult.Yes) { dspfEdit Editor = new dspfEdit(); string path = NppFunctions.GetCurrentFileName(); if (path.Trim() != "") { DisplayParse parser = new LanguageTools.DisplayParse(); parser.ParseFile(path); Editor = new dspfEdit(parser.GetRecordFormats(), path); NppFunctions.RefreshWindow(path); } Editor.ShowDialog(); } }
/// <summary> /// Installs the remote objects that the plugin requires on the server /// </summary> internal static void InstallRemoteLib(string library = "QGPL") { Thread thread = new Thread((ThreadStart) delegate { IBMiUtilities.DebugLog($"InstallRemoteLib -> {library}!"); try { List <string> sourceFiles = GenerateRemoteSource(); IBMi.RunCommands(IBMiCommandRender.RenderRemoteInstallScript(sourceFiles, library)); // Cleanup temp files foreach (string file in sourceFiles) { File.Delete(file); } IBMi.SetConfig("installlib", library); } catch (Exception e) { IBMiUtilities.Log(e.ToString()); // TODO: Show error? } IBMiUtilities.DebugLog("InstallRemoteLib - DONE!"); }); thread.Start(); }
internal static void InstallLocalDefinitions() { IBMiUtilities.DebugLog("InstallLocalDefinitions starting..."); string functionList = $"%APPDATA%/Roaming/Notepad++/functionList.xml"; List <string> outputBuffer = new List <string>(); StringBuilder sb = new StringBuilder(); bool associationFound = false; bool parserFound = false; IBMiUtilities.DebugLog("InstallLocalDefinitions parsing functionList..."); foreach (string line in File.ReadAllLines(functionList)) { if (!associationFound) { if (line.Contains("<association ext=\".sqlrpgle\"")) { associationFound = true; } } if (line.Contains("</associationMap>") && !associationFound) { IBMiUtilities.DebugLog("InstallLocalDefinitions writing association to functionList..."); outputBuffer.Add("<association ext=\".sqlrpgle\" userDefinedLangName=\"sqlrpgle\" id=\"sqlrpgle\"/>"); } if (!parserFound) { if (line.Contains("<parser id=\"sqlrpgle\"")) { parserFound = true; } } if (line.Contains("</parser>") && !parserFound) { IBMiUtilities.DebugLog("InstallLocalDefinitions writing parser to functionList..."); outputBuffer.Add("\t\t\t<parser id=\"sqlrpgle\" displayName=\"SQLRPGLE\">"); outputBuffer.Add("\t\t\t\t<function"); outputBuffer.Add("\t\t\t\t\tmainExpr=\"(\bdcl - proc\\s)(\\w +)\""); outputBuffer.Add("\t\t\t\t\tdisplayMode=\"$functionName\">"); outputBuffer.Add("\t\t\t\t\t<functionName>"); outputBuffer.Add("\t\t\t\t\t\t<nameExpr expr=\"(?<= dcl - proc).*\"/>"); outputBuffer.Add("\t\t\t\t\t</functionName>"); outputBuffer.Add("\t\t\t\t</function>"); outputBuffer.Add("\t\t\t</parser>"); } outputBuffer.Add(line); } IBMiUtilities.DebugLog("InstallLocalDefinitions parsing functionList comeplted!"); File.WriteAllLines(functionList, outputBuffer); IBMi.SetConfig("localDefintionsInstalled", "true"); IBMiUtilities.DebugLog("InstallLocalDefinitions completed!"); }