mirror of
https://github.com/yawaflua/spworlds-csharp-library.git
synced 2025-12-10 04:29:25 +02:00
update
This commit is contained in:
22
Deserialize.cs
Normal file
22
Deserialize.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user