add country code support and bump ver
This commit is contained in:
parent
0780098192
commit
b02e967761
3 changed files with 21 additions and 2 deletions
|
@ -90,6 +90,11 @@ public class CollabVMClient {
|
|||
/// Fired when the client encounters a non-fatal error
|
||||
/// </summary>
|
||||
public event EventHandler<string> Error;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the server sends a user's country code
|
||||
/// </summary>
|
||||
public event EventHandler<User> CountryCodeUpdated;
|
||||
/// <summary>
|
||||
/// Client for the CollabVM 1.x Server
|
||||
/// </summary>
|
||||
|
@ -165,6 +170,7 @@ public class CollabVMClient {
|
|||
ConnectionClosed += delegate { };
|
||||
VMUsesAccountAuth += delegate { };
|
||||
Error += delegate { };
|
||||
CountryCodeUpdated += delegate { };
|
||||
}
|
||||
/// <summary>
|
||||
/// Connect to the CollabVM Server
|
||||
|
@ -485,7 +491,8 @@ public class CollabVMClient {
|
|||
|
||||
break;
|
||||
}
|
||||
case "admin": {
|
||||
case "admin":
|
||||
{
|
||||
switch (msgArr[1]) {
|
||||
case "0": {
|
||||
switch (msgArr[2]) {
|
||||
|
@ -517,6 +524,17 @@ public class CollabVMClient {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "flag":
|
||||
{
|
||||
for (int i = 1; i < msgArr.Length; i += 2)
|
||||
{
|
||||
var user = this._users.Find(u => u.Username == msgArr[i]);
|
||||
if (user == null) continue;
|
||||
user.CountryCode = msgArr[i + 1];
|
||||
this.CountryCodeUpdated.Invoke(this, user);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<Version>2.6.0</Version>
|
||||
<Version>2.7.0</Version>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
|
|
|
@ -2,6 +2,7 @@ namespace CollabVMSharp;
|
|||
|
||||
public class User {
|
||||
public string Username { get; set; }
|
||||
public string? CountryCode { get; set; }
|
||||
public Rank Rank { get; set; }
|
||||
public TurnStatus Turn { get; set; }
|
||||
}
|
Loading…
Reference in a new issue