Exemplo n.º 1
0
        private bool RestartAppIfNecessaryImpl(uint appid)
        {
            // Write the Steam AppID to a local file if not dropped by the other method.
            _restartAppIfNecessaryHook.OriginalFunction(appid);
            SteamAppId.Write((int)appid);

            return(false);
        }
        public static void DropSteamId()
        {
            var sam         = new SteamAppsManager();
            var processPath = Process.GetCurrentProcess().MainModule.FileName;

            foreach (var app in sam.SteamApps)
            {
                if (processPath.Contains(app.InstallDir))
                {
                    Program.Logger.WriteLine($"[SteamHook] Found Steam Library Entry with Id {app.AppID}, containing executable.", Program.Logger.ColorGreenLight);
                    SteamAppId.Write(app.AppID);
                    return;
                }
            }

            Program.Logger.WriteLine("[SteamHook] Not found Application in any Steam library. Oof.", Program.Logger.ColorRedLight);
        }
        public void Start(IModLoaderV1 loader)
        {
            _modLoader     = (IModLoader)loader;
            _reloadedHooks = _modLoader.GetController <IReloadedHooks>();
            Logger         = (ILogger)_modLoader.GetLogger();

            /* Your mod code starts here. */
            Logger.WriteLine($"[SteamHook] Checking for {SteamAppId.FileName}.");
            if (!SteamAppId.Exists())
            {
                Logger.WriteLine($"[SteamHook] Does not exist, dropping {SteamAppId.FileName}.");
                SteamAppidDropper.DropSteamId();
            }
            else
            {
                Logger.WriteLine($"[SteamHook] Exists, not overwriting.");
            }

            _steamHook = new SteamHook(_reloadedHooks);
        }