add Rename()

This commit is contained in:
Elijahr2411 2023-08-29 23:44:02 -04:00
parent 7bb906a835
commit d2d5348958

View file

@ -821,6 +821,16 @@ public class CollabVMClient {
this.commands.Add(cmd, callback); this.commands.Add(cmd, callback);
} }
/// <summary>
/// Change client username
/// </summary>
/// <param name="newname">New username. Null for the server to assign a guest name</param>
public void Rename(string? newname = null)
{
if (newname == null) SendMsg(Guacutils.Encode("rename"));
else SendMsg(Guacutils.Encode("rename", newname));
}
private void ProcessCommand(string username, string cmd) { private void ProcessCommand(string username, string cmd) {
// I stole this from stackoverflow // I stole this from stackoverflow
var re = new Regex("(?<=\")[^\"]*(?=\")|[^\" ]+"); var re = new Regex("(?<=\")[^\"]*(?=\")|[^\" ]+");