Class Resource
Represents an MTA resource
Assembly: SlipeServer.dll
Syntax
public class Resource : SharedResource
Constructors
|
Improve this Doc
View Source
Resource(String)
Only used to extend a specific resource class
Declaration
protected Resource(string name)
Parameters
Type |
Name |
Description |
String |
name |
The name of the resource
|
|
Improve this Doc
View Source
Resource(String, String)
Create a new empty resource
Declaration
public Resource(string name, string organizationalDir = null)
Parameters
Properties
|
Improve this Doc
View Source
ACLRequests
This function retrieves the ACL request section from the meta.xml file of the given resource.
Declaration
public AclRequest[] ACLRequests { get; }
Property Value
|
Improve this Doc
View Source
All
This function retrieves a table of all the resources that exist on the server.
Declaration
public static Resource[] All { get; }
Property Value
|
Improve this Doc
View Source
IsArchived
Checks whether a resource is currently archived (running from within a ZIP file).
Declaration
public bool IsArchived { get; }
Property Value
|
Improve this Doc
View Source
LastStartTime
Used to check the last starting time and date of a resource
Declaration
public DateTime LastStartTime { get; }
Property Value
|
Improve this Doc
View Source
LoadFailureReason
This function retrieves the reason why a resource failed to start.
Declaration
public string LoadFailureReason { get; }
Property Value
|
Improve this Doc
View Source
LoadTime
Gets the date and time at which a resource was last loaded in the server.
Declaration
public DateTime LoadTime { get; }
Property Value
|
Improve this Doc
View Source
OrganizationalPath
This function returns the organizational file path of this resouce
Declaration
public string OrganizationalPath { get; }
Property Value
|
Improve this Doc
View Source
This
Declaration
public static Resource This { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddConfig(String, String)
Adds a new config to this resource
Declaration
public XmlNode AddConfig(string filePath, string fileType = "server")
Parameters
Returns
|
Improve this Doc
View Source
AddMap(String, Int32)
This function adds a new empty mapfile to this resource
Declaration
public XmlNode AddMap(string filePath, int dimension = 0)
Parameters
Returns
|
Improve this Doc
View Source
CopyFrom(Resource, String, String)
This function copies a specified resource with a new name
Declaration
public static Resource CopyFrom(Resource resource, string name, string organizationalDir = null)
Parameters
Returns
|
Improve this Doc
View Source
Delete()
This function deletes this resource from the MTA memory and moves it to the /resources-cache/trash/ directory.
Declaration
Returns
|
Improve this Doc
View Source
Get(String)
This function is used to retrieve a resource from its name. A resource's name is the same as its folder or file archive name on the server (without the extension).
Declaration
public static Resource Get(string name)
Parameters
Type |
Name |
Description |
String |
name |
|
Returns
|
Improve this Doc
View Source
GetInfo(String)
This function retrieves the value of any attribute in a resource info tag.
Declaration
public string GetInfo(string attribute)
Parameters
Type |
Name |
Description |
String |
attribute |
|
Returns
|
Improve this Doc
View Source
MapRoot(String)
This function retrieves the root element of a certain map in this resource
Declaration
public Element MapRoot(string mapName)
Parameters
Type |
Name |
Description |
String |
mapName |
|
Returns
|
Improve this Doc
View Source
Refresh()
Refreshes the current resource
Declaration
Returns
|
Improve this Doc
View Source
RefreshAll()
This function finds new resources and checks for changes to the current ones.
Declaration
public static bool RefreshAll()
Returns
|
Improve this Doc
View Source
RemoveFile(String)
This function removes a file from the resource.
Declaration
public bool RemoveFile(string fileName)
Parameters
Type |
Name |
Description |
String |
fileName |
|
Returns
|
Improve this Doc
View Source
Rename(String, String)
This function renames a resource.
Declaration
public bool Rename(string newName, string organizationalPath)
Parameters
Type |
Name |
Description |
String |
newName |
|
String |
organizationalPath |
|
Returns
|
Improve this Doc
View Source
Restart(Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
This function restarts a running resource. Restarting will destroy all the elements that the resource has created (as stopping the resource does).
Declaration
public bool Restart(bool persistent = true, bool configs = true, bool maps = true, bool scripts = true, bool html = true, bool clientConfigs = true, bool clientScripts = true, bool clientFiles = true)
Parameters
Returns
|
Improve this Doc
View Source
SetInfo(String, String)
This function sets the value of any attribute in a resource info tag.
Declaration
public bool SetInfo(string attribute, string value)
Parameters
Returns
|
Improve this Doc
View Source
Start(Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
This function starts a resource either persistently or as a dependency of the current resource.
Declaration
public bool Start(bool persistent = false, bool includedResources = true, bool configs = true, bool maps = true, bool scripts = true, bool html = true, bool clientConfigs = true, bool clientScripts = true, bool clientFiles = true)
Parameters
Returns
|
Improve this Doc
View Source
Stop()
This function stops a running resource.
Declaration
Returns
|
Improve this Doc
View Source
UpdateACLRequest(String, Boolean, String)
This function changes the access for one ACL request of the given resource.
Declaration
public bool UpdateACLRequest(string rightName, bool access, string byWho = "")
Parameters
Returns
Events
|
Improve this Doc
View Source
OnPreStart
Declaration
public event Resource.OnPreStartHandler OnPreStart
Event Type
|
Improve this Doc
View Source
OnStart
Declaration
public event Resource.OnStartHandler OnStart
Event Type
|
Improve this Doc
View Source
OnStop
Declaration
public event Resource.OnStopHandler OnStop
Event Type