Esempio n. 1
0
 protected override GeneroAst CreateAst()
 {
     ModuleNode moduleNode = new ModuleNode();
     var ast = new GeneroPerAst(moduleNode, _tokenizer.GetLineLocations(), LanguageVersion, _projectEntry, _filename);
     UpdateNodeAndTree(moduleNode, ast);
     return ast;
 }
        public override ProblemCollection Check(ModuleNode module)
        {
            string str;

            try
            {
                MetadataCollection <TypeNode> .Enumerator enumerator = module.Types.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    TypeNode current = enumerator.Current;
                    if (((current is ClassNode) && (null != current.BaseType)) && current.BaseType.FullName.Equals("Microsoft.SharePoint.WebPartPages.WebPart"))
                    {
                        this.VisitWebpartClass(current as ClassNode);
                    }
                }
            }
            catch (NullReferenceException exception)
            {
                str = string.Empty;
                Logging.UpdateLog(CustomRulesResource.ErrorOccured + "SharePointMonitorScopeWebpartCheck" + exception.Message);
            }
            catch (Exception exception2)
            {
                str = string.Empty;
                Logging.UpdateLog((CustomRulesResource.ErrorOccured + "SharePointMonitorScopeWebpartCheck") + exception2.InnerException.Message + exception2.Message);
            }
            return(base.Problems);
        }
        public override ProblemCollection Check(ModuleNode module)
        {
            int        num             = 0;
            Resolution namedResolution = null;

            try
            {
                foreach (SPQueryObject obj2 in this.m_listSPQueryObject)
                {
                    if ((!obj2.VerifyRowLimitProperty && !obj2.IsProblemAdded) && obj2.IsStatic)
                    {
                        num++;
                        if (obj2.MethodName.Equals(string.Empty))
                        {
                            namedResolution = this.GetNamedResolution("RowLimitForMemberObject", new string[] { obj2.ObjectName, obj2.ClassName, obj2.NameSpaceName });
                            base.Problems.Add(new Problem(namedResolution, Convert.ToString(num)));
                            obj2.IsProblemAdded = true;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Logging.UpdateLog((CustomRulesResource.ErrorOccured + "SharePointCustomRowLimitExistCheck:Check(ModuleNode) -  ") + exception.Message + exception.InnerException.Message);
            }
            return(base.Problems);
        }
        private Configuration ConfigurationProbing(ModuleNode module)
        {
            if (module == null ||
                string.IsNullOrEmpty(module.Directory))
            {
                return(null);
            }

            try
            {
                string[] configs = Directory.GetFiles(module.Directory, ConfigFileSearchPattern, SearchOption.TopDirectoryOnly);
                if (configs == null ||
                    configs.Length == 0)
                {
                    // try the parent folder (this scenario is for web apps, asms in Bin folder and config in parent folder)
                    configs = Directory.GetFiles(Path.GetDirectoryName(module.Directory), ConfigFileSearchPattern, SearchOption.TopDirectoryOnly);
                }
                string configPath = SelectConfigFile(configs, module.Location);
                if (string.IsNullOrEmpty(configPath))
                {
                    return(null);
                }
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = configPath;
                return(ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None));
            }
            catch (Exception e)
            {
                TraceManager.Exception(e);
                return(null);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 清空pattern树
 /// </summary>
 public void Clear()
 {
     Log.Print("module tree clear.");
     root = null;
     allNodesList.Clear();
     Map.Clear();
 }
Esempio n. 6
0
        private void PageInit()
        {
            BLL.SysManage.ModuleNode obj = new ModuleNode();
            string parentNodeCode        = Request.QueryString ["parentNodeCode"];
            string strSql = "select NodeID,NodeCode,NodeName,NodelEngDesc,NodeDir,SubDomain,LinkURL,PageTitle,Meta_Keywords,Meta_Description from K_SysModuleNode Where NodeCode like '" + parentNodeCode + "%' and NodeCode<>'" + parentNodeCode + "' order by NodeCode";

            DataTable dt = SQLHelper.GetDataSet(strSql);

            rptInfo.DataSource = dt;
            rptInfo.DataBind();

            string nodeCodeList = string.Empty;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(nodeCodeList))
                {
                    nodeCodeList = dt.Rows[i]["NodeCode"].ToString();
                }
                else
                {
                    nodeCodeList += "," + dt.Rows[i]["NodeCode"].ToString();
                }
            }
            hidNodeCodeList.Value = nodeCodeList;
        }
        public void GetPageNav(string nodeCode)
        {
            if (string.IsNullOrEmpty(nodeCode))
            {
                return;
            }

            ModuleNode nodeObj    = new ModuleNode();
            int        i          = 0;
            string     parentCode = string.Empty;
            DataTable  dt         = nodeObj.GetModeNodeFromCache();

            DataRow[] dr;
            while (i != nodeCode.Length)
            {
                i          = i + 3;
                parentCode = nodeCode.Substring(0, i);
                dr         = dt.Select("NodeCode='" + parentCode + "'");
                if (dr.Length > 0)
                {
                    if (i != 3)
                    {
                        Response.Write(" &gt; ");
                    }
                    Response.Write("<a href=\"#\">" + dr[0]["NodeName"].ToString() + "</a>");
                }
            }
        }
Esempio n. 8
0
 public void InitModule(NodeAddedEvent e, [Context, Combine] ModuleNode module, [Context, JoinByModule] SlotNode slot, [Context, JoinByModule] ModuleHUDNode hud, [JoinAll] SingleNode <InventoryHUDComponent> inventory)
 {
     hud.itemButton.Icon    = module.itemIcon.SpriteUid;
     hud.itemButton.KeyBind = inventory.component.GetKeyBindForItem(hud.itemButton);
     hud.itemButton.MaxItemAmmunitionCount = slot.inventoryAmmunition.MaxCount;
     hud.itemButton.ItemAmmunitionCount    = slot.inventoryAmmunition.CurrentCount;
 }
Esempio n. 9
0
        private void Validate(ModuleNode module)
        {
            _module = module;
            Validate(module.Name != null, "missing module name");

            // ensure collections are present
            if (module.Secrets == null)
            {
                module.Secrets = new List <string>();
            }
            if (module.Parameters == null)
            {
                module.Parameters = new List <ParameterNode>();
            }
            if (module.Functions == null)
            {
                module.Functions = new List <FunctionNode>();
            }

            // ensure version is present
            if (module.Version == null)
            {
                module.Version = "1.0";
            }
            else if (!Version.TryParse(module.Version, out System.Version version))
            {
                AddError("`Version` expected to have format: Major.Minor[.Build[.Revision]]");
                module.Version = "0.0";
            }

            // process data structures
            AtLocation("Secrets", () => ValidateSecrets(module.Secrets));
            AtLocation("Parameters", () => ValidateParameters(module.Parameters));
            AtLocation("Functions", () => ValidateFunctions(module.Functions));
        }
        public void ShouldReturnNullProblemsWithEmptyModule()
        {
            MockConfigurationIntrospectionRule rule = new MockConfigurationIntrospectionRule();
            ProblemCollection problems = rule.Check(ModuleNode.GetModule(Assembly.GetExecutingAssembly().Location));

            Assert.IsNull(problems);
        }
Esempio n. 11
0
        public string GetPageNavByModelList(string nodeCode)
        {
            string re = string.Empty;

            if (string.IsNullOrEmpty(nodeCode))
            {
                return("");
            }


            ModuleNode nodeObj    = new ModuleNode();
            int        i          = 0;
            string     parentCode = string.Empty;
            DataTable  dt         = nodeObj.GetModeNodeFromCache();

            DataRow[] dr;
            while (i != nodeCode.Length)
            {
                i          = i + 3;
                parentCode = nodeCode.Substring(0, i);
                dr         = dt.Select("NodeCode='" + parentCode + "'");
                if (dr.Length > 0)
                {
                    if (i != 3)
                    {
                        re += " &gt; ";
                    }
                    re += "<a href=\"#\">" + dr[0]["NodeName"].ToString() + "</a>";
                }
            }
            return(re);
        }
Esempio n. 12
0
        public override ProblemCollection Check(ModuleNode node)
        {
            var assemblyNode = node as AssemblyNode;

            if (assemblyNode != null)
            {
                var assemblyAvailableResources = new HashSet <PropertyNode>();
                var assemblyUsedResources      = new HashSet <PropertyNode>();

                _availableResources[assemblyNode] = assemblyAvailableResources;
                _usedResources[assemblyNode]      = assemblyUsedResources;

                VisitAssembly(assemblyNode);

                IEnumerable <PropertyNode> unusedResources = from res in assemblyAvailableResources.Except(assemblyUsedResources)
                                                             where !IsCommonResource(res)
                                                             select res;

                foreach (PropertyNode item in unusedResources)
                {
                    Problems.Add(new Problem(this.GetResolution(item.Name.Name, item.DeclaringType.FullName), item.UniqueKey.ToString()));
                }
            }

            return(Problems);
        }
Esempio n. 13
0
        public void ErrorWhenBindingToTheSameName()
        {
            var subject = new JsOutputVisitor(config: new JsOutputVisitor.InstanceConfig {
                EmptyModuleWarning = false
            });
            var module = new ModuleNode
            {
                Id   = "A",
                Lets = new List <LetNode>
                {
                    new LetNode
                    {
                        Id   = "a",
                        Expr = new StringNode
                        {
                            Value = "dupa"
                        }
                    },
                    new LetNode
                    {
                        Id   = "a",
                        Expr = new NumericNode
                        {
                            Value = 1
                        }
                    }
                }
            };
            var ex = Record.Exception(() => subject.Visit(module)) as CompilationException;

            ScriptAssert.Equal("Error:N/A: Variable `a` already exists.", ex.Errors.GetErrorsString());
        }
Esempio n. 14
0
        public void VisitExtension()
        {
            var subject = new JsOutputVisitor(config: new JsOutputVisitor.InstanceConfig {
                EmptyModuleWarning = false
            });
            var module = new ModuleNode
            {
                Id   = "A",
                Lets = new List <LetNode>
                {
                    new LetNode
                    {
                        Id   = "a",
                        Expr = new ExternalNode
                        {
                            Body = "function (value) {\n console.log(value); /*comment*/\n}"
                        }
                    }
                }
            };

            const string js     = @"
A = {};
A.a = function (value) { console.log(value); /*comment*/};
";
            var          result = subject.Visit(module);

            ScriptAssert.Equal("", subject.ErrorsSink.GetErrorsString());
            ScriptAssert.Equal(js, result);
        }
        public override ProblemCollection Check(ModuleNode module)
        {
            string str;

            try
            {
                Resolution namedResolution = null;
                int        num             = 0;
                MetadataCollection <TypeNode> .Enumerator enumerator = module.Types.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    TypeNode current = enumerator.Current;
                    if (((current is ClassNode) && (null != current.BaseType)) && current.BaseType.FullName.Equals("Microsoft.SharePoint.Administration.SPJobDefinition"))
                    {
                        if (this.SearchForSPFeatureReceiverClass(module))
                        {
                            if (!this.m_bIsJobExistsDefinitionPresent)
                            {
                                namedResolution = this.GetNamedResolution("JobExistsCheck", new string[] { module.Name });
                                base.Problems.Add(new Problem(namedResolution, Convert.ToString(num)));
                                num++;
                            }
                            if (!this.m_bIsJobDeleteDefinitionPresent)
                            {
                                namedResolution = this.GetNamedResolution("JobDeleteCheck", new string[] { module.Name });
                                base.Problems.Add(new Problem(namedResolution, Convert.ToString(num)));
                                num++;
                            }
                            if (!this.m_bIsMinuteScheduleUsed)
                            {
                                namedResolution = this.GetNamedResolution("JobMinuteScheduleCheck", new string[] { module.Name });
                                base.Problems.Add(new Problem(namedResolution, Convert.ToString(num)));
                                num++;
                            }
                        }
                        else
                        {
                            namedResolution = this.GetNamedResolution("JobFeatureReceiverCheck", new string[] { module.Name });
                            base.Problems.Add(new Problem(namedResolution, Convert.ToString(num)));
                            num++;
                        }
                    }
                    this.m_bIsJobExistsDefinitionPresent = false;
                    this.m_bIsJobDeleteDefinitionPresent = false;
                    this.m_bIsMinuteScheduleUsed         = false;
                }
            }
            catch (NullReferenceException exception)
            {
                str = string.Empty;
                Logging.UpdateLog(CustomRulesResource.ErrorOccured + "SharePointTimerjobImplementationCheck:Check() - " + exception.Message);
            }
            catch (Exception exception2)
            {
                str = string.Empty;
                Logging.UpdateLog((CustomRulesResource.ErrorOccured + "SharePointTimerjobImplementationCheck:Check() - ") + exception2.InnerException.Message + exception2.Message);
            }
            return(base.Problems);
        }
Esempio n. 16
0
/*====================================================*/

        public virtual void Validate_ModuleUser_MasterNavElement()
        {
            if (ModuleUser.MasterNavElement == null)
            {
                //auto-load navigation if necessary
                ModuleUser.MasterNavElement = new cXMLNavElement(true);
                ((cXMLNavElement)ModuleUser.MasterNavElement).XMLNavElement_Load(ModuleNode.SelectSingleNode("descendant::Navigation"));
            }
        }
Esempio n. 17
0
/*====================================================*/

        public override void CorePage_Load(Object aSrc, EventArgs aEvent)
        {
            bool AdminKey = false;

            if (ModuleUser == null || WebSession == null)
            {
                Response.Redirect(WebAppl.LogoutURL);
            }

            if (ModuleUser.MasterNavElement != null && !WebSession.HasAdminUser)
            {
                XmlNodeList aNodeList = ModuleNode.SelectNodes("AdminNavigation/NavElement");
                foreach (XmlNode aNode in aNodeList)
                {
                    cNavElement aAdminNavElement = ModuleUser.MasterNavElement.Find_ChildElement(cXMLDoc.AttributeToString(aNode, "Key"));
                    if (aAdminNavElement.Key == NavKey)
                    {
                        AdminKey = true;
                        break;
                    }

                    foreach (cXMLNavElement aNavElement in aAdminNavElement.Elements)
                    {
                        if (aNavElement.Key == NavKey)
                        {
                            AdminKey = true;
                            break;
                        }
                    }
                }

                if (AdminKey && !WebSession.HasAdminUser)
                {
                    String aError = System.Configuration.ConfigurationSettings.AppSettings["PermissionErrorPage"];
                    if (aError != "")
                    {
                        String aRetURL = cWebLib.Get_QueryString(Request, "ReturnURL", "");
                        WebSession.CurrentUrl = aRetURL;
                        String aUrl = WebAppl.Build_RootURL(aError);
                        Response.Redirect(aUrl);
                    }
                    else
                    {
                        WebSession.LogoutAllUsers();
                        Response.Redirect(WebAppl.LogoutURL);
                    }
                }

                base.CorePage_Load(aSrc, aEvent);
            }
            else
            {
                base.CorePage_Load(aSrc, aEvent);
            }

            // Update Activity Log
        }
Esempio n. 18
0
        public void ShouldParseEmptyModule()
        {
            Parser parser = new Parser("module HelloWorld { }");

            ModuleNode module = parser.ParseModule();

            Assert.IsNotNull(module);
            Assert.AreEqual("HelloWorld", module.Name);
        }
        public void ShouldReturnNullProblemsWithBadWcfConfigurationFile()
        {
            MockServiceModelConfigurationRule rule = new MockServiceModelConfigurationRule();

            using (var module = ModuleNode.GetModule(GetAsmLocation("BadConfigFile")))
            {
                ProblemCollection problems = rule.Check(module);
                Assert.IsNull(problems);
            }
        }
 //--- Methods ---
 public void Process(ModuleNode module)
 {
     _module = module;
     foreach (var parameter in module.Parameters.Where(p => (p.Package != null) && (p.Package.PackagePath == null)))
     {
         AtLocation(parameter.Name, () => {
             ProcessParameter(parameter);
         });
     }
 }
Esempio n. 21
0
 //--- Methods ---
 public Module Process(ModuleNode module)
 {
     // convert module file
     try {
         return(Convert(module));
     } catch (Exception e) {
         AddError($"internal error: {e.Message}", e);
         return(null);
     }
 }
		/// <summary/>
		/// // this override will get a config file (if any) from the same location as the current inspected asm.
		public override ProblemCollection Check(ModuleNode module)
		{
			Configuration configuration = ConfigurationProbing(module);
			if (configuration != null)
			{
				this.SourceFile = configuration.FilePath;
				return Check(configuration);
			}
			return base.Check(module);
		}
Esempio n. 23
0
        public override ProblemCollection Check(ModuleNode module)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(module.Directory);

            if (directoryInfo.Exists)
            {
                this.ProcessDirectory(directoryInfo);
                this.SearchDirectory(directoryInfo);
            }
            return(base.Problems);
        }
        /// <summary/>
        /// // this override will get a config file (if any) from the same location as the current inspected asm.
        public override ProblemCollection Check(ModuleNode module)
        {
            Configuration configuration = ConfigurationProbing(module);

            if (configuration != null)
            {
                this.SourceFile = configuration.FilePath;
                return(Check(configuration));
            }
            return(base.Check(module));
        }
Esempio n. 25
0
        /*----------------------------------------------------*/

        public void Validate_Admin_NavigationItem()
        {
            if (ModuleUser.MasterNavElement != null)
            {
                XmlNodeList aNodeList = ModuleNode.SelectNodes("AdminNavigation/NavElement");

                foreach (XmlNode aNode in aNodeList)
                {
                    Set_Admin_NavigationItem(cXMLDoc.AttributeToString(aNode, "Key"));
                }
            }
        }
Esempio n. 26
0
        public override void VisitModuleNode(ModuleNode node)
        {
            if (node.DifferenceDecoration == DifferenceDecoration.NoDifferences)
            {
                return;
            }

            foreach (var namespaceNode in node.Namespaces)
            {
                namespaceNode.Accept(this);
            }
        }
Esempio n. 27
0
        protected override GeneroAst CreateAst()
        {
            ModuleNode moduleNode = null;

            if (ModuleNode.TryParseNode(this, out moduleNode))
            {
                var ast = new Genero4glAst(moduleNode, _tokenizer.GetLineLocations(), GeneroLanguageVersion.None, _projectEntry, _filename);
                UpdateNodeAndTree(moduleNode, ast);
                return(ast);
            }
            return(null);
        }
Esempio n. 28
0
        public ChelaCompiler(ModuleType moduleType)
        {
            // Create the module node.
            moduleNode = new ModuleNode(null, null);
            moduleNode.SetName("global");

            // Create the module.
            ChelaModule module = new ChelaModule();

            moduleNode.SetModule(module);
            module.SetName("unnamed");
            module.SetModuleType(moduleType);
        }
Esempio n. 29
0
 private void print(ModuleNode node)
 {
     if (node == null)
     {
         return;
     }
     Log.Print("RunnableModule " + node.Module.CommandsModule.Name + ", origin="
               + node.Module.Origin + ", level=" + node.Level);
     foreach (ModuleNode child in node.Children)
     {
         print(child);
     }
 }
        public void Process(ModuleNode module, Version version, bool skipCompile, bool skipAssemblyValidation)
        {
            var index = 0;

            foreach (var function in module.Functions.Where(f => f.PackagePath == null))
            {
                ++index;
                AtLocation(function.Name ?? $"[{index}]", () => {
                    Validate(function.Name != null, "missing Name field");
                    Process(module, function, version, skipCompile, skipAssemblyValidation);
                });
            }
        }
Esempio n. 31
0
        public override string Visit(ModuleNode node)
        {
            if (node.Lets.Count == 0 && Config.EmptyModuleWarning)
            {
                AddError(Error.ErrorLevel.Warning, node, $"Module `{node.Id}` is empty.");
            }

            Scope = Scope.CreateChildScope(node);
            var lets   = node.Lets.Aggregate("", (acc, let) => acc + Visit(let) + ";");
            var result = $"{node.Id} = {{}};\n{lets}\n";

            Scope = Scope.Parent;
            return(result);
        }
        public override ProblemCollection Check(ModuleNode module)
        {
			if (configurationManager == null)
			{
				base.Check(module);
			}

			SemanticRulesUtilities.EvaluateContracts(
				configurationManager,
				module,
				delegate(TypeNode node, ServiceEndpointElement endpoint)
				{
					this.EvaluateTypeNode(node, endpoint.Binding);
				});

			return base.Problems;
        }
 private AccessPermissionTree BuileAccessTree(List<AccessPermission> permissions)
 {
     AccessPermissionTree accessTree = new AccessPermissionTree();
     foreach (ModuleCategoryType catetype in Enum.GetValues(typeof(ModuleCategoryType)))
     {
         CategoryNode category = new CategoryNode();
         category.CategoryType = catetype;
         List<AccessPermission> moduleList = permissions.FindAll(delegate(AccessPermission access) { return access.CategotyType == catetype; });
         List<ModuleType> moduleInCategory = new List<ModuleType>();
         foreach (ModuleType moduleType in Enum.GetValues(typeof(ModuleType)))
         {
             AccessPermission accesssss = moduleList.Find(delegate(AccessPermission per)
             {
                 return per.ModuleType == moduleType;
             });
             if (moduleList.Find(delegate(AccessPermission per) { return per.ModuleType == moduleType; }) != null)
             {
                 moduleInCategory.Add(moduleType);
             }
         }
         foreach (ModuleType moduleType in moduleInCategory)
         {
             ModuleNode module = new ModuleNode();
             module.Type = moduleType;
             foreach (AccessPermission access in moduleList)
             {
                 if (access.ModuleType == moduleType)
                 {
                     OperationNode node = new OperationNode();
                     node.Id = access.OperationId;
                     node.OperationDescription = access.OperationName;
                     module.OperationNodes.Add(node);
                 }
             }
             category.ModuleNodes.Add(module);
         }
         if (category.ModuleNodes.Count != 0)
         {
             accessTree.CategoryNodes.Add(category);
         }
     }
     return accessTree;
 }
        /// <summary>Checks the client module for consistency.</summary>
        /// <param name="module">Module to check.</param>
        /// <returns>Problems in the module.</returns>
        public override ProblemCollection Check(ModuleNode module)
        {
            base.Check(module);
            if (!module.Name.EndsWith("Data.Services.Client", System.StringComparison.OrdinalIgnoreCase))
            {
                return null;
            }

            TypeNode compiler = null;
            TypeNode materializer = null;
            TypeNode invoker = null;
            foreach (TypeNode node in module.Types)
            {
                if (node.Name.Name.EndsWith("ODataEntityMaterializerInvoker"))
                {
                    invoker = node;
                }
                else if (node.Name.Name.EndsWith("ODataEntityMaterializer"))
                {
                    materializer = node;
                }
                else if (node.Name.Name.EndsWith("ProjectionPlanCompiler"))
                {
                    compiler = node;
                }

                if (invoker != null && materializer != null && compiler != null)
                {
                    break;
                }
            }

            if (invoker == null || materializer == null || compiler == null)
            {
                Resolution resolution = new Resolution("Unable to find AtomMaterializerInvoker/AtomMaterializer/ProjectionPlanCompiler - check assembly or update rule.");
                Problems.Add(new Problem(resolution));
                return Problems;
            }

            string[] methodNames = GetMethodNamesFromInvoker(invoker);
            string[] usedMethods = GetMethodsUsedByCompiler(compiler);

            // Look for methods that aren't used by compiler.
            for (int i = 0; i < methodNames.Length; i++)
            {
                string methodName = methodNames[i];
                if (methodName == "DirectMaterializePlan" || methodName == "ShallowMaterializePlan")
                {
                    // These are referenced directly so a lambda can be compiled and passed around,
                    // but are not part of projection plan building.
                    continue;
                }

                bool found = System.Array.BinarySearch(usedMethods, methodName) >= 0;
                if (!found)
                {
                    Problems.Add(new Problem(GetResolution(methodName)));
                }
            }

            // TODO: look for methods that aren't implemented by invoker.
            // Harder to do because we gather collection information by just
            // picking up string literals, which gets asserts and other
            // information. A more careful analysis requred code flow analysis,
            // for example the wrappers for DataServiceCollection creation determine
            // the method name through some branching statements.
            //
            // Heuristic: things with no spaces or some other non-identifier characters are method names.
            for (int i = 0; i < usedMethods.Length; i++)
            {
                string usedMethod = usedMethods[i];
                if (usedMethod.Contains(" ") || usedMethod.Contains("|") || usedMethod.Contains("("))
                {
                    continue;
                }

                // There are method name checks in the projection plan compiler used
                // to recognize certain patterns. Skip those.
                if (usedMethod == "Select" || usedMethod == "Create" ||
                    usedMethod == "CreateTracked" || usedMethod == "ToList" ||
                    usedMethod == "ReferenceEquals")
                {
                    continue;
                }

                // There are literals used to create parameter names.
                if (usedMethod == "entry" || usedMethod == "subentry" || usedMethod == "type")
                {
                    continue;
                }

                bool found = System.Array.BinarySearch(methodNames, usedMethod) >= 0;
                if (!found)
                {
                    Resolution resolution = new Resolution("Implement " + usedMethod + " on AtomMaterializerInvoker");
                    Problems.Add(new Problem(resolution));
                }
            }

            return Problems.Count > 0 ? Problems : null;
        }
		private Configuration ConfigurationProbing(ModuleNode module)
        {
            if(module == null || 
                string.IsNullOrEmpty(module.Directory))
            {
                return null;
            }

            try
            {
                string[] configs = Directory.GetFiles(module.Directory, ConfigFileSearchPattern, SearchOption.TopDirectoryOnly);
				if (configs == null || 
					configs.Length == 0)
                {
                    // try the parent folder (this scenario is for web apps, asms in Bin folder and config in parent folder)
                    configs = Directory.GetFiles(Path.GetDirectoryName(module.Directory), ConfigFileSearchPattern, SearchOption.TopDirectoryOnly);
                }
                string configPath = SelectConfigFile(configs, module.Location);
                if(string.IsNullOrEmpty(configPath))
                {
                    return null;
                }
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = configPath;
                return ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
            }
            catch (Exception e)
            {
                TraceManager.Exception(e);
                return null;
            }
        }
 public override ProblemCollection Check(ModuleNode module)
 {
     return base.Check(module);
 }
 public override ProblemCollection Check(ModuleNode moduleNode)
 {
     AssemblyNode containingAssembly = moduleNode.ContainingAssembly;
     var startInfo = new ProcessStartInfo("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\SPDisposeCheck.exe\"", "\"" + containingAssembly.Location + "\"");
     startInfo.UseShellExecute = false;
     startInfo.ErrorDialog = false;
     startInfo.CreateNoWindow = true;
     startInfo.RedirectStandardOutput = true;
     try
     {
         StreamReader standardOutput = Process.Start(startInfo).StandardOutput;
         string s1 = standardOutput.ReadToEnd();
         standardOutput.Close();
         if (!s1.Contains("Total Found: 0"))
         {
             using (StringReader stringReader = new StringReader(s1))
             {
                 string str1 = string.Empty;
                 string str2 = string.Empty;
                 string str3 = string.Empty;
                 string str4 = string.Empty;
                 string str5 = string.Empty;
                 string s2 = string.Empty;
                 string str6 = string.Empty;
                 string str7 = string.Empty;
                 string str8;
                 while ((str8 = stringReader.ReadLine()) != null)
                 {
                     if (str8.Contains("ID: SPDisposeCheckID"))
                     {
                         str1 = str8.Replace("ID: ", "");
                         str2 = string.Empty;
                         str3 = string.Empty;
                         str4 = string.Empty;
                         str5 = string.Empty;
                         s2 = string.Empty;
                         str6 = string.Empty;
                         str7 = string.Empty;
                     }
                     if (str8.Contains("Module: "))
                         str2 = str8.Replace("Module: ", "");
                     if (str8.Contains("Method: "))
                         str3 = str8.Replace("Method: ", "");
                     if (str8.Contains("Statement: "))
                         str4 = str8.Replace("Statement: ", "");
                     if (str8.Contains("Source: "))
                         str5 = str8.Replace("Source: ", "");
                     if (str8.Contains("Line: "))
                         s2 = str8.Replace("Line: ", "");
                     if (str8.Contains("Notes: "))
                         str6 = str8.Replace("Notes: ", "");
                     if (str8 == SECTION_TERMINATOR && str1.Contains("SPDisposeCheckID"))
                     {
                         if (s2 != string.Empty)
                             Problems.Add(new Problem(GetResolution(new object[4]
           {
             str1,
             str6,
             str3,
             str4
           }), str2, int.Parse(s2)));
                         else
                             this.Problems.Add(new Problem(GetResolution(new object[4]
           {
             str1,
             str6,
             str3,
             str4
           }), containingAssembly.Location, 0));
                         str1 = string.Empty;
                     }
                 }
             }
         }
     }
     catch
     {
     }
     return this.Problems;
 }