Class HypervisorComputer
Implements
Inherited Members
Namespace: SociallyDistant.Core.Core.Scripting
Assembly: SociallyDistant.Framework.dll
Syntax
public sealed class HypervisorComputer : IComputer
Properties
IsPlayer
Gets a value indicating whether this is a player's computer.
Declaration
public bool IsPlayer { get; }
Property Value
Type | Description |
---|---|
bool |
Name
Gets the computer's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
NarrativeId
Gets or sets a value indicating the narrative ID of this computer, if any.
Declaration
public string? NarrativeId { get; }
Property Value
Type | Description |
---|---|
string |
Network
Gets an INetworkConnection instance for this computer. This can be used to manage the computer's connection to the Internet, or to connect to other devices.
Declaration
public INetworkConnection? Network { get; }
Property Value
Type | Description |
---|---|
INetworkConnection |
SuperUser
Gets an instance of IUser representing this user's root (administrator) account.
Declaration
public IUser SuperUser { get; }
Property Value
Type | Description |
---|---|
IUser |
Users
Gets a collection of all users on the system.
Declaration
public IEnumerable<IUser> Users { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IUser> |
WorldId
Declaration
public ObjectId WorldId { get; }
Property Value
Type | Description |
---|---|
ObjectId |
Methods
CreateDaemonProcess(string)
Creates a named background process attached to this computer. Useful when setting up background tasks to control a Socially Distant computer, as these processes get killed automatically when the computer de-spawns.
Declaration
public Task<ISystemProcess?> CreateDaemonProcess(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the process. |
Returns
Type | Description |
---|---|
Task<ISystemProcess> | An instance of the newly created process. |
ExecuteProgram(ISystemProcess, IConsoleDriver, string, string[])
Forks the given process and executes the specified program with the given command-line arguments on the forked process.
Declaration
public Task<ISystemProcess?> ExecuteProgram(ISystemProcess parentProcess, IConsoleDriver console, string programName, string[] arguments)
Parameters
Type | Name | Description |
---|---|---|
ISystemProcess | parentProcess | The parent process to fork |
IConsoleDriver | console | A console device for the child process to use as its standard console. |
string | programName | The name of the program to run |
string[] | arguments | Command-line arguments to pass to the program to run |
Returns
Type | Description |
---|---|
Task<ISystemProcess> | The forked child process for the program, or null if the program doesn't exist. |
FindUserById(int, out IUser?)
Tries to look up a user by user ID.
Declaration
public bool FindUserById(int id, out IUser? result)
Parameters
Type | Name | Description |
---|---|---|
int | id | The numeric ID of the user. |
IUser | result |
Returns
Type | Description |
---|---|
bool | True if a user was found, false otherwise. |
See Also
FindUserByName(string, out IUser?)
Tries to look up a user by username.
Declaration
public bool FindUserByName(string username, out IUser? result)
Parameters
Type | Name | Description |
---|---|---|
string | username | The username of the user to be found. |
IUser | result |
Returns
Type | Description |
---|---|
bool | True if the user was found, false otherwise. |
See Also
GetFileSystem(IUser)
Gets an instance of the VirtualFileSystem class that interacts with this computer's root filesystem with the permissions of the given user.
Declaration
public IVirtualFileSystem GetFileSystem(IUser reader)
Parameters
Type | Name | Description |
---|---|---|
IUser | reader |
Returns
Type | Description |
---|---|
IVirtualFileSystem | A view into the computer's file system from the perspective of the given user. |
GetHackable(ushort)
Gets a hackable for a specified port on this device.
Declaration
public IHackable? GetHackable(ushort port)
Parameters
Type | Name | Description |
---|---|---|
ushort | port | The port for which the hackable should be created. |
Returns
Type | Description |
---|---|
IHackable | An instance of IHackable for the given port, or null if the port isn't being listened on. |