[JEDI.NET-commits] tools/docs/ndoc patch ReflectionEngine.cs.patch,NONE,1.1
Status: Pre-Alpha
Brought to you by:
jedi_mbe
From: Marcel B. <jed...@us...> - 2004-11-26 11:57:12
|
Update of /cvsroot/jedidotnet/tools/docs/ndoc patch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28233/tools/docs/ndoc patch Added Files: ReflectionEngine.cs.patch Log Message: --- NEW FILE: ReflectionEngine.cs.patch --- Index: ndoc/src/Core/ReflectionEngine/ReflectionEngine.cs =================================================================== RCS file: /cvsroot/ndoc/ndoc/src/Core/ReflectionEngine/ReflectionEngine.cs,v retrieving revision 1.24 diff -u -r1.24 ReflectionEngine.cs --- ndoc/src/Core/ReflectionEngine/ReflectionEngine.cs 24 Nov 2004 16:03:45 -0000 1.24 +++ ndoc/src/Core/ReflectionEngine/ReflectionEngine.cs 26 Nov 2004 09:34:23 -0000 @@ -138,6 +138,22 @@ } } + /// <summary> + /// Determines whether or not the specified assembly references the Borland.Delphi assembly. + /// </summary> + /// <param name="assy">The assembly to check.</param> + /// <returns>true if the specified assembly references the Borland.Delphi assembly.</returns> + protected bool ReferencesBorlandDelphi(Assembly assy) + { + AssemblyName[] refList = assy.GetReferencedAssemblies(); + foreach (AssemblyName assyName in refList) + { + if (assyName.Name == "Borland.Delphi") + return true; + } + return false; + } + /// <summary>Builds an Xml file combining the reflected metadata with the /doc comments.</summary> /// <returns>full pathname of XML file</returns> /// <remarks>The caller is responsible for deleting the xml file after use...</remarks> @@ -368,6 +384,7 @@ private bool MustDocumentType(Type type) { Type declaringType = type.DeclaringType; + Type baseType = type.BaseType; //If type name starts with a digit it is not a valid identifier //in any of the MS .Net languages. @@ -389,6 +406,15 @@ return false; } + // Ignore Borland Delphi's meta classes and Unit class + if (ReferencesBorlandDelphi(type.Assembly)) + { + if (baseType != null && baseType.FullName == "Borland.Delphi.System.@TClass") + return false; + if (type.Name == "Unit") + return false; + } + return !type.FullName.StartsWith("<PrivateImplementationDetails>") && (declaringType == null || MustDocumentType(declaringType)) && @@ -477,6 +503,25 @@ return false; } + //ignore Borland Delphi's standard methods + if (ReferencesBorlandDelphi(method.DeclaringType.Assembly) && + ( + method.Name == "ClassName" || + method.Name == "ClassInfo" || + method.Name == "ClassNameIs" || + method.Name == "ClassParent" || + method.Name == "ClassType" || + method.Name == "Dispatch" || + method.Name == "FieldAddress" || + method.Name == "Free" || + method.Name == "InheritsFrom" || + method.Name == "MethodAddress" || + method.Name == "MethodName" + )) + { + return false; + } + return IsEditorBrowsable(method); } @@ -1073,6 +1118,7 @@ WriteBaseType(writer, type.BaseType); WriteDerivedTypes(writer, memberName); + //Debug.Assert(implementations == null); implementations = new ImplementsCollection(); //build a collection of the base type's interfaces @@ -1250,7 +1296,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(type),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(type),e); } } @@ -1263,7 +1309,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(fieldInfo),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(fieldInfo),e); } } @@ -1275,7 +1321,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(constructorInfo),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(constructorInfo),e); } } @@ -1288,7 +1334,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(methodInfo),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(methodInfo),e); } } @@ -1300,7 +1346,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(propertyInfo),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(propertyInfo),e); } } @@ -1312,7 +1358,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + parameterInfo.Member.ReflectedType.FullName + "." + parameterInfo.Member.Name + " param " + parameterInfo.Name,e); + throw new DocumenterException("Error retrieving custom attributes for " + parameterInfo.Member.ReflectedType.FullName + "." + parameterInfo.Member.Name + " param " + parameterInfo.Name,e); } } @@ -1324,7 +1370,7 @@ } catch(Exception e) { - TraceErrorOutput("Error retrieving custom attributes for " + GetMemberName(eventInfo),e); + throw new DocumenterException("Error retrieving custom attributes for " + GetMemberName(eventInfo),e); } } @@ -1372,7 +1418,16 @@ } catch(Exception e) { - TraceErrorOutput("Value for attribute field " + GetMemberName(field).Substring(2) + " cannot be determined",e); + Trace.WriteLine(""); + Trace.WriteLine("### value for attribute field " + GetMemberName(field).Substring(2) + " cannot be determined"); + Exception ex = e; + do + { + Trace.WriteLine("-> " + ex.Message); + ex=ex.InnerException; + } while(ex!=null); + Trace.WriteLine(""); + fieldValue="***UNKNOWN***"; } if (fieldValue.Length>0) @@ -1405,7 +1460,16 @@ } catch(Exception e) { - TraceErrorOutput("Value for attribute property " + GetMemberName(property).Substring(2) + " cannot be determined",e); + Trace.WriteLine(""); + Trace.WriteLine("### value for attribute property " + GetMemberName(property).Substring(2) + " cannot be determined"); + Exception ex = e; + do + { + Trace.WriteLine("-> " + ex.Message); + ex=ex.InnerException; + } while(ex!=null); + Trace.WriteLine(""); + propertyValue="***UNKNOWN***"; } if (propertyValue.Length>0) @@ -1955,7 +2019,15 @@ } catch(Exception e) { - TraceErrorOutput("Literal value for " + memberName.Substring(2) + " cannot be determined",e); + Trace.WriteLine(""); + Trace.WriteLine("### Literal value for " + memberName.Substring(2) + " cannot be determined"); + Exception ex = e; + do + { + Trace.WriteLine("-> " + ex.Message); + ex=ex.InnerException; + } while(ex!=null); + Trace.WriteLine(""); } if (fieldValue!=null) { @@ -3776,26 +3848,6 @@ writer.WriteEndElement(); } - private void TraceErrorOutput(string message) - { - TraceErrorOutput(message,null); - } - - private void TraceErrorOutput(string message, Exception ex) - { - Trace.WriteLine("[WARNING] " + message); - if (ex!=null) - { - Exception tempEx = ex; - do - { - Trace.WriteLine("-> " + tempEx.GetType().ToString() + ":" + ex.Message); - tempEx=tempEx.InnerException; - } while(tempEx!=null); - Trace.WriteLine(ex.StackTrace); - } - } - private AssemblyLoader SetupAssemblyLoader() { AssemblyLoader assemblyLoader = new AssemblyLoader(rep.ReferencePaths); |