mono fixes, tweaking service mode
This commit is contained in:
parent
59a86c7a7d
commit
0f73c81a6a
6 changed files with 53 additions and 32 deletions
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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( "> " );
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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<MethodInfo> invoke = new List<MethodInfo>();
|
||||
|
||||
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<Assembly, TypeCache> m_TypeCaches = new Dictionary<Assembly, TypeCache>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue