add support to windows

master
Jan Beníček 2023-01-28 19:35:10 +01:00
parent 69a3c129bb
commit e8a83fb76e
1 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,6 @@
using Newtonsoft.Json;
using System.Runtime.InteropServices;
using System;
using System.Text.Json.Serialization;
namespace Lib_MCPlayerStats
@ -42,7 +44,14 @@ namespace Lib_MCPlayerStats
return Task.FromResult(player); //If Deserialized object is null return empty stats object with ErrorMessage in Username
}
player.Username = GetNameByUUID(file.Split(@"/").Last().Replace("-", "").Replace(".json", "")); //Get Username by UUID
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
player.Username = GetNameByUUID(file.Split(@"\").Last().Replace("-", "").Replace(".json", "")); //Get Username by UUID on Windows
}
else
{
player.Username = GetNameByUUID(file.Split(@"/").Last().Replace("-", "").Replace(".json", "")); //Get Username by UUID
}
//Move data from loaded stats to object with username
player.picked_up = loaded.stats.picked_up;