Update of /cvsroot/netreflector/NetReflector/src/NetReflector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2560/src/NetReflector Modified Files: AssemblyInfo.cs NetReflector.cs NetReflector.csproj NetReflectorException.cs XmlDocumentationGenerator.cs Added Files: VersionAssemblyInfo.cs Log Message: - working on XmlDocumentationGenerator - started Xsd generation for NetReflector - lots of FxCop inspired improvements --- NEW FILE: VersionAssemblyInfo.cs --- using System.Reflection; //------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ [assembly: AssemblyVersionAttribute("1.2.1.1")] Index: XmlDocumentationGenerator.cs =================================================================== RCS file: /cvsroot/netreflector/NetReflector/src/NetReflector/XmlDocumentationGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmlDocumentationGenerator.cs 6 Jul 2004 05:13:23 -0000 1.1 --- XmlDocumentationGenerator.cs 15 Nov 2004 05:13:02 -0000 1.2 *************** *** 23,31 **** } public void Write(XmlWriter writer) { foreach (IXmlTypeSerialiser typeSerialiser in table) { ! writer.WriteStartElement("type"); writer.WriteElementString("name", typeSerialiser.Type.Name); writer.WriteElementString("namespace", typeSerialiser.Type.Namespace); --- 23,52 ---- } + public void WriteIndented(TextWriter writer) + { + XmlTextWriter xmlWriter = new XmlTextWriter(writer); + xmlWriter.Formatting = Formatting.Indented; + Write(xmlWriter); + } + public void Write(XmlWriter writer) { + writer.WriteStartDocument(); + writer.WriteStartElement("netreflector"); + try + { + WriteTypes(writer); + } + finally + { + writer.WriteEndDocument(); + } + } + + private void WriteTypes(XmlWriter writer) + { foreach (IXmlTypeSerialiser typeSerialiser in table) { ! writer.WriteStartElement("reflectortype"); writer.WriteElementString("name", typeSerialiser.Type.Name); writer.WriteElementString("namespace", typeSerialiser.Type.Namespace); *************** *** 41,44 **** --- 62,70 ---- if (output != null) writer.WriteElementString(elementName, output); } + + public static void WriteIfNotNull(XmlWriter writer, string elementName, Type type) + { + if (type != null) writer.WriteElementString(elementName, type.Name); + } } *************** *** 54,57 **** --- 80,86 ---- writer.WriteElementString("reflectorName", memberSerialiser.Attribute.Name); XmlDocumentationGenerator.WriteIfNotNull(writer, "description", memberSerialiser.Attribute.Description); + writer.WriteElementString("required", memberSerialiser.Attribute.Required.ToString()); + XmlDocumentationGenerator.WriteIfNotNull(writer, "instanceType", memberSerialiser.Attribute.InstanceType); + XmlDocumentationGenerator.WriteIfNotNull(writer, "instanceTypeKey", memberSerialiser.Attribute.InstanceTypeKey); writer.WriteEndElement(); } Index: NetReflectorException.cs =================================================================== RCS file: /cvsroot/netreflector/NetReflector/src/NetReflector/NetReflectorException.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NetReflectorException.cs 22 Oct 2004 12:45:34 -0000 1.2 --- NetReflectorException.cs 15 Nov 2004 05:13:02 -0000 1.3 *************** *** 1,9 **** using System; using System.Reflection; using System.Text; - using Exortech.NetReflector.Util; namespace Exortech.NetReflector { public class NetReflectorException : ApplicationException { --- 1,10 ---- using System; using System.Reflection; + using System.Runtime.Serialization; using System.Text; namespace Exortech.NetReflector { + [Serializable] public class NetReflectorException : ApplicationException { *************** *** 15,30 **** { } } public class NetReflectorTypeLoadException : NetReflectorException { ! public NetReflectorTypeLoadException(Assembly assembly, ReflectionTypeLoadException ex) : base(CreateMessage(assembly, ex)) { } ! private static string CreateMessage(Assembly assembly, ReflectionTypeLoadException ex) { StringBuilder builder = new StringBuilder(); ! builder.AppendFormat("Unable to load types from assembly {0}:", assembly.GetName()).Append(Environment.NewLine); builder.AppendFormat("Failed to load {0} of the {1} types defined in the assembly.", ex.LoaderExceptions.Length, ex.Types.Length).Append(Environment.NewLine); builder.Append("Exceptions: ").Append(Environment.NewLine); --- 16,40 ---- { } + + protected NetReflectorException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } + [Serializable] public class NetReflectorTypeLoadException : NetReflectorException { ! public NetReflectorTypeLoadException(Assembly loadedAssembly, ReflectionTypeLoadException ex) : base(CreateMessage(loadedAssembly, ex)) { } ! protected NetReflectorTypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context) ! { ! } ! ! private static string CreateMessage(Assembly loadedAssembly, ReflectionTypeLoadException ex) { StringBuilder builder = new StringBuilder(); ! builder.AppendFormat("Unable to load types from assembly {0}:", loadedAssembly.GetName()).Append(Environment.NewLine); builder.AppendFormat("Failed to load {0} of the {1} types defined in the assembly.", ex.LoaderExceptions.Length, ex.Types.Length).Append(Environment.NewLine); builder.Append("Exceptions: ").Append(Environment.NewLine); *************** *** 41,43 **** } } ! } --- 51,53 ---- } } ! } \ No newline at end of file Index: NetReflector.csproj =================================================================== RCS file: /cvsroot/netreflector/NetReflector/src/NetReflector/NetReflector.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetReflector.csproj 6 Jul 2004 05:13:22 -0000 1.4 --- NetReflector.csproj 15 Nov 2004 05:13:02 -0000 1.5 *************** *** 78,82 **** Name = "System.Data" AssemblyName = "System.Data" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> </References> --- 78,82 ---- Name = "System.Data" AssemblyName = "System.Data" ! HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> </References> *************** *** 140,143 **** --- 140,153 ---- /> <File + RelPath = "Generators\XsdGenerator.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Generators\XsdTypes.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Serialisers\IXmlMemberSerialiser.cs" SubType = "Code" Index: NetReflector.cs =================================================================== RCS file: /cvsroot/netreflector/NetReflector/src/NetReflector/NetReflector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetReflector.cs 5 Nov 2003 08:29:56 -0000 1.1 --- NetReflector.cs 15 Nov 2004 05:13:02 -0000 1.2 *************** *** 1,6 **** - using Exortech.NetReflector.Util; using System; using System.IO; using System.Xml; namespace Exortech.NetReflector --- 1,6 ---- using System; using System.IO; using System.Xml; + using Exortech.NetReflector.Util; namespace Exortech.NetReflector *************** *** 17,21 **** public static void Write(TextWriter writer, object target) { ! CheckNull(writer, "writer", typeof(TextWriter)); Write(new XmlTextWriter(writer), target); } --- 17,21 ---- public static void Write(TextWriter writer, object target) { ! CheckNull(writer, "writer", typeof (TextWriter)); Write(new XmlTextWriter(writer), target); } *************** *** 23,28 **** public static void Write(XmlWriter writer, object target) { ! CheckNull(writer, "writer", typeof(TextWriter)); ! CheckNull(target, "target", typeof(object)); ReflectorTypeAttribute attribute = ReflectorTypeAttribute.GetAttribute(target); --- 23,28 ---- public static void Write(XmlWriter writer, object target) { ! CheckNull(writer, "writer", typeof (TextWriter)); ! CheckNull(target, "target", typeof (object)); ReflectorTypeAttribute attribute = ReflectorTypeAttribute.GetAttribute(target); *************** *** 51,55 **** public static object Read(TextReader reader, NetReflectorTypeTable table) { ! CheckNull(reader, "reader", typeof(TextReader)); return Read(new XmlTextReader(reader), table); } --- 51,55 ---- public static object Read(TextReader reader, NetReflectorTypeTable table) { ! CheckNull(reader, "reader", typeof (TextReader)); return Read(new XmlTextReader(reader), table); } *************** *** 59,66 **** return Read(reader, null); } ! public static object Read(XmlReader reader, NetReflectorTypeTable table) { ! CheckNull(reader, "reader", typeof(XmlReader)); return Read(XmlUtil.ReadNode(reader), table); } --- 59,66 ---- return Read(reader, null); } ! public static object Read(XmlReader reader, NetReflectorTypeTable table) { ! CheckNull(reader, "reader", typeof (XmlReader)); return Read(XmlUtil.ReadNode(reader), table); } *************** *** 73,77 **** public static object Read(XmlNode node, NetReflectorTypeTable table) { ! CheckNull(node, "node", typeof(XmlNode)); if (table == null) { --- 73,77 ---- public static object Read(XmlNode node, NetReflectorTypeTable table) { ! CheckNull(node, "node", typeof (XmlNode)); if (table == null) { *************** *** 107,111 **** Read(XmlUtil.ReadNode(reader), instance, table); } ! public static void Read(XmlNode node, object instance) { --- 107,111 ---- Read(XmlUtil.ReadNode(reader), instance, table); } ! public static void Read(XmlNode node, object instance) { *************** *** 115,124 **** public static void Read(XmlNode node, object instance, NetReflectorTypeTable table) { ! CheckNull(node, "node", typeof(XmlNode)); ! CheckNull(instance, "instance", typeof(object)); if (table == null) { table = NetReflectorTypeTable.CreateDefault(); ! } new XmlTypeSerialiser(instance.GetType(), new ReflectorTypeAttribute(instance.GetType().Name)).ReadMembers(node, instance, table); } --- 115,124 ---- public static void Read(XmlNode node, object instance, NetReflectorTypeTable table) { ! CheckNull(node, "node", typeof (XmlNode)); ! CheckNull(instance, "instance", typeof (object)); if (table == null) { table = NetReflectorTypeTable.CreateDefault(); ! } new XmlTypeSerialiser(instance.GetType(), new ReflectorTypeAttribute(instance.GetType().Name)).ReadMembers(node, instance, table); } *************** *** 133,136 **** } } ! } ! --- 133,135 ---- } } ! } \ No newline at end of file Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/netreflector/NetReflector/src/NetReflector/AssemblyInfo.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AssemblyInfo.cs 24 Oct 2002 13:28:35 -0000 1.1.1.1 --- AssemblyInfo.cs 15 Nov 2004 05:13:01 -0000 1.2 *************** *** 1,58 **** using System.Reflection; ! using System.Runtime.CompilerServices; ! ! // ! // General Information about an assembly is controlled through the following ! // set of attributes. Change these attribute values to modify the information ! // associated with an assembly. ! // ! [assembly: AssemblyTitle("")] ! [assembly: AssemblyDescription("")] ! [assembly: AssemblyConfiguration("")] ! [assembly: AssemblyCompany("")] ! [assembly: AssemblyProduct("")] ! [assembly: AssemblyCopyright("")] ! [assembly: AssemblyTrademark("")] ! [assembly: AssemblyCulture("")] ! ! // ! // Version information for an assembly consists of the following four values: ! // ! // Major Version ! // Minor Version ! // Build Number ! // Revision ! // ! // You can specify all the values or you can default the Revision and Build Numbers ! // by using the '*' as shown below: ! [assembly: AssemblyVersion("1.0.*")] ! // ! // In order to sign your assembly you must specify a key to use. Refer to the ! // Microsoft .NET Framework documentation for more information on assembly signing. ! // ! // Use the attributes below to control which key is used for signing. ! // ! // Notes: ! // (*) If no key is specified, the assembly is not signed. ! // (*) KeyName refers to a key that has been installed in the Crypto Service ! // Provider (CSP) on your machine. KeyFile refers to a file which contains ! // a key. ! // (*) If the KeyFile and the KeyName values are both specified, the ! // following processing occurs: ! // (1) If the KeyName can be found in the CSP, that key is used. ! // (2) If the KeyName does not exist and the KeyFile does exist, the key ! // in the KeyFile is installed into the CSP and used. ! // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. ! // When specifying the KeyFile, the location of the KeyFile should be ! // relative to the project output directory which is ! // %Project Directory%\obj\<configuration>. For example, if your KeyFile is ! // located in the project directory, you would specify the AssemblyKeyFile ! // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] ! // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework ! // documentation for more information on this. ! // ! [assembly: AssemblyDelaySign(false)] ! [assembly: AssemblyKeyFile("")] ! [assembly: AssemblyKeyName("")] --- 1,21 ---- + using System; using System.Reflection; ! using System.Resources; ! using System.Runtime.InteropServices; ! using System.Security.Permissions; ! // Assembly metadata ! [assembly : AssemblyCopyright("Copyright © 2004 R. Owen Rogers")] ! [assembly : AssemblyCompany("Exortech")] ! [assembly : AssemblyProduct("NetReflector")] ! [assembly : AssemblyTitle("NetReflector")] ! [assembly : AssemblyDescription("NetReflector is an open source xml binding framework.")] ! [assembly : AssemblyInformationalVersion("1.1.4322.573")] ! [assembly : AssemblyKeyFile("..\\NetReflector.key")] ! [assembly : NeutralResourcesLanguage("en")] ! [assembly : CLSCompliant(true)] ! [assembly : ComVisible(false)] ! // Permissions ! [assembly : FileIOPermission(SecurityAction.RequestMinimum)] ! [assembly : ReflectionPermission(SecurityAction.RequestMinimum)] \ No newline at end of file |