Merge pull request #12 from Casimir255/master
Fixed issues that were in master
This commit is contained in:
@@ -122,6 +122,7 @@ namespace SeamlessClientPlugin
|
||||
|
||||
public void Init(object gameInstance)
|
||||
{
|
||||
Patches.GetPatches();
|
||||
TryShow("Running Seamless Client Plugin v[" + Version + "]");
|
||||
PingTimer.Elapsed += PingTimer_Elapsed;
|
||||
PingTimer.Start();
|
||||
|
@@ -164,7 +164,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SeamlessTransfer\PingServer.cs" />
|
||||
<Compile Include="Messages\Transfer.cs" />
|
||||
<Compile Include="SeamlessTransfer\Patches.cs" />
|
||||
<Compile Include="Utilities\Patches.cs" />
|
||||
<Compile Include="SeamlessTransfer\SwitchServers.cs" />
|
||||
<Compile Include="Utilities\Utility.cs" />
|
||||
</ItemGroup>
|
||||
|
@@ -23,6 +23,7 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
Transfer = ClientTransfer;
|
||||
Request = Transfer.WorldRequest;
|
||||
|
||||
|
||||
if (Transfer.TargetServerID == 0)
|
||||
{
|
||||
SeamlessClient.TryShow("This is not a valid server!");
|
||||
@@ -30,15 +31,13 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SeamlessClient.TryShow("Beginning Redirect to server: " + Transfer.TargetServerID);
|
||||
MyGameService.OnPingServerResponded += PingResponded;
|
||||
MyGameService.OnPingServerFailedToRespond += FailedToRespond;
|
||||
|
||||
MyGameService.PingServer(Transfer.IPAdress);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void PingResponded(object sender, MyGameServerItem e)
|
||||
@@ -56,9 +55,7 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
private static void FailedToRespond(object sender, EventArgs e)
|
||||
{
|
||||
// If the target server failed to respond, we need to exit/return to menu
|
||||
|
||||
UnRegisterEvents();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -44,8 +44,8 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
|
||||
|
||||
|
||||
/* Static FieldInfos */
|
||||
public static FieldInfo MySessionLayer { get; private set; }
|
||||
/* Static FieldInfos and PropertyInfos */
|
||||
public static PropertyInfo MySessionLayer { get; private set; }
|
||||
public static FieldInfo VirtualClients { get; private set; }
|
||||
public static FieldInfo AdminSettings { get; private set; }
|
||||
public static FieldInfo RemoteAdminSettings { get; private set; }
|
||||
@@ -80,8 +80,8 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
MyMultiplayerClientBaseConstructor = GetConstructor(MyMultiplayerClientBase, BindingFlags.Instance | BindingFlags.NonPublic, new Type[] { typeof(MySyncLayer) });
|
||||
|
||||
|
||||
/* Get Fields */
|
||||
MySessionLayer = GetField(typeof(MySession), "SyncLayer", BindingFlags.Instance | BindingFlags.Public);
|
||||
/* Get Fields and Properties */
|
||||
MySessionLayer = GetProperty(typeof(MySession), "SyncLayer", BindingFlags.Instance | BindingFlags.Public);
|
||||
VirtualClients = GetField(typeof(MySession), "VirtualClients", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
AdminSettings = GetField(typeof(MySession), "m_adminSettings", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
RemoteAdminSettings = GetField(typeof(MySession), "m_remoteAdminSettings", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
@@ -266,6 +266,26 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
|
||||
}
|
||||
|
||||
private static PropertyInfo GetProperty(Type type, string PropertyName, BindingFlags Flags)
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertyInfo FoundProperty = type.GetProperty(PropertyName, Flags);
|
||||
|
||||
if (FoundProperty == null)
|
||||
throw new NullReferenceException($"Property for {PropertyName} is null!");
|
||||
|
||||
|
||||
return FoundProperty;
|
||||
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
throw Ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static ConstructorInfo GetConstructor(Type type, BindingFlags Flags, Type[] Types)
|
||||
{
|
||||
|
Reference in New Issue
Block a user