public OperatorDocumentationGenerator(
     OperatorResolver operatorResolver,
     DocumentationRenderer renderer)
 {
     this.operatorResolver = operatorResolver;
     this.renderer         = renderer;
 }
Ejemplo n.º 2
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;
            }
        }