public override ProblemCollection Check(Member member) { Method method = member as Method; if (method == null) { return(null); } if (method.Instructions == null || method.Instructions.Count == 0) { return(null); } LocalCollection locals = method.Locals; //LocalList locals = method.Instructions[0].Value as LocalList; if (locals == null) { return(null); } foreach (var item in locals) { if (RuleUtilities.IsCompilerGenerated(item)) { continue; } string localVariableName = item.Name.Name; string camelLocalVariableName = localVariableName.ToCamelString(); if (!item.Name.Name.Equals(camelLocalVariableName)) { this.Problems.Add(new Problem(this.GetResolution(), item.SourceContext)); } } return(Problems); }
private void FillSPQueryObjectListForLocals(Method method) { try { for (short i = 0; i < method.Locals.Count; i = (short)(i + 1)) { SPQueryObject current; Local local = method.Locals[i]; if (!local.Type.FullName.Equals("Microsoft.SharePoint.SPQuery") || RuleUtilities.IsCompilerGenerated(local)) { continue; } bool flag = false; using (List <SPQueryObject> .Enumerator enumerator = this.m_listSPQueryObject.GetEnumerator()) { while (enumerator.MoveNext()) { current = enumerator.Current; if (((current.ObjectType.Equals(local.Type.FullName) && current.ObjectName.Equals(local.Name.Name)) && current.ClassName.Equals(method.DeclaringType.FullName)) && current.MethodName.Equals(method.Name.Name)) { flag = true; goto Label_00F6; } } } Label_00F6: if (!flag) { current = new SPQueryObject { ObjectType = local.Type.FullName, ObjectName = local.Name.Name, MethodName = method.Name.Name, ClassName = method.DeclaringType.FullName }; this.m_listSPQueryObject.Add(current); } } } catch (Exception exception) { Logging.UpdateLog(CustomRulesResource.ErrorOccured + "SharePointCustomRowLimitExistCheck:FillSPQueryObjectListForLocals() - " + exception.Message); } }