public bool exit(Arguments arg) { stop(arg); MainHost.ExitSync(); CurrentIO.Write(LANG_COMMANDS_EXIT_DONE); return(true); }
private static bool HandlerRoutine(int CtrlType) { CurrentIO.Write("Exiting..."); SyncHost.Instance?.SaveSync(); CurrentIO.Write("Saved."); SetConsoleCtrlHandler(cancelHandler, false); return(true); }
public bool start(Arguments arg) { if (MainSource.Source.Status == SourceStatus.CONNECTED_WORKING) { CurrentIO.Write(LANG_COMMANDS_START_ALREADY_RUN); return(true); } MainClient?.Client?.StartWork(); MainSource?.Source?.Connect(); return(true); }
public bool clientmsg(Arguments arg) { if (arg.Count == 0 || (MainSendable != null && MainSendable.SendStatus == false)) { CurrentIO.Write(LANG_COMMANDS_CHAT_IRC_NOTCONNECT); return(true); } MainMessager.RaiseMessage <ISourceClient>(new IRCMessage("Console", string.Join(" ", arg))); return(true); }
private void RtppOnStatusChanged(OsuStatus last, OsuStatus cur) { _status = cur; if ((cur == OsuStatus.Rank && last == OsuStatus.Playing)) { var cal = _tmpLastPpCalculator ?? _ppCalculator; var beatmap = cal.Beatmap.OrtdpBeatmap; var mods = cal.Mods; string songs = $"{beatmap.Artist} - {beatmap.Title}[{beatmap.Difficulty}]"; string acc = $"{cal.Accuracy:F2}%"; string modsStr = $"{(mods != ModsInfo.Mods.None ? "+" + mods.ShortName : "")}"; string pp = $"{cal.GetPerformance().RealTimePP:F2}pp"; string msg = $"[RTPPD]{songs} {modsStr} | {acc} => {pp}"; CurrentIO.Write($"[RTPPD]{songs}{acc}{modsStr} -> {pp}"); if (SyncHost.Instance.ClientWrapper.Client.CurrentStatus == SourceStatus.CONNECTED_WORKING && Setting.RankingSendPerformanceToChat) { if (beatmap.BeatmapID != 0) { string dlUrl = beatmap.DownloadLink; SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, $"[RTPPD][{dlUrl} {songs}] {modsStr} | {acc} => {pp}")); } else { SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, msg)); } } } if (cur != OsuStatus.Rank) { _tmpLastPpCalculator = null; } if (OsuStatusHelper.IsListening(cur) || cur == OsuStatus.Editing)//Clear Output and reset { _combo = 0; _maxCombo = 0; _n100 = 0; _n50 = 0; _nmiss = 0; foreach (var p in _displayers) { p.Value.Clear(); } } _ppCalculator.ClearCache(); }
public bool chatuser(Arguments arg) { if (arg.Count < 1 || (MainSendable != null && MainSendable.SendStatus == false)) { CurrentIO.Write(LANG_COMMANDS_CHAT_IRC_NOTCONNECT); } string message = ""; for (int i = 1; i < arg.Count; i++) { message += arg[i] + " "; } MainMessager.RaiseMessage <ISourceClient>(new IRCMessage(arg[0].Trim(), message)); return(true); }
/// <summary> /// Invoke to load plugins /// </summary> internal void Load() { CurrentIO.Write(LANG_Loading); //Initial plugins manager plugins = new PluginManager(); CurrentIO.WriteColor(String.Format(LANG_Plugins, plugins.LoadPlugins()), ConsoleColor.Green); //Initial danmaku source sources = new SourceManager(); CurrentIO.WriteColor(String.Format(LANG_Sources, plugins.LoadSources()), ConsoleColor.Green); //select a danmaku source by config try { sourceWrapper = new SourceWorkWrapper(sources); PluginEvents.Instance.RaiseEvent(new PluginEvents.InitSourceWarpperEvent(sourceWrapper)); } catch { CurrentIO.Write(""); CurrentIO.WriteColor(LANG_Error, ConsoleColor.Red); CurrentIO.WriteColor("Press enter to continue", ConsoleColor.Red); CurrentIO.ReadCommand(); } //Get clients singleton clients = ClientManager.Instance; CurrentIO.WriteColor(String.Format(LANG_Client, plugins.LoadClients()), ConsoleColor.Green); clientWrapper = new ClientWorkWrapper(clients); PluginEvents.Instance.RaiseEvent(new PluginEvents.InitClientWarpperEvent(clientWrapper)); commands = new CommandManager(); CurrentIO.WriteColor(String.Format(LANG_Commands, plugins.LoadCommnads()), ConsoleColor.Green); filters = new FilterManager(); CurrentIO.WriteColor(String.Format(LANG_Filters, plugins.LoadFilters()), ConsoleColor.Green); messages = new MessageDispatcher(filters); plugins.ReadyProgram(); CurrentIO.WriteColor(LANG_Ready, ConsoleColor.Cyan); }
public bool sourcemsg(Arguments arg) { if (MainSource.Sendable) { if (MainSource.Sendable) { MainSource.SendableSource.Send(new IRCMessage(string.Empty, string.Join("", arg))); return(true); } else { CurrentIO.Write(LANG_COMMANDS_DANMAKU_REQUIRE_LOGIN); } } else { CurrentIO.Write(LANG_COMMANDS_DANMAKU_NOT_SUPPORT); } return(true); }
private void RtppOnStatusChanged(OsuStatus last, OsuStatus cur) { if (cur == OsuStatus.Playing) { _playStatusLocker.WaitOne(); } if (OsuStatusHelper.IsListening(cur) || cur == OsuStatus.NoFoundProcess) { try { _playStatusLocker.ReleaseMutex(); } catch (ApplicationException) {} } var cal = GetCalculator(_mode); if ((cur == OsuStatus.Rank && last == OsuStatus.Playing)) { var beatmap = cal.Beatmap.OrtdpBeatmap; var mods = cal.Mods; string songs = $"{beatmap.Artist} - {beatmap.Title}[{beatmap.Difficulty}]"; if (Setting.UseUnicodePerformanceInformation) { if (!string.IsNullOrEmpty(beatmap.ArtistUnicode) && !string.IsNullOrEmpty(beatmap.TitleUnicode)) { songs = $"{beatmap.ArtistUnicode} - {beatmap.TitleUnicode}[{beatmap.Difficulty}]"; } } string acc = $"{cal.Accuracy:F2}%"; ModsInfo m = mods.ToModsInfo(); string modsStr = $"{(m != ModsInfo.Mods.None ? "+" + m.ShortName : "")}"; string pp = $"{cal.GetPerformance().RealTimePP:F2}pp"; string msg = $"[RTPPD]{songs} {modsStr} | {acc} => {pp} ({_mode})"; CurrentIO.Write(msg); if (SyncHost.Instance.ClientWrapper.Client.CurrentStatus == SourceStatus.CONNECTED_WORKING && Setting.RankingSendPerformanceToChat) { if (beatmap.BeatmapID != 0) { string dlUrl = beatmap.DownloadLink; SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, $"[RTPPD][{dlUrl} {songs}] {modsStr} | {acc} => {pp} ({_mode})")); } else { SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, msg)); } } } cal.ClearCache(); if (OsuStatusHelper.IsListening(cur) || cur == OsuStatus.Editing)//Clear output and reset { _combo = 0; _maxCombo = 0; _n100 = 0; _n50 = 0; _nmiss = 0; foreach (var p in Displayers) { p.Value?.Clear(); } } _status = cur; }