From ea7c09fc84bc0077fc209dd226cd3c3f546e4442 Mon Sep 17 00:00:00 2001 From: asayre Date: Fri, 16 Jun 2006 07:38:36 +0000 Subject: [PATCH] --- Data/objects.xml | 497 ++++++++++++++++++++------------------- Scripts/Commands/Docs.cs | 147 ++++++++---- 2 files changed, 359 insertions(+), 285 deletions(-) diff --git a/Data/objects.xml b/Data/objects.xml index 1e577ba5b..25d6a581d 100644 --- a/Data/objects.xml +++ b/Data/objects.xml @@ -34,7 +34,6 @@ - @@ -241,7 +240,7 @@ - + @@ -288,66 +287,66 @@ - - + + - - + + - + - + - + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - + - - + + - + @@ -435,9 +434,9 @@ - + - + @@ -458,7 +457,7 @@ - + @@ -467,7 +466,7 @@ - + @@ -497,8 +496,8 @@ - - + + @@ -517,7 +516,7 @@ - + @@ -530,28 +529,28 @@ - - - + + + - - + + - - - + + + - - - - - - - + + + + + + + @@ -618,10 +617,10 @@ - + - + @@ -1023,7 +1022,7 @@ - + @@ -1203,14 +1202,13 @@ - - + @@ -1218,14 +1216,16 @@ + + - + @@ -1236,11 +1236,13 @@ + + @@ -1251,12 +1253,11 @@ + - - - + @@ -1270,15 +1271,18 @@ + + + @@ -1295,6 +1299,7 @@ + @@ -1303,16 +1308,17 @@ - - + + - + - + + @@ -1331,12 +1337,13 @@ - + + @@ -1364,19 +1371,19 @@ - - + - + + @@ -1384,11 +1391,12 @@ - + + @@ -1415,7 +1423,9 @@ + + @@ -1429,8 +1439,9 @@ - + + @@ -1458,11 +1469,12 @@ + - - + + @@ -1479,12 +1491,12 @@ - + - + @@ -1518,6 +1530,7 @@ + @@ -1526,9 +1539,6 @@ - - - @@ -1536,6 +1546,7 @@ + @@ -1543,18 +1554,19 @@ - + + - - + + @@ -1754,7 +1766,7 @@ - + @@ -1772,7 +1784,7 @@ - + @@ -1937,7 +1949,7 @@ - + @@ -2018,10 +2030,10 @@ - + - + @@ -2036,17 +2048,17 @@ - - - + + + - - - - + + + + - + @@ -2067,12 +2079,12 @@ - + - + @@ -2083,7 +2095,7 @@ - + @@ -2094,15 +2106,15 @@ - + - + - + @@ -2126,11 +2138,11 @@ - + - + @@ -2152,7 +2164,7 @@ - + @@ -2255,20 +2267,20 @@ - + - - + + - + - + @@ -2303,10 +2315,10 @@ - + - - + + @@ -2321,13 +2333,13 @@ - + - + - + @@ -2341,36 +2353,36 @@ - + - + - + - + - + - + - - - - + + + + - - - + + + @@ -2383,11 +2395,11 @@ - - - + + + - + @@ -2402,24 +2414,24 @@ - + - + - + - + - + - + @@ -2431,16 +2443,16 @@ - - + + - - + + @@ -2481,151 +2493,150 @@ - + - + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + - + - - - + + + - - - + + + - - - + + + - - + + - - - - + + + + - - - - + + + + - - - + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - + - - - - - - - - + + + + + + + + - - - - + + + - - - + + + diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index 7941e4351..0f19f958a 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -148,17 +148,6 @@ namespace Server.Commands } } - private class NamespaceComparer : IComparer - { - public int Compare( object x, object y ) - { - DictionaryEntry a = (DictionaryEntry)x; - DictionaryEntry b = (DictionaryEntry)y; - - return ((string)a.Key).CompareTo( (string)b.Key ); - } - } - private class TypeInfo { public Type m_Type, m_BaseType, m_Declaring; @@ -176,13 +165,15 @@ namespace Server.Commands m_Interfaces = type.GetInterfaces(); - m_TypeName = type.Name; - m_FileName = Docs.GetFileName( "docs/types/", m_TypeName, ".html" ); + m_TypeName = GetGenericTypeName( m_Type ); + + m_FileName = Docs.GetFileName( "docs/types/", GetGenericTypeName( m_Type, "-", "-" ), ".html" ); m_Writer = Docs.GetWriter( "docs/types/", m_FileName ); } } + #region FileSystem private static readonly char[] ReplaceChars = "<>".ToCharArray(); public static string GetFileName( string root, string name, string ext ) @@ -210,6 +201,37 @@ namespace Server.Commands return file; } + private static string m_RootDirectory = Path.GetDirectoryName( Environment.GetCommandLineArgs()[0] ); + + private static void EnsureDirectory( string path ) + { + path = Path.Combine( m_RootDirectory, path ); + + if( !Directory.Exists( path ) ) + Directory.CreateDirectory( path ); + } + + private static void DeleteDirectory( string path ) + { + path = Path.Combine( m_RootDirectory, path ); + + if( Directory.Exists( path ) ) + Directory.Delete( path, true ); + } + + private static StreamWriter GetWriter( string root, string name ) + { + return new StreamWriter( Path.Combine( Path.Combine( m_RootDirectory, root ), name ) ); + } + + private static StreamWriter GetWriter( string path ) + { + return new StreamWriter( Path.Combine( m_RootDirectory, path ) ); + } + #endregion + + #region GetPair + private static string[,] m_Aliases = new string[,] { { "System.Object", "object" }, @@ -230,10 +252,6 @@ namespace Server.Commands { "System.Void", "void" } }; - private static string m_RootDirectory = Path.GetDirectoryName( Environment.GetCommandLineArgs()[0] ); - - private const string RefString = "ref "; - private static int m_AliasLength = m_Aliases.GetLength( 0 ); public static string GetPair( Type varType, string name, bool ignoreRef ) @@ -326,24 +344,12 @@ namespace Server.Commands return String.Concat( prepend, aliased, append, name ); } + #endregion + private static Dictionary m_Types; private static Dictionary> m_Namespaces; - private static void EnsureDirectory( string path ) - { - path = Path.Combine( m_RootDirectory, path ); - - if( !Directory.Exists( path ) ) - Directory.CreateDirectory( path ); - } - - private static void DeleteDirectory( string path ) - { - path = Path.Combine( m_RootDirectory, path ); - - if( Directory.Exists( path ) ) - Directory.Delete( path, true ); - } + #region Root documentation private static void Document() { @@ -442,6 +448,10 @@ namespace Server.Commands } } + #endregion + + #region BODs + private const int Iron = 0xCCCCDD; private const int DullCopper = 0xAAAAAA; private const int ShadowIron = 0x777799; @@ -1178,6 +1188,9 @@ namespace Server.Commands #endregion + #endregion + + #region Bodies public static List LoadBodies() { List list = new List(); @@ -1283,7 +1296,9 @@ namespace Server.Commands html.WriteLine( "" ); } } + #endregion + #region Speech private static void DocumentKeywords() { List> tables = LoadSpeechFile(); @@ -1431,6 +1446,9 @@ namespace Server.Commands return tables; } + #endregion + + #region Commands private class DocCommandEntry { @@ -1693,6 +1711,8 @@ namespace Server.Commands html.WriteLine( "" ); } + #endregion + private static void LoadTypes( Assembly a, Assembly[] asms ) { Type[] types = a.GetTypes(); @@ -1781,16 +1801,7 @@ namespace Server.Commands return false; } - private static StreamWriter GetWriter( string root, string name ) - { - return new StreamWriter( Path.Combine( Path.Combine( m_RootDirectory, root ), name ) ); - } - - private static StreamWriter GetWriter( string path ) - { - return new StreamWriter( Path.Combine( m_RootDirectory, path ) ); - } - + #region Constructable Objects private static Type typeofItem = typeof( Item ), typeofMobile = typeof( Mobile ), typeofMap = typeof( Map ); private static Type typeofCustomEnum = typeof( CustomEnumAttribute ); @@ -1912,6 +1923,10 @@ namespace Server.Commands html.WriteLine( "" ); } + #endregion + + #region Tooltips + private const string HtmlNewLine = " "; private static object[,] m_Tooltips = new object[,] @@ -1996,6 +2011,11 @@ namespace Server.Commands return ""; } + #endregion + + #region Const Strings + + private const string RefString = "ref "; private const string GetString = " get;"; private const string SetString = " set;"; @@ -2005,6 +2025,7 @@ namespace Server.Commands private const string VirtString = "virtual "; private const string CtorString ="(ctor) "; private const string StaticString = "(static) "; + #endregion private static void DocumentLoadedTypes() { @@ -2336,8 +2357,49 @@ namespace Server.Commands html.WriteLine( ")
" ); } + + public static string GetGenericTypeName( Type type ) + { + return GetGenericTypeName( type, "<", ">" ); + } + + public static string GetGenericTypeName( Type type, string leftGenericBracket, string rightGenericBracket ) + { + string name = type.Name; + + if( type.IsGenericType ) + { + int index = name.IndexOf( '`' ); + + if( index > 0 ) + { + StringBuilder sb = new StringBuilder( name.Substring( 0, index ) ); + + sb.Append( leftGenericBracket ); + + Type[] typeArguments = type.GetGenericArguments(); + + for( int i = 0; i < typeArguments.Length; i++ ) + { + if( i != 0 ) + sb.Append( ',' ); + + sb.Append( typeArguments[i].Name ); + } + + sb.Append( rightGenericBracket ); + + name = sb.ToString(); + + } + } + + return name; + } + } + #region BodyEntry & BodyType public enum ModelBodyType { Invalid=-1, @@ -2393,4 +2455,5 @@ namespace Server.Commands return v; } } + #endregion } \ No newline at end of file