Exemplo n.º 1
0
 public static Thread raiseRegistedCallbacks(Delegate delegatesToInvoke, object[] parameters)
 {
     return(O2Thread.mtaThread(() =>
     {
         if (delegatesToInvoke != null)
         {
             foreach (
                 Delegate registerCallback in
                 delegatesToInvoke.GetInvocationList())
             {
                 try
                 {
                     registerCallback.DynamicInvoke(parameters);
                 }
                 catch (Exception ex)
                 {
                     log.error(
                         "in raiseRegistedCallbacks, while invoking {0} : ",
                         registerCallback.Method.Name,
                         ex.Message);
                 }
             }
         }
     }));
 }
 public static string findDllInCurrentAppDomain(string dllToFind)
 {
     foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
     {
         if (assembly.GetName().Name == dllToFind)
         {
             return(assembly.Location);
         }
     }
     log.error("in findDllInCurrentAppDomain, could not find {0} in the current AppDomain assemblies", dllToFind);
     return("");
 }
        public static void processXHtmlfiles()
        {
            if (rootDirectoryOfFiles == "")
            {
                log.error("you must provide the base directory (rootDirectoryOfFiles) to find {0} files", fileExtension);
            }
            else
            {
                var o2Findings     = new List <IO2Finding>();
                var filesToProcess = Files.getFilesFromDir_returnFullPath(rootDirectoryOfFiles, fileExtension, true
                                                                          /*recursive search */);
                log.info("There are {0} {1} files to process", filesToProcess.Count, fileExtension);
                foreach (var file in filesToProcess)
                {
                    var o2FindingsFromFile = processXHtmlfile(file);
                    o2Findings.AddRange(o2FindingsFromFile);
                }
                log.info("There were {0} findings created", o2Findings.Count);

                // showing findings in Findings Viewer
                showFindingsInFindingsViewer(o2Findings);
                log.info("done...");
            }
        }
 public static void setAllPropertiesValue(object objectToProcess, bool value)
 {
     if (objectToProcess != null)
     {
         foreach (var property in PublicDI.reflection.getProperties(objectToProcess))
         {
             if (property.PropertyType == typeof(bool))
             {
                 PublicDI.reflection.setProperty(property, objectToProcess, value);
             }
         }
     }
     else
     {
         log.error("object was null");
     }
 }
 public static string showWebXml(List <String> files)
 {
     if (files != null)
     {
         log.debug("There are  files available: {0}", files.Count.ToString());
         foreach (var file in files)
         {
             if (Path.GetFileName(file) == "web.xml")
             {
                 showWebXml(file);
                 break;
             }
         }
     }
     else
     {
         log.error("files was null");
     }
     return("all done...");
 }