コード例 #1
0
        public static void Patch()
        {
            Logger.Current.Log("Startup");

            // Check if we are in the correct directory
            if (!File.Exists(Constants.GameExe))
            {
                Logger.Current.LogFatal($"Could not find game executable file '{Constants.GameExe}'!");
            }

            // Create patcher
            var patcher = new MonoPatcher();

            try
            {
                // Load and check game assembly
                patcher.Load(Constants.GameExe);

                // Check if game is patched
                // If not, patch the game.
                if (!patcher.IsPatched())
                {
                    // Patch the game
                    patcher.Patch();
                }
            }
            catch (Exception e)
            {
                Logger.Current.LogFatal(e.ToString());
            }

            // Dispose the patcher
            patcher.Dispose();
        }
コード例 #2
0
        public static void Patch()
        {
            Logger.Current.Log("Startup");

            string installInstance;

            // Check install type and current directory
            if (File.Exists(Constants.GameExe))
            {
                // Found game install
                installInstance = Constants.GameExe;
            }
            else if (File.Exists(Constants.ServerExe))
            {
                // Found server install
                installInstance = Constants.ServerExe;
            }
            else
            {
                // No install found
                installInstance = null;
                Logger.Current.LogFatal($"Could not find executable file '{Constants.GameExe}' or {Constants.ServerResourcesDir}!");
            }

            // Create patcher
            var patcher = new MonoPatcher();

            try
            {
                // Load and check game assembly
                patcher.Load(installInstance);

                // Check if game is patched
                // If not, patch the game.
                if (!patcher.IsPatched())
                {
                    // Patch the game
                    patcher.Patch();
                }
            }
            catch (Exception e)
            {
                Logger.Current.LogFatal(e.ToString());
            }

            // Dispose the patcher
            patcher.Dispose();
        }