From d061b5ecbe658198917a27a925f900133c37e994 Mon Sep 17 00:00:00 2001 From: Sardelka Date: Sat, 4 Jun 2022 12:04:02 +0800 Subject: [PATCH] Fix NullReferenceException on start. --- Client/Main.cs | 2 +- Client/Scripting/Engine.cs | 4 +--- Server/Scripting/Engine.cs | 20 ++++++++++++++++++++ Server/{ => Scripting}/ServerScript.cs | 0 Server/Server.cs | 5 ++--- 5 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 Server/Scripting/Engine.cs rename Server/{ => Scripting}/ServerScript.cs (100%) diff --git a/Client/Main.cs b/Client/Main.cs index 61f5741..bd43ce4 100644 --- a/Client/Main.cs +++ b/Client/Main.cs @@ -44,6 +44,7 @@ namespace RageCoop.Client /// public Main() { + Settings = Util.ReadSettings(); Logger=new Core.Logging.Logger() { LogPath="Scripts\\RageCoop\\RageCoop.Client.log", @@ -74,7 +75,6 @@ namespace RageCoop.Client }*/ SyncedPedsGroup=World.AddRelationshipGroup("SYNCPED"); Game.Player.Character.RelationshipGroup.SetRelationshipBetweenGroups(SyncedPedsGroup, Relationship.Neutral, true); - Settings = Util.ReadSettings(); Networking.Start(); #if !NON_INTERACTIVE #endif diff --git a/Client/Scripting/Engine.cs b/Client/Scripting/Engine.cs index a8d471b..95b39f0 100644 --- a/Client/Scripting/Engine.cs +++ b/Client/Scripting/Engine.cs @@ -11,9 +11,7 @@ namespace RageCoop.Client.Scripting { internal class Engine : Core.Scripting.ScriptingEngine { - public Engine() : base(typeof(ClientScript), Main.Logger) - { + public Engine() : base(typeof(ClientScript), Main.Logger) { } - } } } diff --git a/Server/Scripting/Engine.cs b/Server/Scripting/Engine.cs new file mode 100644 index 0000000..3c89032 --- /dev/null +++ b/Server/Scripting/Engine.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RageCoop.Core.Scripting; +namespace RageCoop.Server.Scripting +{ + internal class Engine:ScriptingEngine + { + public Engine() : base(typeof(ServerScript), Program.Logger) + { + + } + public static void Load() + { + + } + } +} diff --git a/Server/ServerScript.cs b/Server/Scripting/ServerScript.cs similarity index 100% rename from Server/ServerScript.cs rename to Server/Scripting/ServerScript.cs diff --git a/Server/Server.cs b/Server/Server.cs index e4cdaaa..53091cb 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -72,8 +72,8 @@ namespace RageCoop.Server } else { - Program.Logger.Error("Port forwarding failed! Your router may not support UPnP."); - Program.Logger.Warning("If you and your friends can join this server, please ignore this error or set UPnP in Settings.xml to false!"); + Program.Logger.Warning("Port forwarding failed! Your router may not support UPnP."); + Program.Logger.Info("If you and your friends can join this server, please ignore this error or set UPnP in Settings.xml to false!"); } } @@ -203,7 +203,6 @@ namespace RageCoop.Server Program.Logger.Error(e.InnerException.Message); } } - Program.Logger.Info("Searching for client-side files..."); DownloadManager.CheckForDirectoryAndFiles();