public string Load()
    {
        TestData testData = new TestData();

        testData = JSONManager.Deserialize <TestData>(Directory.GetCurrentDirectory() + "/DotnetProjectData/cooldata.json");

        return(testData.CoolString + " " + testData.CoolInt.ToString());
    }
示例#2
0
    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.");
        }
    }
示例#3
0
    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.");
        }
    }