Skip to content

Class CSharpLib.Computer.User

Samuel edited this page May 16, 2021 · 1 revision

Interfaces as a miniature user account.

To begin using this class, you must first create a user account. Do it like so:

using CSharpLib.Computer;

User user = new User("username", "password");

In the above example, a new user was created with the username as "username", and the password as "password". The above code will throw an exception if the username already exists.

Now that a user is created, you can now use user methods in the class. Currently, there are four methods (more added, see bottom): WriteFile, ReadFile, CreateDirectory, and GetFiles, which access files and directories per user.

When you are finished and BEFORE another instance is created, call

user.Logout();

If you want to use an account you already created, create an instance like this:

`User user = User.Login("username", "password");

This logs in a user account that already exists. When you are finished, call

user.Logout();

Added in version 3.0.0:

  • AddFile(string file, string directory, bool move) - Adds a file to the user currently logged in.
  • AddFile(string file, bool move) - Adds an existing file to the root directory on the user currently logged in.
  • AddFile(string file) - Copies an existing file to the root directory of the user currently logged in.
  • AddFile(List<string> files, string directory, bool move) - Adds a list of existing files to the user currently logged in.
  • AddFile(List<string> files, bool move) - Adds a list of existing files to the root directory of the user currently logged in.
  • AddFile(List<string> files) - Copies a list of files to the root directory of the user currently logged in.