Files
spworlds-csharp-library/Deserialize.cs
yawaflua 2df80a4c4b update
2024-04-18 18:38:00 +03:00

23 lines
540 B
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace spworlds
{
internal class Deserialize
{
public static T DeserializeObject<T>(string data) where T : class
{
T objectToReturn = JsonConvert.DeserializeObject<T>(data);
if (objectToReturn == null)
throw new Exception("User not player.");
else
return objectToReturn;
}
}
}