示例#1
0
        public async Task RunAsync()
        {
            ShowHelp();
            _ = StartPingAll();
            while (true)
            {
                var line = Console.ReadLine();
                if (line == null)
                {
                    await Quit();

                    break;
                }
                if (line.Length == 0)
                {
                    continue;
                }
                if (line.StartsWith(":"))
                {
                    if (await ParseCommand(line))
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                await _dlc.Broadcast(BroadcastChannel, line);
            }
        }
示例#2
0
        public static async ValueTask Broadcast(this DataLinkCollection dlc, string group, string content)
        {
            var length = Encoding.UTF8.GetByteCount(content);

            using (var owner = ExactSizeMemoryPool.Shared.Rent(length))
            {
                Encoding.UTF8.GetBytes(content, owner.Memory.Span);
                await dlc.Broadcast(group, owner.Memory);
            }
        }