public override bool OnTextCommand(IClient client, string cmd, string args) { switch (cmd) { case "scribble": var scribble = RoomScribble.GetScribble(client); if (Uri.TryCreate(args, UriKind.Absolute, out Uri uri)) { if (uri.IsFile) { Server.SendAnnounce((s) => s.Vroom == client.Vroom, "File uri is not suppored by the scribble command."); } else if (uri.IsWellFormedOriginalString()) { scribble.Download(uri, (s) => { SendRoomScribble((c) => c.Vroom == client.Vroom, client.Name, scribble); }, uri); } } return(false); } return(true); }
private void OnScribbleChunk(IClient client, ClientScribbleChunk chunk) { var scribble = RoomScribble.GetScribble(client); scribble.Write(chunk.Data); if (scribble.IsComplete) { SendRoomScribble(client, scribble); } }
private void OnScribbleFirst(IClient client, ClientScribbleFirst first) { var scribble = RoomScribble.GetScribble(client); scribble.Reset(); scribble.Size = first.Size; scribble.Chunks = (ushort)(first.Chunks + 1);//scribble object counts first chunk scribble.Write(first.Data); if (scribble.IsComplete) { SendRoomScribble(client, scribble); } }
private void OnCommand(IClient client, string text) { if (text.Length > 9 && text.Substring(0, 9) == "scribble ") { Uri uri = null; var scribble = RoomScribble.GetScribble(client); if (Uri.TryCreate(text.Substring(9), UriKind.Absolute, out uri)) { if (uri.IsFile) { server.SendAnnounce("Not valid"); } else { scribble.Download(uri, (s) => { SendRoomScribble((c) => c.Vroom == client.Vroom, client.Name, scribble); }, null); } } } }
private void OnCommand(IClient client, string text) { if (text.Length > 9 && text.Substring(0, 9) == "scribble ") { var scribble = RoomScribble.GetScribble(client); if (Uri.TryCreate(text.Substring(9), UriKind.Absolute, out Uri uri)) { if (uri.IsFile) { Server.SendAnnounce((s) => s.Vroom == client.Vroom, "File uri is not suppored by the scribble command."); } else if (uri.IsWellFormedOriginalString()) { scribble.Download(uri, (s) => { SendRoomScribble((c) => c.Vroom == client.Vroom, client.Name, scribble); }, uri); } } } }