Exemplo n.º 1
0
        private static async Task RequestOverview(string aBeatmapSetPath)
        {
            try
            {
                if (State.LoadedBeatmapSetPath != aBeatmapSetPath)
                {
                    return;
                }

                string html = OverviewRenderer.Render(State.LoadedBeatmapSet);
                await SendMessage("UpdateOverview", html);
            }
            catch (Exception exception)
            {
                string html = ExceptionRenderer.Render(exception);
                await SendMessage("UpdateException", "Overview:" + html);
            }
        }
Exemplo n.º 2
0
        private static async Task RequestChecks(string aBeatmapSetPath)
        {
            try
            {
                List <Issue> issues = Checker.GetBeatmapSetIssues(State.LoadedBeatmapSet);
                if (State.LoadedBeatmapSetPath != aBeatmapSetPath)
                {
                    return;
                }

                string html = ChecksRenderer.Render(issues, State.LoadedBeatmapSet);
                await SendMessage("UpdateChecks", html);
            }
            catch (Exception exception)
            {
                string html = ExceptionRenderer.Render(exception);
                await SendMessage("UpdateException", "Checks:" + html);
            }
        }
Exemplo n.º 3
0
        private static async Task RequestSnapshots(string aBeatmapSetPath)
        {
            try
            {
                // Beatmapset null (-1) would become ambigious with any other unsubmitted map.
                if (State.LoadedBeatmapSet.beatmaps.FirstOrDefault()?.metadataSettings.beatmapSetId != null)
                {
                    Snapshotter.SnapshotBeatmapSet(State.LoadedBeatmapSet);
                }

                if (State.LoadedBeatmapSetPath != aBeatmapSetPath)
                {
                    return;
                }

                string html = SnapshotsRenderer.Render(State.LoadedBeatmapSet);
                await SendMessage("UpdateSnapshots", html);
            }
            catch (Exception exception)
            {
                string html = ExceptionRenderer.Render(exception);
                await SendMessage("UpdateException", "Snapshots:" + html);
            }
        }
Exemplo n.º 4
0
        public static async Task ClientMessage(string aKey, string aValue)
        {
            switch (aKey)
            {
            case "RequestDocumentation":
                try
                {
                    string html = DocumentationRenderer.Render();
                    await SendMessage("UpdateDocumentation", html);
                }
                catch (Exception exception)
                {
                    string html = ExceptionRenderer.Render(exception);
                    await SendMessage("UpdateException", "Documentation:" + html);
                }
                break;

            case "RequestOverlay":
                try
                {
                    string html = OverlayRenderer.Render(aValue);
                    await SendMessage("UpdateOverlay", html);
                }
                catch (Exception exception)
                {
                    string html = ExceptionRenderer.Render(exception);
                    await SendMessage("UpdateException", "Overlay:" + html);
                }
                break;

            case "RequestBeatmapset":
                try
                {
                    LoadBeatmapSet(aValue);

                    Func <string, Task>[] actions = new Func <string, Task>[]
                    {
                        RequestSnapshots,
                        RequestChecks,
                        RequestOverview
                    };

                    if (State.LoadedBeatmapSetPath != aValue)
                    {
                        return;
                    }

                    Parallel.ForEach(actions, anAction =>
                    {
                        anAction(aValue);
                    });
                }
                catch (Exception exception)
                {
                    string html = ExceptionRenderer.Render(exception);
                    await SendMessage("UpdateException", "Checks:" + html);
                    await SendMessage("UpdateException", "Snapshots:" + html);
                    await SendMessage("UpdateException", "Overview:" + html);
                }

                break;

            default:
                break;
            }
        }