Beispiel #1
0
    public string Initialize()
    {
        List <UserData> InitialList = new List <UserData>();

        JSONManager.Serialize(InitialList, Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json");

        return("Initialized!");
    }
    public string Save(string a, int b)
    {
        TestData testData = new TestData();

        testData.CoolString = a;
        testData.CoolInt    = b;

        JSONManager.Serialize(testData, Directory.GetCurrentDirectory() + "/DotnetProjectData/cooldata.json");

        return("Saved: " + testData);
    }
Beispiel #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.");
        }
    }