diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index ab7fc3ab2..4efc9e157 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -2535,12 +2535,14 @@ namespace Server.Commands */ public static bool DontLink( Type type ) { + // MONO: type.Namespace is null/empty for generic arguments + + if ( type.Name == "T" || String.IsNullOrEmpty( type.Namespace ) || m_Namespaces == null ) + return true; + if( type.Namespace.StartsWith( "Server" ) ) return false; - if( m_Namespaces == null ) - return false; //sanity - return !m_Namespaces.ContainsKey( type.Namespace ); } } diff --git a/Scripts/Misc/DataPath.cs b/Scripts/Misc/DataPath.cs index a57e4d541..2e3dc9267 100644 --- a/Scripts/Misc/DataPath.cs +++ b/Scripts/Misc/DataPath.cs @@ -45,7 +45,7 @@ namespace Server.Misc if ( pathTD != null ) Core.DataDirectories.Add( pathTD ); - if ( Core.DataDirectories.Count == 0 ) + if ( Core.DataDirectories.Count == 0 && !Core.Service ) { Console.WriteLine( "Enter the Ultima Online directory:" ); Console.Write( "> " ); diff --git a/Scripts/Misc/ServerList.cs b/Scripts/Misc/ServerList.cs index 9802d3112..a2363e767 100644 --- a/Scripts/Misc/ServerList.cs +++ b/Scripts/Misc/ServerList.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Net; +using System.Net.NetworkInformation; using System.Net.Sockets; using Server; using Server.Network; @@ -113,6 +114,23 @@ namespace Server.Misc private static bool HasPublicIPAddress() { + NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); + + foreach ( NetworkInterface adapter in adapters ) { + IPInterfaceProperties properties = adapter.GetIPProperties(); + + foreach ( IPAddressInformation unicast in properties.UnicastAddresses ) { + IPAddress ip = unicast.Address; + + if ( !IPAddress.IsLoopback( ip ) && ip.AddressFamily != AddressFamily.InterNetworkV6 && !IsPrivateNetwork( ip ) ) + return true; + } + } + + return false; + + + /* IPHostEntry iphe = Dns.GetHostEntry( Dns.GetHostName() ); IPAddress[] ips = iphe.AddressList; @@ -124,6 +142,7 @@ namespace Server.Misc } return false; + */ } private static bool IsPrivateNetwork( IPAddress ip ) diff --git a/Server/Main.cs b/Server/Main.cs index 95b1856ab..3f99ee107 100644 --- a/Server/Main.cs +++ b/Server/Main.cs @@ -386,7 +386,7 @@ namespace Server if( !Directory.Exists( "Logs" ) ) Directory.CreateDirectory( "Logs" ); - Console.SetOut( m_MultiConOut = new MultiTextWriter( Console.Out, new FileLogger( "Logs/Console.log" ) ) ); + Console.SetOut( m_MultiConOut = new MultiTextWriter( new FileLogger( "Logs/Console.log" ) ) ); } else { @@ -431,7 +431,7 @@ namespace Server Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" ); int platform = (int)Environment.OSVersion.Platform; - if ( ( platform == 4 ) || ( platform == 128 ) ) { // MS 4, MONO 128 + if ( platform == 4 || platform == 128 ) { // MS 4, MONO 128 m_Unix = true; Console.WriteLine( "Core: Unix environment detected" ); } @@ -449,6 +449,13 @@ namespace Server return; } + ScriptCompiler.Invoke( "Configure" ); + + Region.Load(); + World.Load(); + + ScriptCompiler.Invoke( "Initialize" ); + SocketPool.Create(); MessagePump ms = m_MessagePump = new MessagePump(); diff --git a/Server/Network/Listener.cs b/Server/Network/Listener.cs index a6c833878..3473bb666 100644 --- a/Server/Network/Listener.cs +++ b/Server/Network/Listener.cs @@ -22,6 +22,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Net; +using System.Net.NetworkInformation; using System.Net.Sockets; using System.Threading; using Server; @@ -69,6 +70,17 @@ namespace Server.Network s.Listen( 8 ); if ( ipep.Address.Equals( IPAddress.Any ) ) { + NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); + + foreach ( NetworkInterface adapter in adapters ) { + IPInterfaceProperties properties = adapter.GetIPProperties(); + + foreach ( IPAddressInformation unicast in properties.UnicastAddresses ) { + Console.WriteLine( "Listening: {0}:{1}", unicast.Address, ipep.Port ); + } + } + + /* try { Console.WriteLine( "Listening: {0}:{1}", IPAddress.Loopback, ipep.Port ); @@ -80,6 +92,7 @@ namespace Server.Network Console.WriteLine( "Listening: {0}:{1}", ip[i], ipep.Port ); } catch { } + */ } else { Console.WriteLine( "Listening: {0}:{1}", ipep.Address, ipep.Port ); diff --git a/Server/ScriptCompiler.cs b/Server/ScriptCompiler.cs index df5dc4952..163aaa146 100644 --- a/Server/ScriptCompiler.cs +++ b/Server/ScriptCompiler.cs @@ -601,6 +601,11 @@ namespace Server Core.VerifySerialization(); Console.WriteLine( "done ({0} items, {1} mobiles)", Core.ScriptItems, Core.ScriptMobiles ); + return true; + } + + public static void Invoke( string method ) + { List invoke = new List(); for( int a = 0; a < m_Assemblies.Length; ++a ) @@ -609,7 +614,7 @@ namespace Server for( int i = 0; i < types.Length; ++i ) { - MethodInfo m = types[i].GetMethod( "Configure", BindingFlags.Static | BindingFlags.Public ); + MethodInfo m = types[i].GetMethod( method, BindingFlags.Static | BindingFlags.Public ); if( m != null ) invoke.Add( m ); @@ -620,31 +625,6 @@ namespace Server for( int i = 0; i < invoke.Count; ++i ) invoke[i].Invoke( null, null ); - - invoke.Clear(); - - Region.Load(); - World.Load(); - - for( int a = 0; a < m_Assemblies.Length; ++a ) - { - Type[] types = m_Assemblies[a].GetTypes(); - - for( int i = 0; i < types.Length; ++i ) - { - MethodInfo m = types[i].GetMethod( "Initialize", BindingFlags.Static | BindingFlags.Public ); - - if( m != null ) - invoke.Add( m ); - } - } - - invoke.Sort( new CallPriorityComparer() ); - - for( int i = 0; i < invoke.Count; ++i ) - invoke[i].Invoke( null, null ); - - return true; } private static Dictionary m_TypeCaches = new Dictionary();