private void OnLoadComplete(PluginEvents.LoadCompleteEvent @event) { ortdp = (OsuRTDataProviderPlugin)getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider"); ortdp.ListenerManager.OnStatusChanged += ListenerManager_OnStatusChanged; ortdp.ListenerManager.OnBeatmapChanged += ListenerManager_OnBeatmapChanged; Task.Run(CheckProcess); }
void Loaded(PluginEvents.LoadCompleteEvent e) { var ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider"); var rtt = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "RealTimePPDisplayer"); _rawFormat = new StringBuilder(); try { if (rtt is RealTimePPDisplayer.RealTimePPDisplayerPlugin r) { _rtppdInfo = new RtppdInfo(); if (_rtppdInfo != null) { _ortdpWrapper = new osuTools.OrtdpWrapper.OrtdpWrapper(ortdp as OsuRTDataProvider.OsuRTDataProviderPlugin, r, _rtppdInfo); IO.CurrentIO.Write(NI18n.GetLanguageElement("LANG_INFO_INITSUC")); } } IO.CurrentIO.Write(Environment.CurrentDirectory); var process = System.Diagnostics.Process.GetCurrentProcess(); var curdir = process.MainModule?.FileName.Replace("Sync.exe", "plugins"); Environment.CurrentDirectory = curdir ?? ""; GetAvaProperties(_ortdpWrapper); } catch (NullReferenceException ex) { IO.CurrentIO.WriteColor(NI18n.GetLanguageElement("LANG_INFO_INITFAILED") + ex.ToString(), ConsoleColor.Red); } ThreadPool.QueueUserWorkItem(state => ConigFileWatcher()); ThreadPool.QueueUserWorkItem(state => RefreshMmf()); }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { foreach (var source_name in Setting.Instance.SourceList.ToString().Split(',')) { SourceBase source = null; switch (source_name.ToLower()) { case "bilibili": source = WrapSourcesFactory.GetBililiveSource(); break; case "twitch": source = WrapSourcesFactory.GetTwitchSource(); break; default: Log.Warn("unknown required source name:" + source_name); break; } if (source != null) { Log.Output("loaded source:" + source_name); wrapper_source.AddSource(source); } else { Log.Warn("loaded source failed:" + source_name); } } }
private void OnLoaded(PluginEvents.LoadCompleteEvent @event) { if (@event.Host.EnumPluings().OfType <RealTimePPDisplayerPlugin>().FirstOrDefault() is RealTimePPDisplayerPlugin rtpp) { rtpp.RegisterFormatter("rtppfmt-csharp-script", f => new RtppCSSFormatter(f), "return \"0.000pp\";"); logger.LogInfomation("register RTPP formatter:rtppfmt-csharp-script"); } }
private void OnLoad(PluginEvents.LoadCompleteEvent @event) { thread = new Thread(() => { ExecutorSync.PostTask(() => listener.RegisterFinishEvent()); ReOsuStoryBoardPlayer.MainProgram.Main(((string)Setting.Instance.StoryboardPlayerOptions).Split(' ')); }); thread.Start(); }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { OrtdpPlugin = e.Host.EnumPluings().OfType <OsuRTDataProviderPlugin>().FirstOrDefault(); if (OrtdpPlugin == null) { throw new Exception("MyLovely2dWifePlugin must require OsuRTDataProviderPlugin but there isnt exist."); } //default show window ShowWindow(); }
private void OnLoaded(PluginEvents.LoadCompleteEvent @event) { if (!LoadConfig()) { logger.LogError($"Load config files failed."); return; } InitORTDP(@event); InitOBSRemote(); logger.LogInfomation("Init done."); }
private void OsuLiveStatusPanelPlugin_onLoadComplete(PluginEvents.LoadCompleteEvent evt) { SyncHost host = evt.Host; SetupPlugin(host); Plugin config_gui = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); if (config_gui != null) { GuiRegisterHelper.RegisterConfigGui(config_gui, PPShowPluginInstance); } }
private void OnPluginLoadComplete(PluginEvents.LoadCompleteEvent e) { ortdp_plugin = (from plugin in e.Host.EnumPluings() where plugin is OsuRTDataProviderPlugin select plugin as OsuRTDataProviderPlugin).FirstOrDefault(); if (ortdp_plugin == null) { logger.LogInfomation($"找不到ORTDP插件,请输入命令\"plugins install provider\"并重启Sync"); return; } source_wrapper = ortdp_plugin.ModsChangedAtListening ? new SourcesWrapper.ORTDP.RealtimeDataProviderModsWrapper(ortdp_plugin, this) : new SourcesWrapper.ORTDP.OsuRTDataProviderWrapper(ortdp_plugin, this); source_wrapper.OnTrigEvent += Source_wrapper_OnTrigEvent; source_wrapper.Attach(); }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { if (!(e.Host.EnumPluings().FirstOrDefault(plugin => plugin is OsuRTDataProviderPlugin) is OsuRTDataProviderPlugin ortdpPlugin)) { Logger.LogError("Ortdp was not found."); return; } Logger.LogSuccess(PluginName + " is loaded."); MainWindow.OrtdpPlugin = ortdpPlugin; if (!Directory.Exists(GeneralConfig.WorkPath)) { Directory.CreateDirectory(GeneralConfig.WorkPath); } StartMainWindow(); }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { if (!(e.Host.EnumPluings().FirstOrDefault(plugin => plugin is OsuRTDataProviderPlugin) is OsuRTDataProviderPlugin ortdpPlugin)) { LogUtil.LogError("Ortdp was not found."); _initSuccessfully = false; return; } if (!Directory.Exists(GeneralConfig.WorkPath)) { Directory.CreateDirectory(GeneralConfig.WorkPath); } LogUtil.LogInfo("Ortdp has been loaded."); _ortdpController = new OrtdpController(ortdpPlugin); _ortdpController.StartReceive(); }
private void FirstInit(PluginEvents.LoadCompleteEvent evt) { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(this); OsuRTDataProviderPlugin ortdp_plugin = (from plugin in evt.Host.EnumPluings() where plugin is OsuRTDataProviderPlugin select plugin).First() as OsuRTDataProviderPlugin; if (ortdp_plugin == null) { Utils.Output("未找到ortdp插件,初始化失败", ConsoleColor.Red); return; } ortdp_plugin.ListenerManager.OnPlayingTimeChanged += OnCurrentPlayTimeChanged; ortdp_plugin.ListenerManager.OnBeatmapChanged += map => current_beatmap = map; ortdp_plugin.ListenerManager.OnStatusChanged += (old, now) => { if (now == OsuRTDataProvider.Listen.OsuListenerManager.OsuStatus.Playing) { OnPlay(); } else { OnClean(); } }; Init(); if (lyrics_provider == null) { Utils.Output("初始化失败,请确认配置是否正确", ConsoleColor.Red); } else { Utils.Output("初始化成功", ConsoleColor.Green); } }
private void OnPluginLoaded(PluginEvents.LoadCompleteEvent @event) { //Get ORTDP&RTPP plugin ortdp_plugin = @event.Host.EnumPluings().OfType <OsuRTDataProviderPlugin>().FirstOrDefault(); rtpp_plugin = @event.Host.EnumPluings().OfType <RealTimePPDisplayerPlugin>().FirstOrDefault(); if (ortdp_plugin == null) { logger.LogError("Plugin ORTDP is not found and can't able to collect/upload play data. please install ORTDP plugin. just type 'plugins install provider' and restart Sync."); return; } if (rtpp_plugin == null) { logger.LogError("Plugin RTPP is not found and can't able to collect/upload play data. please install RTPP plugin. just type 'plugins install displayer' and restart Sync."); return; } //bind events. ortdp_plugin.ListenerManager.OnStatusChanged += ListenerManager_OnStatusChanged; ortdp_plugin.ListenerManager.OnBeatmapChanged += ListenerManager_OnBeatmapChanged; ortdp_plugin.ListenerManager.OnPlayerChanged += ListenerManager_OnPlayerChanged; ortdp_plugin.ListenerManager.OnErrorStatisticsChanged += ListenerManager_OnErrorStatisticsChanged; //add a shadow display for getting data easy from rtpp plugin. var shadow_displayer_name = "cute_bunny"; Func <int?, DisplayerBase> displayer_creator = new Func <int?, DisplayerBase>(id => displayer); rtpp_plugin.RegisterDisplayer(shadow_displayer_name, displayer_creator); var add_displayer_method = typeof(RealTimePPDisplayerPlugin).GetMethod("AddDisplayer", BindingFlags.NonPublic | BindingFlags.Instance); add_displayer_method.Invoke(rtpp_plugin, new object[] { shadow_displayer_name }); logger.LogInfomation("Plugin is ready."); }
private void OnAllPluginLoadedFinish(PluginEvents.LoadCompleteEvent e) { TryRegisterSourceFromOsuRTDataProvider(e.Host); }
private void OnAllPluginLoadedFinish(PluginEvents.LoadCompleteEvent e) { logger.LogInfomation("Sync插件已经全部加载完毕,这里可以引用其他插件来进行操作"); }