public static bool showCodeSnippetForSelectedFunction(ICirFunction cirFunctionToProcess, bool showCodeSnippet, TreeView treeView, TreeNode currentTreeNode, TreeNode previousTreeNode) { if (cirFunctionToProcess.File != null && File.Exists(cirFunctionToProcess.File)) { int fileStartLine; if (Int32.TryParse(cirFunctionToProcess.FileLine, out fileStartLine)) { int mappedLineNumber = ViewHelpers.GetMappedLineNumber(cirFunctionToProcess.FunctionName, cirFunctionToProcess.File, cirFunctionToProcess.FileLine, false, true); if (mappedLineNumber > 0) { O2Forms.setTreeNodeColor(treeView, currentTreeNode, Color.DarkMagenta); O2Forms.setTreeNodeColor(treeView, previousTreeNode, Color.DarkGreen); if (showCodeSnippet) { mappedLineNumber--; var fileLines = Files.getFileLines(cirFunctionToProcess.File); var numberOfLinesAfter = fileLines.Count - mappedLineNumber; var numberOfLinesToShow = (numberOfLinesAfter > 10) ? 10 : numberOfLinesAfter; var linesToShow = fileLines.GetRange(mappedLineNumber, numberOfLinesToShow); var codeSnippet = StringsAndLists.fromStringList_getText(linesToShow); O2Forms.setToolTipText(treeView, currentTreeNode, codeSnippet); } else { O2Forms.setToolTipText(treeView, currentTreeNode, ""); } return(true); } } } return(false); }
public static string fileSnippet(this string file, int startLine, int endLine) { if (file.fileExists().isFalse()) { "in fileSnippet, request file didn't exist: {0}".format(file).error(); return(""); } if (startLine == endLine) { "in fileSnippet, provided start line is equal to end end line: {0}".format(startLine).error(); return(""); } var fileLines = file.fileContents().split_onLines(); var numberOfLines = fileLines.size(); if (startLine > endLine || numberOfLines < endLine) { "in fileSnippet, problem with the provided start line ({0}), end line ({1}) or file lines ({2}) values" .format(startLine, endLine, numberOfLines).error(); return(""); } var snippet = fileLines.GetRange(startLine, endLine - startLine); "snippet size : {0}".format(snippet.size()).debug(); return(StringsAndLists.fromStringList_getText(snippet).trim()); }
public static string tabLeft(this string targetString) { var newLines = new List <string>(); foreach (var line in targetString.lines()) { newLines.Add("\t{0}".format(line)); } return(StringsAndLists.fromStringList_getText(newLines)); }
public static T showValues <T>(this DotNet_ViewState dotNetViewState, T control) where T : System.Windows.Forms.Control { control.clear(); control.add_TextArea() .scrollBars() .set_Text(StringsAndLists.fromStringList_getText(dotNetViewState.ViewState_Values)); return(control); }
public void loadDefaultTaintRules() { var defaultTaintRules = new List <string>(); defaultTaintRules.Add("System.String.Concat"); defaultTaintRules.Add("System.String.Format"); TaintRulesList.set_Text(StringsAndLists.fromStringList_getText(defaultTaintRules)); //taintRules.add_TaintPropagator("System.Int32.Parse"); //TaintRules.add_TaintPropagator(); }
public int calculateFirstMethodOffset() { //var offset = 0; var lines = CodeCompleteTargetText.lines(); var linesToRemove = lines.size() - CodeCompleteCaretLocationOffset.Line + 1; lines.RemoveRange(CodeCompleteCaretLocationOffset.Line - 1, linesToRemove); var topText = StringsAndLists.fromStringList_getText(lines); //for (int i = 0; i < CodeCompleteCaretLocationOffset.Line; i++) // offset += lines[i].Length + 1; // offset--; // var test = CodeCompleteTargetText.Substring(offset); return(topText.Length); }
public static T show <T>(this DotNet_ViewState dotNetViewState, T control) where T : System.Windows.Forms.Control { control.clear(); var topControls = control.add_1x1("ViewState", "ControlState", false); var viewStateControls = topControls[0].add_1x1x1("TreeView", "Xml", "Values"); var controlStateControls = topControls[1].add_1x1x1("TreeView", "Xml", "Values"); var viewState_TreeView = viewStateControls[0].add_TreeView().visible(false); var controlState_TreeTree = controlStateControls[0].add_TreeView().visible(false); var viewState_XmlViewer = viewStateControls[1].add_SourceCodeViewer().visible(false); var controlState_XmlViewer = controlStateControls[1].add_SourceCodeViewer().visible(false); var viewState_TextBox = viewStateControls[2].add_TextArea() .scrollBars(); var controlState_TextBox = controlStateControls[2].add_TextBox() .multiLine() .fill() .scrollBars(); viewState_TreeView.PopulateTree(dotNetViewState.ViewState_XmlDocument); controlState_TreeTree.PopulateTree(dotNetViewState.ControlState_XmlDocument); viewState_XmlViewer.set_Text(dotNetViewState.ViewState_XmlString, ".xml").visible(true); controlState_XmlViewer.set_Text(dotNetViewState.ControlState_XmlString, ".xml").visible(true); viewState_TextBox.set_Text(StringsAndLists.fromStringList_getText(dotNetViewState.ViewState_Values)); controlState_TextBox.set_Text(StringsAndLists.fromStringList_getText(dotNetViewState.ControlState_Values)); viewState_TreeView.visible(true); controlState_TreeTree.visible(true); return(control); }
public static string fromLines_getText(this List <string> lines) { return(StringsAndLists.fromStringList_getText(lines)); }
public static string str(this List <String> list) { return(StringsAndLists.fromStringList_getText(list)); }