System.Web.Compilation.AspGenerator.GetRootBuilderType C# (CSharp) Method

GetRootBuilderType() private method

private GetRootBuilderType ( Stream inputStream, string filename ) : Type
inputStream Stream
filename string
return System.Type
		Type GetRootBuilderType (Stream inputStream, string filename)
		{
			Type ret = null;
			string fileContents;

			if (tparser != null)
				fileContents = ReadFileContents (inputStream, filename);
			else
				fileContents = null;
			
			if (!String.IsNullOrEmpty (fileContents)) {
				Type inheritedType = GetInheritedType (fileContents, filename);
				fileContents = null;
				if (inheritedType != null) {
					FileLevelControlBuilderAttribute attr;
					
					try {
						object[] attrs = inheritedType.GetCustomAttributes (typeof (FileLevelControlBuilderAttribute), true);
						if (attrs != null && attrs.Length > 0)
							attr = attrs [0] as FileLevelControlBuilderAttribute;
						else
							attr = null;
					} catch {
						attr = null;
					}

					ret = attr != null ? attr.BuilderType : null;
				}
			}
			
			if (ret == null) {
				if (tparser is PageParser)
					return typeof (FileLevelPageControlBuilder);
				else if (tparser is UserControlParser)
					return typeof (FileLevelUserControlBuilder);
				else
					return typeof (RootBuilder);
			} else
				return ret;
		}