public void TryRegisterSourceFromOsuRTDataProvider(SyncHost host) { foreach (var plugin in host.EnumPluings()) { if (plugin.Name == "OsuRTDataProvider") { Log.Output(OSURTDP_FOUND); OsuRTDataProvider.OsuRTDataProviderPlugin reader = plugin as OsuRTDataProvider.OsuRTDataProviderPlugin; if (reader.ModsChangedAtListening) { SourceWrapper = new RealtimeDataProviderModsWrapper(reader, this); } else { SourceWrapper = new OsuRTDataProviderWrapper(reader, this); } if (SourceWrapper.Attach()) { source = UsingSource.OsuRTDataProvider; } return; } } Log.Error(OSURTDP_NOTFOUND); source = UsingSource.None; }
private void SetupPlugin(SyncHost host) { //init PPShow PPShowPluginInstance = new InfoOutputterWrapper(PPShowJsonConfigFilePath); source = UsingSource.None; try { switch (BeatmapSourcePlugin.ToString().ToLower().Trim()) { case "ortdp": TryRegisterSourceFromOsuRTDataProvider(host); break; case "dpmp": TryRegisterSourceFromDifficultParamModifyPlugin(host); break; default: break; } Log.Output($"Source:{BeatmapSourcePlugin} Loaded:{SourceWrapper.GetType().Name}"); } catch (Exception e) { Log.Error($"{LOAD_PLUGIN_DEPENDENCY_FAILED}:{e.Message}"); source = UsingSource.None; } if (source == UsingSource.None) { Log.Error(INIT_PLUGIN_FAILED_CAUSE_NO_DEPENDENCY); } else { Log.Output(INIT_SUCCESS); } CleanOutput(); }
public void TryRegisterSourceFromDifficultParamModifyPlugin(SyncHost host) { foreach (var plugin in host.EnumPluings()) { if (plugin.Name == "DifficultParamModifyPlugin") { Log.Output($"发现dpmp插件"); DifficultParamModifyPlugin.DifficultParamModifyPlugin reader = plugin as DifficultParamModifyPlugin.DifficultParamModifyPlugin; SourceWrapper = new DifficultParamModifyPluginSourceWrapper(reader, this); if (SourceWrapper.Attach()) { source = UsingSource.DifficultParamModifyPlugin; } return; } } Log.Error($"没发现dpmp插件"); source = UsingSource.None; }