Example #1
0
 /// <summary>
 /// Attempts to apply all the Harmony patches in this assembly.
 /// </summary>
 public static void ApplyHarmonyPatches()
 {
     try {
         logger.Debug("Applying Harmony patches.");
         harmonyInstance.PatchAll(Assembly.GetExecutingAssembly());
     }
     catch (Exception ex) {
         logger.Critical("Error applying Harmony patches: " + ex.Message);
         logger.Debug(ex);
     }
 }
Example #2
0
        public override void CounterInit()
        {
            if (PluginConfig.Instance.HideDuringReplay && Utils.Utils.IsInReplay())
            {
                _logger.Info("We are in a replay, Counter hides.");
                return;
            }

            if (!Refresh())
            {
                _logger.Info("Can't Refresh");
                _logger.Info("Please check your settings about data source and the link or id.");
                return;
            }

            CreateCounter();
            Utils.GamePause.GameStart();

            try
            {
                _bpmDownloader.Start();
                _logger.Info("Start updating heart rate");
            }
            catch (Exception e)
            {
                _logger.Critical("Could not start bpm downloader.");
                _logger.Error(e.Message);
                _logger.Debug(e);
                _bpmDownloader.Stop();
                return;
            }
            Start();
            _logger.Info("Start updating counter text");
        }
Example #3
0
 private void OnMenuSceneLoadedFresh(ScenesTransitionSetupDataSO data)
 {
     try
     {
         PluginUI.SetupLevelDetailClone();
         Loader.SongsLoadedEvent += Loader_SongsLoadedEvent;
     }
     catch (Exception e)
     {
         Log.Critical($"Exception on fresh menu scene change:\n{e}");
     }
 }
Example #4
0
        public void Init(Config config, IPALogger logger, Zenjector zenjector)
        {
            Instance        = this;
            Log             = logger;
            CurrentSettings = config.Generated <Settings>();

            Highlights.HighlightScope[] requiredScopes = new
                                                         Highlights.HighlightScope[2]
            {
                Highlights.HighlightScope.Highlights,
                Highlights.HighlightScope.HighlightsRecordVideo,
            };

            var status = Highlights.CreateHighlightsSDK("SaberHighlight", requiredScopes);

            if (status != Highlights.ReturnCode.SUCCESS)
            {
                Log.Critical($"Failed to initialize highlights! ({status})");
                Highlights.UpdateLog();
                return;
            }

            Highlights.RequestPermissions(Highlight.LogCallback);

            Highlights.HighlightDefinition[] highlightDefinitions = new Highlights.HighlightDefinition[1];

            highlightDefinitions[0].Id            = "MAP_PLAY";
            highlightDefinitions[0].HighlightTags = Highlights.HighlightType.Achievement;

            highlightDefinitions[0].Significance = Highlights.HighlightSignificance.Good;

            highlightDefinitions[0].UserDefaultInterest  = true;
            highlightDefinitions[0].NameTranslationTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Map play"),
            };

            Highlights.ConfigureHighlights(highlightDefinitions, "en-US", Highlight.LogCallback);

            Highlights.OpenGroupParams ogp1 = new Highlights.OpenGroupParams();
            ogp1.Id = "MAP_PLAY_GROUP";
            ogp1.GroupDescriptionTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Map play group"),
            };

            Highlights.OpenGroup(ogp1, Highlight.LogCallback);

            zenjector.Install <Installer>(Location.Player);

            Log.Info("Loaded.");
        }
Example #5
0
        public void OnApplicationStart()
        {
            config = Conf.CreateConfig(ConfigType.YAML, BeatSaber.UserDataPath, "Particular");

            try
            {
                HarmonyInstance harmony = HarmonyInstance.Create("com.jackbaron.beatsaber.particular");
                harmony.PatchAll(Assembly.GetExecutingAssembly());
            }
            catch (Exception e)
            {
                log.Error(
                    "This plugin requires Harmony. Make sure you installed the plugin properly, " +
                    "as the Harmony DLL should have been installed with it."
                    );

                log.Critical(e);
            }
        }
 public void Critical(string message)
 {
     logSource.Critical(message);
 }
Example #7
0
 public void Critical(object message)
 {
     _logger.Critical(message?.ToString());
 }