public static IEnumerable<string> getUniqueSortedListOfStrings(IEnumerable<string> stringsToFilter, ref int numberOfUniqueStrings) { var timer = new O2Timer("O2Linq calculated list of unique strings from " + stringsToFilter.Count() + " strings").start(); var uniqueList = (from string signature in stringsToFilter orderby signature select signature).Distinct(); numberOfUniqueStrings = uniqueList.Count(); timer.stop(); DI.log.info("There are {0} unique signatures", uniqueList.Count()); return uniqueList; }
public static void backupGac(string zipFileToSaveGacContents) { O2Thread.mtaThread( () => { PublicDI.log.info("Started unzip process of Gac Folder"); var timer = new O2Timer("Gac Backup").start(); new zipUtils().zipFolder(DI.PathToGac, zipFileToSaveGacContents); var logMessage = String.Format("Contents of \n\n\t{0}\n\n saved to \n\n\t{1}\n\n ", DI.PathToGac, zipFileToSaveGacContents); timer.stop(); PublicDI.log.info(logMessage); PublicDI.log.showMessageBox(logMessage); }); }
private void filterByFilteredSignatures(List<FilteredSignature> filteredSignatures) { this.invokeOnThread( () => { var filterToUse = cbFilter1.Text; O2Thread.mtaThread( () => { var timer = new O2Timer("filterByFilteredSignatures").start(); List<string> listOfFilteredSignatures = O2Linq.getListOfSignatures(filteredSignatures); var newListOfO2Findings = new List<IO2Finding>(); foreach (IO2Finding o2Finding in currentO2Findings) if (listOfFilteredSignatures.Contains(calculateTreeNodeText(o2Finding, filterToUse, ""))) newListOfO2Findings.Add(o2Finding); currentO2Findings = newListOfO2Findings; timer.stop(); showCurrentO2Findings(); }); }); /* this.invokeOnThread( () => { tvFindings.Visible = false; var nodesToRemove = new List<TreeNode>(); var nodesToAnalyze = new List<TreeNode>(); foreach (TreeNode treeNode in tvFindings.Nodes) nodesToAnalyze.Add(treeNode); nodesToRemove = removeFromTreeNodeCollectionOnFilteredSignatures(nodesToAnalyze, listOfFilteredSignatures, currentFilteredTextMappings); // and update indexes /* foreach (TreeNode currentTreeNode in tvFindings.Nodes) if (currentTreeNode.Tag != null && currentTreeNode.Tag is List<TreeNode>) { var subTreeNodesCount = ((List<TreeNode>) currentTreeNode.Tag).Count; if (subTreeNodesCount == 0) nodesToRemove.Add(currentTreeNode); else { currentTreeNode.Text += " ... after filter (" + subTreeNodesCount +")"; currentTreeNode.Collapse(); } } * / // remove nodes from current tree foreach (TreeNode treeNodeToRemove in nodesToRemove) tvFindings.Nodes.Remove(treeNodeToRemove); tvFindings.Visible = true; tvFindings.Refresh(); // refreshView(); }); });*/ }
public void addReferences(List<string> referencesToAdd) { O2Thread.mtaThread( () =>{ try { var referencesTimer = new O2Timer("Added {0} references".format(referencesToAdd.size())).start(); ; foreach (var referencedAssembly in referencesToAdd) addReference(referencedAssembly); referencesTimer.stop(); } catch (Exception ex) { ex.log("in O2Completion addRefrences"); } }); }
public static Object getDeSerializedObjectFromBinaryFile(String fileToProcess, Type tTypeToProcess) { FileStream fsFileStream = null; O2Timer tO2Timer = new O2Timer("Loaded DeSerialized object from " + Path.GetFileName(fileToProcess)).start(); try { var bfBinaryFormatter = new BinaryFormatter(); fsFileStream = new FileStream(fileToProcess, FileMode.Open); Object deserializedObject = bfBinaryFormatter.Deserialize(fsFileStream); if (deserializedObject.GetType().FullName == tTypeToProcess.FullName) { DI.log.info("sucessfully deserialized file {0} into type {1}", fileToProcess, tTypeToProcess.FullName); return deserializedObject; } DI.log.error("Could not deserialize file {0} into type {1}", fileToProcess, tTypeToProcess.FullName); return null; } catch (Exception ex) { DI.log.error("In loadSerializedO2CirDataObject: {0}", ex.Message); return null; } finally { if (fsFileStream != null) fsFileStream.Close(); tO2Timer.stop(); } }
private object GetCurrentCSharpObjectModel() { var timer = new O2Timer("Calculated O2 Object Model for referencedAssesmblies").start(); var signatures = new List<string>(); var referencedAssemblies = new CompileEngine().getListOfReferencedAssembliesToUse(); //compileEngine.lsGACExtraReferencesToAdd(); foreach (var referencedAssesmbly in referencedAssemblies) if (File.Exists(referencedAssesmbly)) foreach (var method in PublicDI.reflection.getMethods(referencedAssesmbly)) signatures.Add(new FilteredSignature(method).sSignature); timer.stop(); return signatures; }