public void LoadAssembly(string path) { _assembly = Assembly.LoadFrom(path); _allTypes = new List<TypeWrapper>(); _typesByNamespace = new Dictionary<string, IList<TypeWrapper>>(); _typesByFullName = new Dictionary<string, TypeWrapper>(); foreach (var type in this._assembly.GetTypes()) { if (type.Namespace == null || !type.Namespace.StartsWith("Amazon") || type.Namespace.Contains("Internal") || !type.IsPublic) continue; var wrapper = new TypeWrapper(type); _typesByFullName[wrapper.FullName] = wrapper; _allTypes.Add(wrapper); IList<TypeWrapper> namespaceTypes; if(!this._typesByNamespace.TryGetValue(wrapper.Namespace, out namespaceTypes)) { namespaceTypes = new List<TypeWrapper>(); _typesByNamespace[wrapper.Namespace] = namespaceTypes; } namespaceTypes.Add(wrapper); } }
public static XElement FindDocumentation(IDictionary<string, XElement> ndoc, TypeWrapper type) { var signature = "T:" + type.FullName; XElement element; if (!ndoc.TryGetValue(signature, out element)) return null; return element; }
public static XElement FindFieldDocumentation(IDictionary<string, XElement> ndoc, TypeWrapper type, string fieldName) { var signature = string.Format("F:{0}.{1}", type.FullName, fieldName); XElement element; if (!ndoc.TryGetValue(signature, out element)) return null; return element; }
void WriteType(FrameworkVersion version, TypeWrapper type) { var writer = new ClassWriter(this, version, type); writer.Write(); foreach (var item in type.GetConstructors().Where(x => x.IsPublic)) { var itemWriter = new ConstructorWriter(this, version, item); itemWriter.Write(); } foreach (var item in type.GetMethodsToDocument()) { // If a method is in another namespace, it is inherited and should not be overwritten if (item.DeclaringType.Namespace == type.Namespace) { var itemWriter = new MethodWriter(this, version, item); itemWriter.Write(); } } foreach (var item in type.GetEvents()) { // If an event is in another namespace, it is inherited and should not be overwritten if (item.DeclaringType.Namespace == type.Namespace) { var itemWriter = new EventWriter(this, version, item); itemWriter.Write(); } } }
private static void DetermineParameterName(TypeWrapper parameterTypeInfo, StringBuilder parameters) { if (parameterTypeInfo.IsGenericType) { parameters .Append(parameterTypeInfo.GenericTypeName) .Append("{"); IList<TypeWrapper> args = parameterTypeInfo.GenericTypeArguments(); for (var i = 0; i < args.Count; i++) { if (i != 0) { parameters.Append(","); } DetermineParameterName(args[i], parameters); } parameters.Append("}"); } else { parameters.Append(parameterTypeInfo.FullName); } }
public static XElement FindFieldDocumentation(TypeWrapper type, string fieldName) { var ndoc = GetDocumentationInstance(type.DocId); return FindFieldDocumentation(ndoc, type, fieldName); }
public static string GenerateFilename(TypeWrapper type) { return Fixup(string.Format("T_{0}_{1}", type.Namespace, type.Name)) + ".html"; }
void WriteType(FrameworkVersion version, TypeWrapper type) { var writer = new ClassWriter(this, version, type); writer.Write(); foreach (var item in type.GetConstructors().Where(x => x.IsPublic)) { var itemWriter = new ConstructorWriter(this, version, item); itemWriter.Write(); } foreach (var item in type.GetMethodsToDocument()) { var itemWriter = new MethodWriter(this, version, item); itemWriter.Write(); } foreach (var item in type.GetEvents()) { var itemWriter = new EventWriter(this, version, item); itemWriter.Write(); } }
public TypeWrapper[] GetGenericArguments() { if (!this.IsGenericMethod) return null; var types = this._info.GetGenericArguments(); var wrappers = new TypeWrapper[types.Length]; for(int i = 0; i < types.Length; i++) { wrappers[i] = new TypeWrapper(types[i], DocId); } return wrappers; }