public async Task <WorldSelfRES> GetSingle(string id) { Universal universal = new Universal(); WorldSelfRES worldRES = await universal.GET <WorldSelfRES>("worlds/", id, true); worldRES.instances = worldRES._instances.Select(data => new WorldInstance() { id = (string)data[0], occupants = (int)data[1] }).ToList(); Console.WriteLine($"{worldRES.id}"); Console.WriteLine($"Grabbed World: ' {worldRES.name} ' made by {worldRES.authorName}"); Console.WriteLine(); return(worldRES); }
public async Task DoGetWorldByID() { Console.Clear(); Console.Title = $"VRChatAPIdotNET - {selected}"; Console.WriteLine("Type in the ID of the World:"); string id = Console.ReadLine(); Console.WriteLine(); WorldSelfRES wSRES = await client.Worlds.GetSingle(id); foreach (var prop in wSRES.GetType().GetProperties()) { if (prop.Name == "tags") { Console.WriteLine($"--- {prop.Name} start ---"); List <string> newProp = (List <string>)prop.GetValue(wSRES, null); Console.WriteLine(String.Join(",\n", newProp)); Console.WriteLine($"--- {prop.Name} end ---"); } else if (prop.Name == "unityPackages") { Console.WriteLine($"--- {prop.Name} start ---"); List <UnityPackage> newProp = (List <UnityPackage>)prop.GetValue(wSRES, null); newProp.ForEach(x => { /*Console.WriteLine( * $"\tid: {x.id}\n" + * $"\tassetUrl: {x.assetUrl}\n" + * $"\tpluginUrl: {x.pluginUrl}\n" + * $"\tunityVersion: {x.unityVersion}\n" + * $"\tunitySortNumber: {x.unitySortNumber}\n" + * $"\tassetVersion: {x.assetVersion}\n" + * $"\tplatform: {x.platform}\n" + * $"\tcreated_at: {x.createdTime}\n");*/ foreach (PropertyInfo propI in x.GetType().GetProperties()) { Console.WriteLine($"\t{propI.Name}: {propI.GetValue(x, null)}"); } }); Console.WriteLine($"--- {prop.Name} end ---"); } else if (prop.Name == "_instances") { Console.WriteLine($"--- {prop.Name} start ---"); List <JArray> newProp = (List <JArray>)prop.GetValue(wSRES, null); Console.WriteLine(String.Join(",\n", newProp)); Console.WriteLine($"--- {prop.Name} end ---"); } else if (prop.Name == "instances") { continue; } else { Console.WriteLine($"{prop.Name} :: {prop.GetValue(wSRES, null)}"); } } Console.WriteLine(); Console.WriteLine("Press any key to return to the Main Menu."); Console.Read(); }