// Add pageName parameter in clas global declaration public void AddPageNameGlobalinClass(CSharpFile file, DocumentScript script) { foreach (var expr in file.IndexOfClassDecl) { bool foundPageNameGlobalInClass = false; var copy = (TypeDeclaration)expr.Clone(); foreach (var TypeMember in expr.Members.OfType <FieldDeclaration>()) { if (TypeMember.Match(allPatterns.PageNameGlobalFieldDecl(expr.Name + ".aspx")).Success) { foundPageNameGlobalInClass = true; //break; } if (TypeMember.Match(allPatterns.PageNameGlobalFieldDecl1(expr.Name + ".aspx")).Success) { script.Remove(TypeMember, true); } } if (!foundPageNameGlobalInClass) { script.InsertBefore(expr.Members.First(), allPatterns.PageNameGlobalFieldDecl(expr.Name + ".aspx")); } } }