Exemplo n.º 1
0
 public void HandleOutputEvent(string value) => OnOutputEvent?.Invoke(value);
Exemplo n.º 2
0
        public bool TrigOutput(OutputType output_type, string osu_file_path, ModsInfo mods, Dictionary <string, object> extra)
        {
            Dictionary <string, string> OutputDataMap = new Dictionary <string, string>();

            if (extra != null)
            {
                foreach (var data in extra)
                {
                    OutputDataMap[data.Key] = data.Value.ToString();
                }
            }

            if (!string.IsNullOrWhiteSpace(mods.ShortName))
            {
                mods = FilteVailedMod(mods);
            }

            OutputDataMap["mods_str"] = mods.ShortName;

            extra["AccuracyList"] = AccuracyList;
            extra["Mods"]         = mods;

            var stream          = File.ReadAllBytes(osu_file_path);
            var audio_file_name = OpenReadBeatmapParamValue(ref stream, "AudioFilename");
            var dir             = Directory.GetParent(osu_file_path).FullName;
            var audio_file_path = Path.Combine(dir, audio_file_name ?? "");

            var audio_duration = AudioDurationHelper.GetAudioDuration(audio_file_path);

            var mode = int.Parse(OpenReadBeatmapParamValue(ref stream, "Mode") ?? "0");

            if (extra.TryGetValue("mode", out var ortdp_mode))
            {
                int value = (int)ortdp_mode;
                if (value > 0 && mode == 0 /*原铺面是std而当前模式并非std*/)
                {
                    mode = value;
                }
            }

            if (!OutputDataMap.ContainsKey("mode"))
            {
                OutputDataMap["mode"] = mode.ToString();
            }

            if (ModeHandler[mode] != null || TryCreateModeHandler(mode))
            {
                var handler = ModeHandler[mode];

                handler.HandleBaseInfo(OutputDataMap, ref stream, extra);

                handler.HandleExtraData(extra, OutputDataMap);

                handler.AddExtraBeatmapInfo(OutputDataMap);
            }

            if (audio_duration != null)
            {
                OutputDataMap["audio_duration"] = audio_duration.ToString();

                //get more useful params
                OutputDataMap["audio_duration_min_part"] = (audio_duration / 1000 / 60).ToString();
                OutputDataMap["audio_duration_sec_part"] = ((audio_duration / 1000) % 60).ToString();
            }

            OnOutputEvent?.Invoke(output_type, OutputDataMap);

            return(true);
        }
Exemplo n.º 3
0
 protected override void LogProgress(string message)
 {
     OnOutputEvent?.Invoke(message);
 }