private static void Main(string[] args) { string addr, name, pass; int port; FileInfo serverConfigFile = new FileInfo(Environment.CurrentDirectory + "\\server.txt"); using (StreamReader reader = new StreamReader(serverConfigFile.OpenRead())) { addr = reader.ReadLine(); port = int.Parse(reader.ReadLine()); name = reader.ReadLine(); pass = reader.ReadLine(); } ConsoleMumbleProtocol protocol = new ConsoleMumbleProtocol(); MumbleConnection connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); Thread t = new Thread(a => UpdateLoop(connection)) { IsBackground = true }; t.Start(); var r = new MicrophoneRecorder(protocol); r.Record(); //When localuser is set it means we're really connected while (!protocol.ReceivedServerSync) { } Console.WriteLine("Connected as " + protocol.LocalUser.Id); DrawChannel("", protocol.Channels.ToArray(), protocol.Users.ToArray(), protocol.RootChannel); Console.ReadLine(); }
private static void Main(string[] args) { string addr, name, pass; int port; FileInfo serverConfigFile = new FileInfo(Environment.CurrentDirectory + "\\server.txt"); if (serverConfigFile.Exists) { using (StreamReader reader = new StreamReader(serverConfigFile.OpenRead())) { addr = reader.ReadLine(); port = int.Parse(reader.ReadLine()); name = reader.ReadLine(); pass = reader.ReadLine(); } } else { Console.WriteLine("Enter server address:"); addr = Console.ReadLine(); Console.WriteLine("Enter server port (leave blank for default (64738)):"); string line = Console.ReadLine(); if (line == "") { port = 64738; } else { port = int.Parse(line); } Console.WriteLine("Enter name:"); name = Console.ReadLine(); Console.WriteLine("Enter password:"******"{nameof(UpdateLoop)} was terminated unexpectedly because of a {_updateLoopThreadException.GetType().ToString()}", _updateLoopThreadException); } }; Thread updateLoopThread = new Thread(updateLoopThreadStart) { IsBackground = true }; updateLoopThread.Start(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { _ = new MicrophoneRecorder(protocol); } //When localuser is set it means we're really connected while (!protocol.ReceivedServerSync) { } Console.WriteLine("Connected as " + protocol.LocalUser.Id); DrawChannel("", protocol.Channels.ToArray(), protocol.Users.ToArray(), protocol.RootChannel); Console.ReadLine(); }
private static void Main(string[] args) { string addr, name, pass; int port; FileInfo serverConfigFile = new FileInfo(Environment.CurrentDirectory + "\\server.txt"); if (serverConfigFile.Exists) { using (StreamReader reader = new StreamReader(serverConfigFile.OpenRead())) { addr = reader.ReadLine(); port = int.Parse(reader.ReadLine()); name = reader.ReadLine(); pass = reader.ReadLine(); } } else { Console.WriteLine("Enter server address:"); addr = Console.ReadLine(); Console.WriteLine("Enter server port (leave blank for default (64738)):"); string line = Console.ReadLine(); if (line == "") { port = 64738; } else { port = int.Parse(line); } Console.WriteLine("Enter name:"); name = Console.ReadLine(); Console.WriteLine("Enter password:"******"Connected as " + protocol.LocalUser.Id); DrawChannel("", protocol.Channels.ToArray(), protocol.Users.ToArray(), protocol.RootChannel); Console.ReadLine(); }