public static void VA_Init1(ref Dictionary<string, object> state, ref Dictionary<string, Int16?> shortIntValues, ref Dictionary<string, string> textValues, ref Dictionary<string, int?> intValues, ref Dictionary<string, decimal?> decimalValues, ref Dictionary<string, Boolean?> booleanValues, ref Dictionary<string, object> extendedValues) { CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (!LoadConfig()) return; try { protocol = new ConsoleMumbleProtocol(); connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); t = new Thread(a => UpdateLoop(connection)) { IsBackground = true }; t.Start(); //When localuser is set it means we're really connected while (!protocol.ReceivedServerSync) { } if (chan != "") { foreach (var c in protocol.Channels.ToArray().Where(u => u.Name == chan.Trim())) { protocol.LocalUser.Move(c); } } } catch (Exception e) { LogMessage("Error: " + e.Message); } }
private static void UpdateLoop(MumbleConnection connection) { while (connection.State != ConnectionStates.Disconnected) { connection.Process(); } }
private void btnConnect_Click(object sender, EventArgs e) { string name = textBoxUserName.Text; string pass = textBoxUserPassword.Text; int port; string addr; if (textBoxServer.Text.Contains(':')) { var server = textBoxServer.Text.Split(':'); addr = server[0]; port = Int32.Parse(server[1]); } else { addr = textBoxServer.Text; port = 64738; } if (connection != null) { connection.Close(); connection = null; protocol.Close(); tvUsers.Nodes.Clear(); } connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); while (connection.Protocol.LocalUser == null) { connection.Process(); } }
private static void Main(string[] args) { Console.WriteLine("Enter server address:"); var addr = Console.ReadLine(); Console.WriteLine("Enter server port:"); var port = int.Parse(Console.ReadLine()); Console.WriteLine("Enter name:"); var name = Console.ReadLine(); Console.WriteLine("Enter password:"******"Connected as " + connection.Protocol.LocalUser.Id); DrawChannel("", connection.Protocol.Channels.ToArray(), connection.Protocol.Users.ToArray(), connection.Protocol.RootChannel); while (true) { string msg = Console.ReadLine(); connection.SendTextMessage(msg); } }
private void btnDisconnect_Click(object sender, EventArgs e) { if (connection != null) { connection.Close(); connection = null; protocol.Close(); tvUsers.Nodes.Clear(); } }
static void Main(string[] args) { //MumbleConnection connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses("mumble.placeholder-software.co.uk").First(), 64738)); MumbleConnection connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses("andimiller.net").First(), 25565)); //MumbleConnection connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses("localhost").First(a => a.AddressFamily == AddressFamily.InterNetwork), 64738)); connection.Connect<MumbleProtocol>("MumbleSharpClient", "", ""); Thread t = new Thread(a => UpdateLoop(connection)) { IsBackground = true }; t.Start(); while (connection.Protocol.LocalUser == null) { } while (true) { string msg = Console.ReadLine(); connection.SendTextMessage(msg); } }
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 UpdateLoop(MumbleConnection connection, out Exception exception) { exception = null; try { while (connection.State != ConnectionStates.Disconnected) { if (connection.Process()) { Thread.Yield(); } else { Thread.Sleep(1); } } } catch (Exception ex) { exception = ex; } }
private void button2_Click(object sender, EventArgs e) { string name = textBox1.Text; string pass = ""; int port = 64738; string addr = textBox2.Text; if (connection != null) { connection.Close(); connection = null; protocol.Close(); tvUsers.Nodes.Clear(); } connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); while (connection.Protocol.LocalUser == null) { connection.Process(); } }
public Form1() { InitializeComponent(); connection = new MumbleConnection("mumble.placeholder-software.co.uk", 64738); protocol = connection.Connect <BasicMumbleProtocol>("testuser", "", "mumble.placeholder-software.co.uk"); protocol.MessageRecieved += Protocol_MessageRecieved; while (connection.Protocol.LocalUser == null) { connection.Process(); } Dictionary <uint, ChannelTree> channels = new Dictionary <uint, ChannelTree>(); foreach (var channel in protocol.Channels) { channels.Add(channel.Id, new ChannelTree(channel)); } foreach (var channelTree in channels.Values) { if (channelTree.Channel.Id != 0) { channelTree.Parent = channels[channelTree.Channel.Parent]; channelTree.Parent.Children.Add(channelTree); } } foreach (var user in protocol.Users) { channels[user.Channel.Id].Users.Add(user); } ChannelTree RootChannel = channels[0]; tvUsers.Nodes.Add(MakeNode(RootChannel)); tvUsers.ExpandAll(); //MessageBox.Show("Connected as " + connection.Protocol.LocalUser.Id); }
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(); }
/// <summary> /// Associates this protocol with an opening mumble connection /// </summary> /// <param name="connection"></param> public virtual void Initialise(MumbleConnection connection) { Connection = connection; _encodingThread = new Thread(EncodingThreadEntry) { IsBackground = true }; }
static void Main(string[] args) { var serviceCollection = new ServiceCollection(); serviceCollection.AddLogging( builder => builder .AddConsole(options => options.DisableColors = false) .SetMinimumLevel(LogLevel.Debug)); var serviceProvider = serviceCollection.BuildServiceProvider(); var loggerFactory = serviceProvider.GetService <ILoggerFactory>(); string addr, name, pass; int port; FileInfo serverConfigFile = new FileInfo(Path.Combine(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:"******"ChannelMsg: {eventArgs.Message.Text}"); tms.PersonalMessageReceived += (sender, eventArgs) => Console.WriteLine($"PersonalMsg: {eventArgs.Message.Text}"); connection.Connect(name, pass, new string[0], addr, ValidateCertificate, SelectCertificate); while (!serverStateService.ReceivedServerSync) { Thread.Sleep(5000); } recorder.StartCapture(); Console.ReadLine(); }
private static void UpdateLoop(MumbleConnection connection) { while (true) connection.Process(); }
public void Initialise(MumbleConnection connection) { this.connection = connection; }
/// <summary> /// Associates this protocol with an opening mumble connection /// </summary> /// <param name="connection"></param> public virtual void Initialise(MumbleConnection connection) { Connection = connection; }
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(); }