private void TraceTest() { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; PositionInfos t = new PositionInfos(sci, sci.CurrentPos, PluginBase.MainForm.ProcessArgString(sArgsString)); String nlm = t.NewLineMarker; String s = nlm + nlm + "sci.CurrentPos: " + sci.CurrentPos + nlm + nlm; s += "ArgCurWord: " + t.ArgCurWord + nlm; s += "ArgPackageName: " + t.ArgPackageName + nlm; s += "ArgClassName: " + t.ArgClassName + nlm; s += "ArgClassType: " + t.ArgClassType + nlm; s += "ArgMemberName: " + t.ArgMemberName + nlm; s += "ArgMemberType: " + t.ArgMemberType + nlm + nlm; s += "SelectionStart: " + t.SelectionStart + nlm; s += "SelectionEnd: " + t.SelectionEnd + nlm; s += "HasSelection: " + t.HasSelection + nlm; s += "SelectionIsMultiline: " + t.SelectionIsMultiline + nlm; s += "SelectedText: " + t.SelectedText + nlm; s += "CurrentPosition: " + t.CurrentPosition + nlm; s += "CurrentCharCode: " + t.CurrentCharCode + nlm; s += "CurrentIsWhiteChar : " + t.CurrentIsWhiteChar + nlm; s += "CurrentIsDotChar : " + t.CurrentIsDotChar + nlm; s += "CurrentIsActionScriptChar : " + t.CurrentIsActionScriptChar + nlm; s += "CurrentIsWordChar : " + t.CurrentIsWordChar + nlm; s += "CurrentIsInsideComment: " + t.CurrentIsInsideComment + nlm + nlm; s += "NextPosition: " + t.NextPosition + nlm; s += "CaretIsAtEndOfDocument: " + t.CaretIsAtEndOfDocument + nlm + nlm; s += "WordStartPosition: " + t.WordStartPosition + nlm; s += "WordEndPosition: " + t.WordEndPosition + nlm; s += "WordFromPosition: " + t.WordFromPosition + nlm; s += "CaretIsAfterLastLetter: " + t.CaretIsAfterLastLetter + nlm + nlm; s += "PreviousPosition: " + t.PreviousPosition + nlm; s += "PreviousCharCode: " + t.PreviousCharCode + nlm; s += "PreviousIsWhiteChar: " + t.PreviousIsWhiteChar + nlm; s += "PreviousIsDotChar: " + t.PreviousIsDotChar + nlm; s += "PreviousIsActionScriptChar: " + t.PreviousIsActionScriptChar + nlm + nlm; s += "CurrentLineIdx: " + t.CurrentLineIdx + nlm; s += "PreviousLineIdx: " + t.PreviousLineIdx + nlm; s += "LineIdxMax: " + t.LineIdxMax + nlm; s += "LineStartPosition: " + t.LineStartPosition + nlm; s += "LineEndPosition: " + t.LineEndPosition + nlm + nlm; s += "PreviousNonWhiteCharPosition: " + t.PreviousNonWhiteCharPosition + nlm; s += "PreviousWordIsFunction: " + t.PreviousWordIsFunction + nlm; s += "NextNonWhiteCharPosition: " + t.NextNonWhiteCharPosition + nlm + nlm; s += "NextOpenBracketPosition: " + t.NextOpenBracketPosition + nlm; s += "NextCloseBracketPosition: " + t.NextCloseBracketPosition + nlm; s += "NextLeftBracePosition: " + t.NextLeftBracePosition + nlm + nlm; s += "HasArguments: " + t.HasArguments + nlm; s += "Arguments.Count: " + t.Arguments.Count + nlm + nlm; sci.InsertText(sci.TextLength, s); }
private void BaseForIn(bool aternate) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); // Settings String setAlt = this.settingObject.AlternateFunction.Trim(); if (setAlt == "") setAlt = "MyLogger.log"; Boolean setIns = this.settingObject.InsertNewLine; Boolean setCmp = this.settingObject.CompactMode; String tr0 = "for( var i:String in "; String tr1 = " ) trace( \"key : \" + i + \", value : \" + "; if (aternate) tr1 = " ) " + setAlt + "( \"key : \" + i + \", value : \" + "; String tr2 = "[ i ] );"; if (setCmp) { tr0 = "for(var i:String in "; tr1 = ") trace(\"key: \"+i+\", value: \"+"; if (aternate) tr1 = ") " + setAlt + "(\"key: \"+i+\", value: \"+"; tr2 = "[i]);"; } PositionInfos t = new PositionInfos(sci, sci.CurrentPos, PluginBase.MainForm.ProcessArgString(sArgsString)); Boolean exec = false; String sel = ""; if (t.HasSelection) { if (!t.SelectionIsMultiline) { sel = t.SelectedText.Trim(); exec = true; } } else { if (t.WordFromPosition != "") { sel = t.WordFromPosition; exec = true; } } if (exec) { HelpTools.SetCaretReadyToTrace(sci, true); String trace = tr0 + sel + tr1 + sel + tr2; sci.InsertText(sci.CurrentPos, trace); HelpTools.GoToLineEnd(sci, setIns); } sci.EndUndoAction(); }
private void BaseSimple(bool aternate) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); // Settings String setAlt = this.settingObject.AlternateFunction.Trim(); if (setAlt == "") setAlt = "MyLogger.log"; Boolean setIns = this.settingObject.InsertNewLine; Boolean setCmp = this.settingObject.CompactMode; Boolean setPkg = this.settingObject.ShowPackageName; Boolean setCls = this.settingObject.ShowClassName; PositionInfos t = new PositionInfos(sci, sci.CurrentPos, PluginBase.MainForm.ProcessArgString(sArgsString)); String trace = ""; Boolean exec = false; if (t.HasSelection) { if (!t.SelectionIsMultiline) { String sel1 = t.SelectedText.Trim(); if (sel1.EndsWith(";")) sel1 = sel1.Substring(0, sel1.Length - 1); String sel0 = sel1; if (sel0.IndexOf('"') > -1) sel0 = sel0.Replace("\"", "\\\""); String tr0 = "trace( \""; if(aternate) tr0 = setAlt + "( \""; String tr1 = " : \" + "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) tr0 = setAlt + "(\""; tr1 = ": \"+"; tr2 = ");"; } trace = tr0 + sel0 + tr1 + sel1 + tr2; exec = true; } } else { if (t.PreviousWordIsFunction) { String pckg = ""; String clas = ""; if (!t.HasArguments) { String tr0 = "trace( \""; if (aternate) tr0 = setAlt + "( \""; String tr1 = "\" );"; if (setCmp) { tr0 = "trace(\""; if (aternate) tr0 = setAlt + "(\""; tr1 = "\");"; } if (setPkg) pckg = t.ArgPackageName + "."; if (setCls) clas = t.ArgClassName + "."; trace = tr0 + pckg + clas + t.WordFromPosition + tr1; exec = true; } else { String tr0 = "trace( \""; if (aternate) tr0 = setAlt + "( \""; String tr1 = " > "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) tr0 = setAlt + "(\""; tr1 = " > "; tr2 = ");"; } if (setPkg) pckg = t.ArgPackageName + "."; if (setCls) clas = t.ArgClassName + "."; String args = ""; String a = ""; for (Int32 i = 0; i < t.Arguments.Count; i++) { a = (String)t.Arguments[i]; if (i == 0) { if (!setCmp) args += a + " : \" + " + a + " + "; else args += a + ": \"+" + a + "+"; } else { if (!setCmp) args += "\", " + a + " : \" + " + a + " + "; else args += "\", " + a + ": \"+" + a + "+"; } } if (!setCmp) args = args.Substring(0, args.Length - 3); else args = args.Substring(0, args.Length - 1); trace = tr0 + pckg + clas + t.WordFromPosition + tr1 + args + tr2; exec = true; } } else { if (t.WordFromPosition != "") { String tr0 = "trace( \""; if (aternate) tr0 = setAlt + "( \""; String tr1 = " : \" + "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) tr0 = setAlt + "(\""; tr1 = ": \"+"; tr2 = ");"; } trace = tr0 + t.WordFromPosition + tr1 + t.WordFromPosition + tr2; exec = true; } } } if (exec) { HelpTools.SetCaretReadyToTrace(sci, true); sci.InsertText(sci.CurrentPos, trace); HelpTools.GoToLineEnd(sci, setIns); } sci.EndUndoAction(); }
private void BaseForIn(bool aternate) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); // Settings String setAlt = this.settingObject.AlternateFunction.Trim(); if (setAlt == "") { setAlt = "MyLogger.log"; } Boolean setIns = this.settingObject.InsertNewLine; Boolean setCmp = this.settingObject.CompactMode; String tr0 = "for( var i:String in "; String tr1 = " ) trace( \"key : \" + i + \", value : \" + "; if (aternate) { tr1 = " ) " + setAlt + "( \"key : \" + i + \", value : \" + "; } String tr2 = "[ i ] );"; if (setCmp) { tr0 = "for(var i:String in "; tr1 = ") trace(\"key: \"+i+\", value: \"+"; if (aternate) { tr1 = ") " + setAlt + "(\"key: \"+i+\", value: \"+"; } tr2 = "[i]);"; } PositionInfos t = new PositionInfos(sci, sci.CurrentPos, PluginBase.MainForm.ProcessArgString(sArgsString)); Boolean exec = false; String sel = ""; if (t.HasSelection) { if (!t.SelectionIsMultiline) { sel = t.SelectedText.Trim(); exec = true; } } else { if (t.WordFromPosition != "") { sel = t.WordFromPosition; exec = true; } } if (exec) { HelpTools.SetCaretReadyToTrace(sci, true); String trace = tr0 + sel + tr1 + sel + tr2; sci.InsertText(sci.CurrentPos, trace); HelpTools.GoToLineEnd(sci, setIns); } sci.EndUndoAction(); }
private void BaseSimple(bool aternate) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); // Settings String setAlt = this.settingObject.AlternateFunction.Trim(); if (setAlt == "") { setAlt = "MyLogger.log"; } Boolean setIns = this.settingObject.InsertNewLine; Boolean setCmp = this.settingObject.CompactMode; Boolean setPkg = this.settingObject.ShowPackageName; Boolean setCls = this.settingObject.ShowClassName; PositionInfos t = new PositionInfos(sci, sci.CurrentPos, PluginBase.MainForm.ProcessArgString(sArgsString)); String trace = ""; Boolean exec = false; if (t.HasSelection) { if (!t.SelectionIsMultiline) { String sel1 = t.SelectedText.Trim(); if (sel1.EndsWith(";")) { sel1 = sel1.Substring(0, sel1.Length - 1); } String sel0 = sel1; if (sel0.IndexOf('"') > -1) { sel0 = sel0.Replace("\"", "\\\""); } String tr0 = "trace( \""; if (aternate) { tr0 = setAlt + "( \""; } String tr1 = " : \" + "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) { tr0 = setAlt + "(\""; } tr1 = ": \"+"; tr2 = ");"; } trace = tr0 + sel0 + tr1 + sel1 + tr2; exec = true; } } else { if (t.PreviousWordIsFunction) { String pckg = ""; String clas = ""; if (!t.HasArguments) { String tr0 = "trace( \""; if (aternate) { tr0 = setAlt + "( \""; } String tr1 = "\" );"; if (setCmp) { tr0 = "trace(\""; if (aternate) { tr0 = setAlt + "(\""; } tr1 = "\");"; } if (setPkg) { pckg = t.ArgPackageName + "."; } if (setCls) { clas = t.ArgClassName + "."; } trace = tr0 + pckg + clas + t.WordFromPosition + tr1; exec = true; } else { String tr0 = "trace( \""; if (aternate) { tr0 = setAlt + "( \""; } String tr1 = " > "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) { tr0 = setAlt + "(\""; } tr1 = " > "; tr2 = ");"; } if (setPkg) { pckg = t.ArgPackageName + "."; } if (setCls) { clas = t.ArgClassName + "."; } String args = ""; String a = ""; for (Int32 i = 0; i < t.Arguments.Count; i++) { a = (String)t.Arguments[i]; if (i == 0) { if (!setCmp) { args += a + " : \" + " + a + " + "; } else { args += a + ": \"+" + a + "+"; } } else { if (!setCmp) { args += "\", " + a + " : \" + " + a + " + "; } else { args += "\", " + a + ": \"+" + a + "+"; } } } if (!setCmp) { args = args.Substring(0, args.Length - 3); } else { args = args.Substring(0, args.Length - 1); } trace = tr0 + pckg + clas + t.WordFromPosition + tr1 + args + tr2; exec = true; } } else { if (t.WordFromPosition != "") { String tr0 = "trace( \""; if (aternate) { tr0 = setAlt + "( \""; } String tr1 = " : \" + "; String tr2 = " );"; if (setCmp) { tr0 = "trace(\""; if (aternate) { tr0 = setAlt + "(\""; } tr1 = ": \"+"; tr2 = ");"; } trace = tr0 + t.WordFromPosition + tr1 + t.WordFromPosition + tr2; exec = true; } } } if (exec) { HelpTools.SetCaretReadyToTrace(sci, true); sci.InsertText(sci.CurrentPos, trace); HelpTools.GoToLineEnd(sci, setIns); } sci.EndUndoAction(); }