Beispiel #1
0
        /// <inheritdoc cref="Manager.Attach"/>
        public override void Attach()
        {
            base.Attach();
            if (!_patched)
            {
                _patched      = true;
                _patchContext = _patchMgr.AcquireContext();
                ProfilerPatch.Patch(_patchContext);

                _canceller?.Cancel();
                _canceller?.Dispose();
                _canceller = new CancellationTokenSource();

                ThreadPool.QueueUserWorkItem(_ =>
                {
                    try
                    {
                        ProfilerResultQueue.Start(_canceller.Token);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                });
            }
        }
Beispiel #2
0
        public override void Attach()
        {
            base.Attach();

            _patchContext = _patchMgr.AcquireContext();
            GameLoopObserver.Patch(_patchContext);
        }
Beispiel #3
0
        /// <inheritdoc cref="Manager.Attach"/>
        public override void Attach()
        {
            base.Attach();

            if (_ctx == null)
            {
                _ctx = _patchManager.AcquireContext();
            }

            Torch.GameStateChanged += Torch_GameStateChanged;
            _sessionManager         = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                LogManager.GetCurrentClassLogger().Warn("No session manager. Player metrics won't work");
            }

            loadTimer           = new System.Timers.Timer(500);
            loadTimer.Elapsed  += LoadTimerElapsed;
            loadTimer.AutoReset = true;
            loadTimer.Start();

            var perfMetricManager = typeof(PerformanceMetricsManager);

            _ctx.GetPattern(_asyncSavingStart).Prefixes.Add(perfMetricManager.GetMethod(nameof(PrefixAsyncSavingStart), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
            _ctx.GetPattern(_asyncSavingStart).Suffixes.Add(perfMetricManager.GetMethod(nameof(SuffixAsyncSavingStart), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
            _ctx.GetPattern(_serverBanClient).Suffixes.Add(perfMetricManager.GetMethod(nameof(SuffixBanClient), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
            _ctx.GetPattern(_spaceRespawnComponentCreateNewIdentity).Suffixes.Add(perfMetricManager.GetMethod(nameof(SuffixCreateNewIdentity), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
            _patchManager.Commit();

            LogManager.GetCurrentClassLogger().Info("Attached");
        }
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);

            // Initialize the sessionManager so we can trigger on session ready
            var sessionManager = Torch.Managers.GetManager <TorchSessionManager>();

            if (sessionManager != null)
            {
                sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager loaded!");
            }

            // Setup our patch manager so we can patch methods
            patchManager = Torch.Managers.GetManager <PatchManager>();
            if (patchManager != null)
            {
                if (ctx == null)
                {
                    ctx = patchManager.AcquireContext();
                }
            }
            else
            {
                Log.Warn("No patch manager loaded!");
            }

            Log.Info("FactionPaint Initialized");
        }
Beispiel #5
0
 /// <inheritdoc cref="Manager.Attach"/>
 public override void Attach()
 {
     base.Attach();
     if (!_patched)
     {
         _patched      = true;
         _patchContext = _patchMgr.AcquireContext();
         HaEPatching.Patch(_patchContext);
     }
 }
Beispiel #6
0
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            //Grab Settings
            string path = Path.Combine(StoragePath, "QuantumHangar.cfg");

            _config = Persistent <Settings> .Load(path);

            if (Config.FolderDirectory == null || Config.FolderDirectory == "")
            {
                Config.FolderDirectory = Path.Combine(StoragePath, "QuantumHangar");
            }

            TorchSession = Torch.Managers.GetManager <TorchSessionManager>();
            if (TorchSession != null)
            {
                TorchSession.SessionStateChanged += SessionChanged;
            }


            Tracker = new GridTracker();



            if (Config.GridMarketEnabled)
            {
                Market = new GridMarket(StoragePath);
                Market.InitilizeGridMarket();
            }
            else
            {
                Debug("Starting plugin WITHOUT the Hangar Market!", null, ErrorType.Warn);
            }


            try
            {
            }
            catch (Exception e)
            {
                Log.Info("Unable to load grid market files! " + e);
            }

            EnableDebug = Config.AdvancedDebug;
            Dir         = Config.FolderDirectory;


            PatchManager manager = DependencyProviderExtensions.GetManager <PatchManager>(Torch.Managers);
            Patcher      patcher = new Patcher();

            patcher.Apply(manager.AcquireContext(), this);
            //Load files
        }
        /// <inheritdoc cref="Manager.Attach"/>
        public override void Attach()
        {
            base.Attach();
            if (!_patched)
            {
                _patched      = true;
                _patchContext = _patchMgr.AcquireContext();
                PBProfilerPatch.Patch(_patchContext);
            }

            Log.Info("Attached");
        }
Beispiel #8
0
        /// <inheritdoc cref="Manager.Attach"/>
        public override void Attach()
        {
            base.Attach();
            if (!_patched)
            {
                _patched      = true;
                _patchContext = _patchMgr.AcquireContext();
                ProfilerPatch.Patch(_patchContext);
            }

            _controlMgr?.RegisterControlFactory <ProfilerEntityControlViewModel>(CreateView);
            _controlMgr?.RegisterModelFactory <EntityViewModel>(CreateModel);
        }
Beispiel #9
0
#pragma warning restore 649

        public override void Attach()
        {
            _log.Info("Injecting VR manager");

            _patchContext = _patcher.AcquireContext();

            _patchContext.GetPattern(_createOptionsControls).Suffixes.Add(MyMeth(nameof(FixOptionsControls)));
            _patchContext.GetPattern(_renderApplySettings).Prefixes.Add(MyMeth(nameof(InitStereoMode)));
#if SPACE
            CameraMatrixPatch.Patch(_patchContext);
#endif
            BasicRenderPatch.Patch(_patchContext);
            AmbientOcclusionPatch.Patch(_patchContext);
            MyGuiScreenOptionsDisplayVr.Patch(_patchContext);
//            UserInterfacePatch.Patch(_patchContext);
        }
Beispiel #10
0
        public override void Init(ITorchBase torch)
        {
            //Settings S = new Settings();

            base.Init(torch);
            //Grab Settings
            string path = Path.Combine(StoragePath, "QuantumHangar.cfg");

            _config = Persistent <Settings> .Load(path);

            if (Config.FolderDirectory == null || Config.FolderDirectory == "")
            {
                Config.FolderDirectory = Path.Combine(StoragePath, "QuantumHangar");
                Directory.CreateDirectory(Config.FolderDirectory);
            }

            MainPlayerDirectory = Path.Combine(Config.FolderDirectory, "PlayerHangars");
            Directory.CreateDirectory(MainPlayerDirectory);


            TorchSession = Torch.Managers.GetManager <TorchSessionManager>();
            if (TorchSession != null)
            {
                TorchSession.SessionStateChanged += SessionChanged;
            }


            if (Config.GridMarketEnabled)
            {
                Controller = new HangarMarketController();
            }
            else
            {
                Log.Info("Starting plugin WITHOUT the Hangar Market!");
            }



            PatchManager manager = DependencyProviderExtensions.GetManager <PatchManager>(Torch.Managers);
            Patcher      patcher = new Patcher();

            patcher.Apply(manager.AcquireContext(), this);
            //Load files

            MigrateHangar();
        }
Beispiel #11
0
        /// <inheritdoc />
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            string path = Path.Combine(StoragePath, "Essentials.cfg");

            Log.Info($"Attempting to load config from {path}");
            _config = Persistent <EssentialsConfig> .Load(path);

            _knownIds = new KnownIdsStorage(Path.Combine(StoragePath, "Essentials.KnownSteamIds.txt"));
            _knownIds.Read();
            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager.  MOTD won't work");
            }
            homeDataPath = Path.Combine(StoragePath, "players.json");
            if (!File.Exists(homeDataPath))
            {
                File.Create(homeDataPath);
            }



            rankDataPath = Path.Combine(StoragePath, "ranks.json");
            if (!File.Exists(rankDataPath))
            {
                File.Create(rankDataPath);
            }



            Instance = this;
            _pm      = torch.Managers.GetManager <PatchManager>();
            _context = _pm.AcquireContext();
            SessionDownloadPatch.Patch(_context);

            if (Config.CutGameTags)
            {
                GameTagsPatch.Patch(_context);
            }
        }
Beispiel #12
0
        public override void Attach()
        {
            base.Attach();

            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager loaded!");
            }

            if (_ctx == null)
            {
                _ctx = _patchManager.AcquireContext();
            }
        }
Beispiel #13
0
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            Instance = this;
            Config.Instance.Load();
            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            _pm             = torch.Managers.GetManager <PatchManager>();
            _context        = _pm.AcquireContext();
            NexusDetected   = Torch.Managers.GetManager <PluginManager>().Plugins.Keys
                              .Contains(new Guid("28a12184-0422-43ba-a6e6-2e228611cca5"));
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }

            if (NexusDetected)
            {
                Log.Warn("Nexus plugin detected, some features will be disabled");
                return;
            }
            ReputationPatch.Patch(_context);
        }
Beispiel #14
0
        /// <inheritdoc />
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            string path = Path.Combine(StoragePath, "Essentials.cfg");

            Log.Info($"Attempting to load config from {path}");
            _config = Persistent <EssentialsConfig> .Load(path);

            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager.  MOTD won't work");
            }

            Instance = this;
            _pm      = torch.Managers.GetManager <PatchManager>();
            _context = _pm.AcquireContext();
            SessionDownloadPatch.Patch(_context);
        }