Beispiel #1
0
    public static bool SaveLastUser()
    {
        if (CurrentUser == null)
        {
            return(false);
        }

        var bytes = UserFile.Serialise(CurrentUser.GetUserFile());

        FileSystem.TryWriteFile(UserFile.LastUserLocation, bytes);

        return(true);
    }
Beispiel #2
0
    public static bool TryCreateUser(string email, string password, string username, string pic = "")
    {
        try
        {
            UserFile u = new UserFile()
            {
                Email    = email,
                Password = password,
                Username = username
            };

            FileSystem.TryWriteFile(UserFile.UserFolder + username + "/user.userfile", UserFile.Serialise(u));

            //Debug.WriteLine($"Create new user at {UserFile.UserFolder}");

            UpdateLocalUsers();

            OnRegistered?.Invoke(new UserAccount()
            {
                Username     = username,
                EmailAddress = email,
                Password     = password
            });

            return(true);
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
            return(false);
        }
    }