private void Init(string config_path) { var config_instance = Config.LoadPPShowConfig(config_path); ListenOfs = new List <OutputWrapper>(); PlayOfs = new List <OutputWrapper>(); foreach (var o in config_instance.output_list) { PlayOfs.Add(new OutputWrapper { formatter = new OutputFormatter(o.output_format), outputter = OutputBase.Create(o.output_file) }); } foreach (var o in config_instance.listen_list) { ListenOfs.Add(new OutputWrapper { formatter = new OutputFormatter(o.output_format), outputter = OutputBase.Create(o.output_file) }); } List <float> acc_list = new List <float>(); foreach (var o in ListenOfs) { acc_list = acc_list.Concat( from n in o.formatter.GetAccuracyArray() where !acc_list.Contains(n) select n ).ToList(); } foreach (var o in PlayOfs) { acc_list = acc_list.Concat( from n in o.formatter.GetAccuracyArray() where !acc_list.Contains(n) select n ).ToList(); } if (acc_list.Count == 0) { Log.Warn("No pp query in PPShowConfig.json,defualt add 100%acc to get info."); acc_list.Add(100); } InfoOutputter = new InfoOutputter(acc_list); InfoOutputter.OnOutputEvent += OnOutput; }
private void Init() { Setting.DebugMode = bool.Parse(DebugMode); Setting.BothLyrics = bool.Parse(BothLyrics); Setting.EnableOutputSearchResult = bool.Parse(EnableOutputSearchResult); Setting.PreferTranslateLyrics = bool.Parse(PreferTranslateLyrics); Setting.LyricsSource = LyricsSource; Setting.LyricsSentenceOutputPath = LyricsSentenceOutputPath; Setting.SearchAndDownloadTimeout = int.Parse(SearchAndDownloadTimeout); Setting.GobalTimeOffset = int.Parse(GobalTimeOffset); Setting.ForceKeepTime = uint.Parse(ForceKeepTime); Setting.StrictMatch = bool.Parse(StrictMatch); Setting.UseStaticLyricsCombine = bool.Parse(UseStaticLyricsCombine); if (Setting.PreferTranslateLyrics) { Utils.Output("优先选择翻译歌词", ConsoleColor.Green); } Utils.Debug("调试模式已开启"); //初始化歌词源管理器,从所有dll里面获取可用的歌词源 ScanAvaliableLyricsSourceProvider(); //加载指定的歌词源 lyrics_provider = SourceProviderManager.GetOrCreateSourceProvier(LyricsSource); if (lyrics_provider == null) { Utils.Output("未知歌词源:" + LyricsSource, ConsoleColor.Red); } Utils.Output($"已选择歌词源:({LyricsSource}){lyrics_provider.GetType().Name}", ConsoleColor.Green); output = OutputBase.Create(LyricsSentenceOutputPath); if (output is MemoryMappedFileOutput mmf) { Utils.Output($"歌词文本将输出到内存映射文件:{mmf.FilePath.Replace(MemoryMappedFileOutput.MMF_FORMAT,"")}", ConsoleColor.Green); } }