private static void UponMessage(NetData data) { byte ID = data.ReadByte(); switch (ID) { case NetData.START: if (IsRendering) { break; } Console.WriteLine("Server has told client to start. Running..."); IsRendering = true; Renderer = new Renderer(output, files); Renderer.Width = resX; Renderer.Height = resY; Renderer.Bitrate = bitRate; Renderer.Codec = codec; Renderer.FrameRate = framerate; Renderer.FramesPerImage = framesPerImage; Renderer.InterpolationMode = interpolation; Renderer.Done = () => { IsRendering = false; Console.WriteLine("Finished render!"); Client.Write(new NetData().Write(NetData.DONE).Write("All done!")); }; Renderer.StartRender(); break; default: Console.WriteLine($"[ERROR] Unexpected data ID sent to client: {ID}."); break; } }