1 Commits

Author SHA1 Message Date
Dima yawaflua Andreev
46f184d775 Merge pull request #1 from yawaflua/yawaflua-patch-1
Change .NET version from 8 to 7
2024-01-19 20:02:04 +03:00

View File

@@ -1,6 +1,4 @@
using Microsoft.VisualBasic; using System;
using SPWorldsWrapper.Types.UserTypes;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -8,59 +6,45 @@ using System.Threading.Tasks;
namespace SPWorldsWrapper.Types namespace SPWorldsWrapper.Types
{ {
public class CardsOwned
{
public string name { get; set; }
public int color { get; set; }
public string number { get; set; }
public string id { get; set; }
}
public class City
{
public Mayor mayor { get; set; }
public string name { get; set; }
public int x { get; set; }
public int z { get; set; }
}
public class Mayor
{
public string id { get; set; }
}
public class SPUser public class SPUser
{ {
public string id { get; set; } public string id { get; set; }
public bool isBanned { get; set; } public bool isBanned { get; set; }
public User user { get; set; } public User user { get; set; }
public string[] roles { get; set; } public List<string> roles { get; set; }
public City? city { get; set; } public City? city { get; set; }
public string status { get; set; } public string status { get; set; }
public DateTime createdAt { get; set; } public DateTime createdAt { get; set; }
public List<CardsOwned> cardsOwned { get; set; } public List<CardsOwned> cardsOwned { get; set; }
public bool isFollowed { get; set; } public bool isFollowed { get; set; }
public bool isFollowingYou { get; set; } public bool isFollowingYou { get; set; }
}
public Dictionary<string, object> toKeyValuePairs() public class User
{ {
string cards = "[\n"; public bool isAdmin { get; set; }
foreach (var card in cardsOwned) public string minecraftUUID { get; set; }
{ public string username { get; set; }
cards += " {\n";
foreach (var kvp in card.toKeyValuePairs())
{
cards += $" {kvp.Key}: {kvp.Value},\n";
}
cards += " },\n";
}
cards += "]";
return new ()
{
{ "id", id },
{ "isBanned", isBanned },
{ "status", status },
{ "created_at", createdAt },
{ "isFollowed", isFollowed },
{ "isFollowingYou", isFollowingYou },
{ "user", user.ToString() },
{ "roles", $"[{string.Join(", ", roles)}]" },
{ "city", city?.ToString() ?? "Null" },
{ "cardsOwner", cards },
};
}
public override string ToString()
{
string stringToReturn = "{\n";
foreach (var kvp in toKeyValuePairs())
{
stringToReturn += $"\n {kvp.Key}: {kvp.Value},";
}
stringToReturn += "\n}";
return stringToReturn;
}
} }
} }