public string Load() { TestData testData = new TestData(); testData = JSONManager.Deserialize <TestData>(Directory.GetCurrentDirectory() + "/DotnetProjectData/cooldata.json"); return(testData.CoolString + " " + testData.CoolInt.ToString()); }
public string GetUser(Guid guid) { DotnetProjectData.UserDataList = JSONManager.Deserialize <List <UserData> >(Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json"); if (DotnetProjectData.UserDataList.Find(data => data.UserGUID == guid) != null) { return(DotnetProjectData.UserDataList.Find(data => data.UserGUID == guid).UserName); } else { return("Error: User data does not exist."); } }
public string AddUserData(string name, Guid guid) { DotnetProjectData.UserDataList = JSONManager.Deserialize <List <UserData> >(Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json"); UserData userData = new UserData { UserName = name, UserGUID = guid }; if (DotnetProjectData.UserDataList.Find(data => data.UserName == userData.UserName) == null) { DotnetProjectData.UserDataList.Add(userData); JSONManager.Serialize(DotnetProjectData.UserDataList, Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json"); return("Success: User data created."); } else { return("Error: User data already exists."); } }