public OsuLivePlayerPlugin() : base(typeof(OsuLivePlayerPlugin).Name, "yf_extension") { var configManager = new PluginConfigurationManager(this); configManager.AddItem(GeneralConfig); configManager.AddItem(DisplayConfig); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnLoadComplete); EventBus.BindEvent <PluginEvents.ProgramReadyEvent>(OnProgramReady); }
public OBSControlPlugin() : base(nameof(OBSControlPlugin), "MikiraSora") { EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnLoaded); config_manager = new PluginConfigurationManager(this); config_manager.AddItem(this); }
private void DefaultPlugin_onLoadComplete(LoadCompleteEvent @event) { MainHost = @event.Host; MainFilters = MainHost.Filters; MainSources = MainHost.Sources; MainSource = MainHost.SourceWrapper; MainClient = MainHost.ClientWrapper; MainMessager = MainHost.Messages; MainClients = MainHost.Clients; //config load Config = new PluginConfigurationManager(this); Config.AddItem(srcBili); Config.AddItem(srcTwitch); Config.AddItem(clientOSU); }
public override void OnEnable() { App = new GifPlayerApp(); App.Start(); ConfigManager = new PluginConfigurationManager(this); Config = new Configuration(App); ConfigManager.AddItem(Config); this.EventBus.BindEvent <PluginEvents.InitCommandEvent>((@event) => { @event.Commands.Dispatch.bind("gif", _ => { App.ShowForm(); return(true); }, "Show or hide gif player window"); }); this.EventBus.BindEvent <PluginEvents.ProgramReadyEvent>((@event) => { var ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin; ortdp.ListenerManager.OnPlayingTimeChanged += ListenerManager_OnPlayingTimeChanged; ortdp.ListenerManager.OnBeatmapChanged += ListenerManager_OnBeatmapChanged; ortdp.ListenerManager.OnModsChanged += ListenerManager_OnModsChanged; ortdp.ListenerManager.OnStatusChanged += ListenerManager_OnStatusChanged; App.LoadImage(Config.ImagePath); }); }
/// <summary> /// Plugin Preinit /// </summary> public override void OnEnable() { _configManager = new PluginConfigurationManager(this); _configManager.AddItem(new SettingIni()); var ortdp = new OsuRTDataProviderWarpper(getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider"), ref _osuDisplayerControls); var gui = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); TourneyMode = ortdp.TourneyMode; TourneyWindowCount = ortdp.TourneyWindowCount; if (gui != null) { GuiRegisterHelper.RegisterFormatEditorWindow(gui); } _fixedInterval = TimeSpan.FromSeconds(1.0 / Setting.FPS); _fixedUpdateThread = Task.Run(() => { while (!_stopFixedUpdate) { foreach (var c in _osuDisplayerControls) { foreach (var d in c.Displayers) { d.Value.FixedDisplay(_fixedInterval.TotalSeconds); } } Thread.Sleep(_fixedInterval); } }); RegisterDisplayer("wpf", id => { var d = new WpfDisplayer(id); if (!TourneyMode) { d.HideRow(0); } if (!Setting.DisplayHitObject) { d.HideRow(2); } return(d); }); RegisterDisplayer("mmf", id => new MmfDisplayer(id, "rtpp")); RegisterDisplayer("mmf-split", id => new MmfDisplayer(id, "rtpp", true)); RegisterDisplayer(MultiOutputDisplayer.METHOD_NAME, id => new MultiOutputDisplayer(id, _multiDisplayerCreators, _formatterCreators)); RegisterDisplayer("text", id => new TextDisplayer(id, string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()))); RegisterDisplayer("text-split", id => new TextDisplayer(id, string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()), true)); RegisterDisplayer("socket", id => new SocketDisplayer(id, Setting.IpAddress, Setting.Port)); RegisterFormatter("rtpp-fmt", (fmt) => new RtppFormatter(fmt), "${rtpp@1}pp"); RegisterFormatter("rtppfmt-bp", (fmt) => new RtppFormatWithBp(fmt), "${rtpp@1}pp (${rtpp_with_weight@1}pp) BP: #${rtbp@0}"); IO.CurrentIO.WriteColor($"{PLUGIN_NAME} By {PLUGIN_AUTHOR} Ver.{VERSION}", ConsoleColor.DarkCyan); }
public LiveStreamStoryboardDisplayerPlugin() : base("LiveStreamStoryboardDisplayer", "MikiraSora") { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(Setting.Instance); EventBus.BindEvent <PluginEvents.InitFilterEvent>(OnInitFilter); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnLoad); }
public override void OnEnable() { base.OnEnable(); config = new PluginConfigurationManager(this); config.AddItem(setting); EventBus.BindEvent <InitFilterEvent>(OnInitFilter); }
public WonderfulMoments() : base("WonderfulMoments", "TuRou") { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(new Setting()); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnLoadComplete); obs.RecordingStateChanged += Obs_RecordingStateChanged; obs.RecordingResumed += Obs_RecordingResumed; obs.RecordingPaused += Obs_RecordingPaused; }
/// <summary> /// Plugin Init /// </summary> public override void OnEnable() { _configManager = new PluginConfigurationManager(this); _configManager.AddItem(new SettingIni()); _ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin; var gui = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); if (gui != null) { GuiRegisterHelper.RegisterFormatEditorWindow(gui); } if (_ortdp == null) { IO.CurrentIO.WriteColor("No found OsuRTDataProvider!", ConsoleColor.Red); return; } int size = TourneyMode ? _ortdp.TourneyListenerManagersCount : 1; for (int i = 0; i < size; i++) { var manager = _ortdp.ListenerManager; if (TourneyMode) { manager = _ortdp.TourneyListenerManagers[i]; } _osuPpControls[i] = new DisplayerController(manager); } _fixedInterval = TimeSpan.FromSeconds(1.0 / Setting.FPS); _fixedUpdateThread = Task.Run(() => { while (!_stopFixedUpdate) { lock (_allDisplayerMtx) { foreach (var d in _allDisplayers) { d.Value.FixedDisplay(_fixedInterval.TotalSeconds); } } Thread.Sleep(_fixedInterval); } }); RegisterDisplayer("wpf", id => new WpfDisplayer(id)); RegisterDisplayer("mmf", id => new MmfDisplayer(id)); RegisterDisplayer("mmf-split", id => new MmfDisplayer(id, true)); RegisterDisplayer("text", id => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()))); RegisterDisplayer("text-split", id => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()), true)); RegisterDisplayer("console", id => new ConsoleDisplayer()); IO.CurrentIO.WriteColor(PLUGIN_NAME + " By " + PLUGIN_AUTHOR, ConsoleColor.DarkCyan); }
public SyncMultiSourceWrapperPlugin() : base("SyncMultiSourceWrapperPlugin", "MikiraSora") { config = new PluginConfigurationManager(this); config.AddItem(Setting.Instance); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnLoadComplete); EventBus.BindEvent <PluginEvents.InitSourceEvent>(OnInitSource); EventBus.BindEvent <PluginEvents.InitFilterEvent>(OnInitFilter); }
public override void OnEnable() { base.EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OsuLiveStatusPanelPlugin_onLoadComplete); base.EventBus.BindEvent <PluginEvents.InitCommandEvent>(OsuLiveStatusPanelPlugin_onInitCommand); manager = new PluginConfigurationManager(this); manager.AddItem(this); Sync.Tools.IO.CurrentIO.WriteColor(this.Name + " by " + this.Author, System.ConsoleColor.DarkCyan); }
public SimpleDataUploaderPlugin() : base("SimpleDataUploaderPlugin", "DarkProjector") { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(setting); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(OnPluginLoaded); upload_thread = new Thread(OnUploadThread); upload_thread.IsBackground = true; upload_thread.Name = "SimpleDataUploaderPlugin_UploadThread"; upload_thread.Start(); }
public PublicOsuBotTransferPlugin() : base("PublicOsuBotTransferPlugin", "MikiraSora && KedamaOvO") { config_manager = new PluginConfigurationManager(this); config_manager.AddItem(client); EventBus.BindEvent <InitClientEvent>(evt => { evt.Clients.AddAllClient(client); }); EventBus.BindEvent <LoadCompleteEvent>(OnLoaded); EventBus.BindEvent <InitCommandEvent>(e => e.Commands.Dispatch.bind("osu_bot", OnCommand, "PublicOsuBotTransferPlugin")); }
/// <summary> /// Plugin Init /// </summary> public override void OnEnable() { m_config_manager = new PluginConfigurationManager(this); m_config_manager.AddItem(new SettingIni()); m_memory_reader = getHoster().EnumPluings().Where(p => p.Name == "OsuRTDataProvider").FirstOrDefault() as OsuRTDataProviderPlugin; if (m_memory_reader == null) { Sync.Tools.IO.CurrentIO.WriteColor("No found OsuRTDataProvider!", ConsoleColor.Red); return; } int size = TourneyMode ? m_memory_reader.TourneyListenerManagersCount : 1; for (int i = 0; i < size; i++) { var manager = m_memory_reader.ListenerManager; int?id = null; if (TourneyMode) { id = i; manager = m_memory_reader.TourneyListenerManagers[i]; } m_osu_pp_controls[i] = new PPControl(manager, id); } m_fixed_interval = TimeSpan.FromSeconds(1.0 / Setting.FPS); m_fixed_update_thread = Task.Run(() => { while (!m_stop_fixed_update) { lock (m_all_displayer_mtx) { foreach (var d in m_all_displayers) { d.Value.FixedDisplay(m_fixed_interval.TotalSeconds); } } Thread.Sleep(m_fixed_interval); } }); RegisterDisplayer("wpf", (id) => new WpfDisplayer(id)); RegisterDisplayer("mmf", (id) => new MmfDisplayer(id)); RegisterDisplayer("text", (id) => new TextDisplayer(string.Format(Setting.TextOutputPath, id == null ? "" : id.Value.ToString()))); Sync.Tools.IO.CurrentIO.WriteColor(PLUGIN_NAME + " By " + PLUGIN_AUTHOR, ConsoleColor.DarkCyan); }
public MySimpleConfiguration() : base("MySimpleConfiguration", "DarkProjector") { config_manager = new PluginConfigurationManager(this); //将IConfigurable实现类实例提交给配置管理器,并立即加载配置给实例 config_manager.AddItem(setting); EventBus.BindEvent <PluginEvents.InitCommandEvent>(e => { e.Commands.Dispatch.bind("show_config", args => { logger.LogInfomation($"MyOption is \"{setting.MyOption}\" , MyOption2 is \"{setting.MyOption2}\""); return(true); }, "Show MySimpleConfiguration configs"); }); }
public BanManagerPlugin() : base(PLUGIN_NAME, PLUGIN_AUTHOR) { IO.CurrentIO.WriteColor(Name + " By " + Author, ConsoleColor.DarkCyan); I18n.Instance.ApplyLanguage(new DefaultLanguage()); config_manager = new PluginConfigurationManager(this); config_manager.AddItem(this); base.EventBus.BindEvent <PluginEvents.InitFilterEvent>(manager => { banManager = new BanManager(SavePath, manager.Filters); manager.Filters.AddFilters(banManager.ClientFilter, banManager.ServerFliter); }); base.EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(host => banManager.MessageSender = host.Host.Messages); }
public override void OnEnable() { I18n.Instance.ApplyLanguage(new Languages()); EventBus.BindEvent <LoadCompleteEvent>(evt => MainMessager = evt.Host.Messages); handler = new MSNHandler(); handler.Load(); handler.StartHandler(); fltNp = new NpFilter(); EventBus.BindEvent <InitFilterEvent>((filter) => filter.Filters.AddFilter(fltNp)); config = new PluginConfigurationManager(this); config.AddItem(fltNp); IO.CurrentIO.WriteColor(Name + " By " + Author, ConsoleColor.DarkCyan); }
public BeatmapSuggestPlugin() : base("Beatmap Suggest Command", "Dark Projector") { I18n.Instance.ApplyLanguage(new DefaultLanguage()); danmaku_filter = new Danmaku.BeatmapSuggestFilter(); osu_filter = new Osu.BeatmapSuggestDownloadFilter(); base.EventBus.BindEvent <PluginEvents.InitFilterEvent>(manager => { manager.Filters.AddFilter(this.danmaku_filter); manager.Filters.AddFilter(this.osu_filter); }); base.EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(host => this.danmaku_filter.SetFilterManager(host.Host.Messages)); Sync.Tools.IO.CurrentIO.WriteColor(Name + " By " + Author, ConsoleColor.DarkCyan); config_manager = new PluginConfigurationManager(this); config_manager.AddItem(this); }
public OsuDataDistributeRestfulPlugin() : base(PLUGIN_NAME, PLUGIN_AUTHOR) { I18n.Instance.ApplyLanguage(new DefaultLanguage()); m_config_manager = new PluginConfigurationManager(this); m_config_manager.AddItem(new SettingIni()); ApiServer = new ApiServer(Setting.ApiPort); EventBus.BindEvent <PluginEvents.ProgramReadyEvent>(e => ApiServer.Start()); if (Setting.AllowLAN) { EventBus.BindEvent <PluginEvents.ProgramReadyEvent>(e => PrintLanAddress()); } EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(e => Initialize()); if (Setting.EnableFileHttpServer) { fileHttpServer = new FileServer(Setting.FilePort); fileHttpServer.Start(); } }
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); } }
public override void OnEnable() { var Config = new OverlayConfig(); var ConfigManager = new PluginConfigurationManager(this); ConfigManager.AddItem(Config); I18n.Instance.ApplyLanguage(new Language()); EventBus.BindEvent <PluginEvents.InitCommandEvent>(cmds => new OverlayCommands(cmds.Commands)); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(p => { new OverlayLoader(); }); EventBus.BindEvent <PluginEvents.ProgramReadyEvent>(_ => { var guiPlugin = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); if (guiPlugin != null) { RegisterGuiHelper.RegisterGui(guiPlugin); } var ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin; ortdp.ListenerManager.OnStatusChanged += (l, c) => { _currentStatusString = c.ToString(); foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { item.Visibility = item.VisibleStatus.Contains(_currentStatusString); } Setting.OverlayConfigs.WriteToMmf(false); }; ortdp.ListenerManager.OnBeatmapChanged += (b) => _breakTimeParser = new BreakTimeParser(b); //break time ortdp.ListenerManager.OnPlayingTimeChanged += (time) => { if (_breakTimeParser == null) { return; } if (!_currentStatusString.StartsWith("Playing")) { return; } bool updateMmf = false; foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { if (!item.VisibleStatus.Contains("Playing")) { continue; } if (item.BreakTime == false) { item.Visibility = true; updateMmf = true; } else if (item.BreakTime == true && item.Visibility == false) { if (_breakTimeParser.InBraekTime(time)) { item.Visibility = true; updateMmf = true; } } else if (item.BreakTime == true && item.Visibility == true) { if (!_breakTimeParser.InBraekTime(time)) { item.Visibility = false; updateMmf = true; } } } if (updateMmf) { Setting.OverlayConfigs.WriteToMmf(false); } }; }); foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { item.Visibility = false; item.VisibilityChanged += (list) => { item.Visibility = item.VisibleStatus.Contains(_currentStatusString); Setting.OverlayConfigs.WriteToMmf(false); }; } Setting.OverlayConfigs.WriteToMmf(true); }
public override void OnEnable() { var Config = new OverlayConfig(); var ConfigManager = new PluginConfigurationManager(this); ConfigManager.AddItem(Config); I18n.Instance.ApplyLanguage(new Language()); //테스트 코드 if (Setting.AcceptEula) { if (!string.IsNullOrWhiteSpace(Setting.OsuExecPath) && File.Exists(Setting.OsuExecPath) && Setting.OsuExecPath.ToLower().EndsWith("osu!.exe")) { Setting.GlobalConfig.WriteToMmf(); Setting.OverlayConfigs.WriteToMmf(); Process.Start(Setting.OsuExecPath); OverlayLoader.Injcet(); } else { Sync.Tools.IO.DefaultIO.WriteColor("Can't find osu!.exe", ConsoleColor.Yellow); Sync.Tools.IO.DefaultIO.WriteColor("config -> IngameOverlay -> OverlayConfig -> Osu! gmae path", ConsoleColor.Yellow); Sync.Tools.IO.DefaultIO.WriteColor("Set osu.exe path", ConsoleColor.Yellow); } } //테스트 코드 END EventBus.BindEvent <PluginEvents.InitCommandEvent>(cmds => new OverlayCommands(cmds.Commands)); EventBus.BindEvent <PluginEvents.LoadCompleteEvent>(p => { new OverlayLoader(); }); EventBus.BindEvent <PluginEvents.ProgramReadyEvent>(_ => { var guiPlugin = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "ConfigGUI"); if (guiPlugin != null) { RegisterGuiHelper.RegisterGui(guiPlugin); } var ortdp = getHoster().EnumPluings().FirstOrDefault(p => p.Name == "OsuRTDataProvider") as OsuRTDataProviderPlugin; ortdp.ListenerManager.OnStatusChanged += (l, c) => { _currentStatusString = c.ToString(); foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { item.Visibility = item.VisibleStatus.Contains(_currentStatusString); } Setting.OverlayConfigs.WriteToMmf(false); }; ortdp.ListenerManager.OnBeatmapChanged += (b) => _breakTimeParser = new BreakTimeParser(b); //break time ortdp.ListenerManager.OnPlayingTimeChanged += (time) => { if (_breakTimeParser == null) { return; } if (!_currentStatusString.StartsWith("Playing")) { return; } bool updateMmf = false; foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { if (!item.VisibleStatus.Contains("Playing")) { continue; } if (item.BreakTime == false) { item.Visibility = true; updateMmf = true; } else if (item.BreakTime == true && item.Visibility == false) { if (_breakTimeParser.InBraekTime(time)) { item.Visibility = true; updateMmf = true; } } else if (item.BreakTime == true && item.Visibility == true) { if (!_breakTimeParser.InBraekTime(time)) { item.Visibility = false; updateMmf = true; } } } if (updateMmf) { Setting.OverlayConfigs.WriteToMmf(false); } }; }); foreach (var item in Setting.OverlayConfigs.OverlayConfigItems) { item.Visibility = false; item.VisibilityChanged += (list) => { item.Visibility = item.VisibleStatus.Contains(_currentStatusString); Setting.OverlayConfigs.WriteToMmf(false); }; } Setting.OverlayConfigs.WriteToMmf(true); }