// this is where stuff goes!
        private void Run(string[] args)
        {
            // This is for args that should be used before IRSE loads

            string configPath = ExtenderGlobals.GetFilePath(IRSEFileName.NLogConfig);

            LogManager.Configuration = new XmlLoggingConfiguration(configPath);

            _useGui = true;

            if (args.Contains("-nogui"))
            {
                _useGui = false;
            }

            if (args.Contains("-usedevversion") || Config.Settings.EnableDevelopmentVersion)
            {
                Console.WriteLine(string.Format(Program.Localization.Sentences["UseDevVersion"]));
            }

            if (args.Contains("-noupdateirse") || !Config.Settings.EnableExtenderAutomaticUpdates)
            {
                UpdateManager.EnableAutoUpdates = false;
                Console.WriteLine(string.Format(Program.Localization.Sentences["NoUpdate"]));
                Console.WriteLine();
            }

            if (args.Contains("-autorestart") || Config.Settings.AutoRestartsEnable)
            {
                UpdateManager.EnableAutoRestarts = true;
                Console.WriteLine(string.Format("IRSE: (Arg: -autorestart is set) IRSE Will auto restart when it needs to."));
            }

            Console.WriteLine();
            Console.ResetColor();

            // Run anything that doesn't require the loading of IR references above here

            //Harmony
            if (Harmony.DEBUG)
            {
                Console.WriteLine("IRSE: Harmony Debug enabled, logging will be in the file 'harmony.log.txt' on your desktop.");
            }

            Console.WriteLine("Initializing Harmony Patches...");
            Harmony = new Harmony("com.tse.irse");
            Harmony.PatchAll();
            Console.WriteLine();

            m_serverInstance = new ServerInstance();

            ThisGameVersion = m_serverInstance.Assembly.GetName().Version.ToString();

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write(string.Format(Program.Localization.Sentences["ForGameVersion"]));
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(ForGameVersion + "\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write(string.Format(Program.Localization.Sentences["ThisGameVersion"]));
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(ThisGameVersion + "\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write(string.Format(Program.Localization.Sentences["OnlineGameVersion"]));
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(SteamCMD.GetGameVersion() + "\n");
            Console.ForegroundColor = ConsoleColor.White;

            Console.ForegroundColor = ConsoleColor.Yellow;
            if (new Version(ThisGameVersion) < SteamCMD.GetGameVersion())
            {
                Console.WriteLine(string.Format(Program.Localization.Sentences["NewIRVersion"]));
            }

            if (new Version(ForGameVersion) < new Version(ThisGameVersion))
            {
                Console.WriteLine(string.Format(Program.Localization.Sentences["IRNewer"]));
            }

            Console.WriteLine();
            Console.ResetColor();

            ServerInstance.Instance.OnServerStarted += Instance_OnServerStarted;

            updateManager = new UpdateManager(); // REPO NEEDS TO BE PUBLIC

            //Build IR's paths so we can use the Localization system
            Game.Program.InitFileSystems();
            Game.Program.InitGameDirectory("InterstellarRift");
            Game.Program.CommandLineArgs = new string[1];

            m_serverInstance.PluginManager.LoadAllPlugins();

            SetupGUI();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write("IRSE: Ready for Input, try using ");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("help\n\n");
            Console.ResetColor();

            if (args.Contains("-autostart") || Config.Settings.AutoStartEnable)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine(string.Format(Program.Localization.Sentences["AutoStart"]));
                Console.ResetColor();
                StartServer();
            }

            // run only when they change properties to update the non manual section of ServerConfigProperties
            //new Modules.GameConfig.ServerConfigConverter().BuildAndUpdateConfigProperties();

            //console logic for commands
            ReadConsoleCommands(args);
        }
        private static void Main(string[] args)
        {
            SetTitle();

            new FolderStructure().Build();

            m_config  = new Config();
            debugMode = m_config.Settings.DebugMode;

            AppDomain.CurrentDomain.AssemblyResolve += (sender, rArgs) =>
            {
                Assembly     executingAssembly = Assembly.GetExecutingAssembly();
                AssemblyName assemblyName      = new AssemblyName(rArgs.Name);

                var pathh = assemblyName.Name + ".dll";
                if (assemblyName.CultureInfo != null && assemblyName.CultureInfo.Equals(CultureInfo.InvariantCulture) == false)
                {
                    pathh = String.Format(@"{0}\{1}", assemblyName.CultureInfo, pathh);
                }

                // get binaries in plugins
                String   modPath        = Path.Combine(FolderStructure.IRSEFolderPath, "plugins");
                String[] subDirectories = Directory.GetDirectories(modPath);
                foreach (String subDirectory in subDirectories)
                {
                    string path = Path.Combine(Path.GetFullPath(FolderStructure.IRSEFolderPath), "plugins", subDirectory, pathh);
                    if (File.Exists(path))
                    {
                        return(Assembly.LoadFrom(path));
                    }


                    // maybe a subfolder?
                    foreach (String subDirectory2 in Directory.GetDirectories(subDirectory))
                    {
                        string path2 = Path.Combine(Path.GetFullPath(FolderStructure.IRSEFolderPath), "plugins", subDirectory2, "bin", pathh);
                        if (File.Exists(path2))
                        {
                            return(Assembly.LoadFrom(path2));
                        }
                    }
                }

                using (Stream stream = executingAssembly.GetManifestResourceStream(pathh))
                {
                    if (stream == null)
                    {
                        return(null);
                    }

                    var assemblyRawBytes = new byte[stream.Length];
                    stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length);
                    //Console.WriteLine("found missing dll: " + pathh);
                    return(Assembly.Load(assemblyRawBytes));
                }
            };

            string configPath = ExtenderGlobals.GetFilePath(IRSEFileName.NLogConfig);

            LogManager.Configuration = new XmlLoggingConfiguration(configPath);

            Console.WriteLine($"Interstellar Rift Extended Server v{Version} Initializing....");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Git Branch: {ThisAssembly.Git.Branch}");
            if (Dev)
            {
                Console.WriteLine($"Git Commit: {ThisAssembly.Git.Commit}");
                Console.WriteLine($"Git SHA: {ThisAssembly.Git.Sha}");
            }
            Console.WriteLine();
            // This is for args that should be used before IRSE loads
            bool noUpdateIRSE          = false;
            bool noUpdateIR            = false;
            bool usePrereleaseVersions = false;

            Console.ForegroundColor = ConsoleColor.Green;
            foreach (string arg in args)
            {
                if (arg.Equals("-noupdateirse"))
                {
                    noUpdateIRSE = true;
                }

                if (arg.Equals("-noupdateir"))
                {
                    noUpdateIR = true;
                }

                if (arg.Equals("-usedevversion"))
                {
                    usePrereleaseVersions = true;
                }
            }

            if (usePrereleaseVersions || Config.Settings.EnableDevelopmentVersion)
            {
                Console.WriteLine("IRSE: (Arg: -usedevversion is set) IRSE Will use Pre-releases versions");
            }

            if (noUpdateIRSE || !Config.Settings.EnableExtenderAutomaticUpdates)
            {
                UpdateManager.EnableAutoUpdates = false;
                Console.WriteLine("IRSE: (Arg: -noupdate is set or option in IRSE config is enabled) IRSE will not be auto-updated.");
            }

            if (noUpdateIR || !Config.Settings.EnableAutomaticUpdates)
            {
                SteamCMD.AutoUpdateIR = false;
                Console.WriteLine("IRSE: (Arg: -noupdateir is set) IsR Dedicated Serevr will not be auto-updated.");
            }
            Console.WriteLine();
            Console.ResetColor();

            //new SteamCMD().GetSteamCMD();

            // Run anything that doesn't require the loading of IR references above here

            if (!File.Exists(Path.Combine(FolderStructure.RootFolderPath, "IR.exe")))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("IRSE: IR.EXE wasn't found.");
                Console.WriteLine("Make sure IRSE.exe is in the same folder as IR.exe.");
                Console.WriteLine("Press enter to close.");
                Console.ReadLine();
                Environment.Exit(0);
            }



            m_serverInstance = new ServerInstance();
            ThisGameVersion  = m_serverInstance.Assembly.GetName().Version.ToString();

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("For Game Version: ");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(ForGameVersion + "\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("This Game Version: ");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(ThisGameVersion + "\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Online Game Version: ");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(SteamCMD.GetGameVersion() + "\n");
            Console.ForegroundColor = ConsoleColor.White;

            Console.ForegroundColor = ConsoleColor.Yellow;
            if (new Version(ThisGameVersion) < SteamCMD.GetGameVersion())
            {
                Console.WriteLine("There is a new version of Interstellar Rift! Update your IR Installation!");
            }

            if (new Version(ForGameVersion) < new Version(ThisGameVersion))
            {
                Console.WriteLine("Interstellar Rifts Version is newer than what this version of IRSE Supports, Check for IRSE updates!");
            }

            Console.WriteLine();
            Console.ResetColor();

            updateManager = new UpdateManager(); // REPO NEEDS TO BE PUBLIC

            Instance = new Program();
            Instance.Run(args);
        }