Class Manifest
Representation of Manifest JSON file. Can be used for adding dependencies, scopeRegistries, etc to .json file
Inheritance
Inherited Members
Namespace: StansAssets.Foundation.Editor
Assembly: cs.temp.dll.dll
Syntax
public class Manifest
Constructors
Manifest(String)
Initializes a new instance of the Manifest class.
Declaration
public Manifest(string pathToFile = "Packages/manifest.json")
Parameters
Type | Name | Description |
---|---|---|
System.String | pathToFile | Path to manifest file. |
Properties
Path
Path to manifest file.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddScopeRegistry(String, String, IEnumerable<String>)
Adds ScopeRegistry with the provided properties. If manifest already contains ScopeRegistry with given url, provided scopes will be merged with existing ScopeRegistry scopes. Name of existing ScopeRegistry won't be updated.
Declaration
public ScopeRegistry AddScopeRegistry(string url, string name, IEnumerable<string> scopes)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Scope registry url. |
System.String | name | Scope registry name. |
IEnumerable<System.String> | scopes | Scope registry scopes. |
Returns
Type | Description |
---|---|
ScopeRegistry | New ScopeRegistry with provided properties or existing with updated scopes, if Manifest already contains ScopeRegistry with given name. |
ApplyChanges()
Writes changes back to the manifest file.
Declaration
public void ApplyChanges()
Fetch()
Read the Manifest file and deserialize its content from JSON.
Declaration
public void Fetch()
GetDependencies()
Returns dependencies of the manifest.
Declaration
public IEnumerable<Dependency> GetDependencies()
Returns
Type | Description |
---|---|
IEnumerable<Dependency> | Dependencies of the manifest. |
GetDependency(String)
Returns dependency by a provided name.
Declaration
public Dependency GetDependency(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the dependency. |
Returns
Type | Description |
---|---|
Dependency | Dependency with given name. |
GetScopeRegistries()
Returns scope registries of the manifest.
Declaration
public IEnumerable<ScopeRegistry> GetScopeRegistries()
Returns
Type | Description |
---|---|
IEnumerable<ScopeRegistry> | Scope registries of the manifest. |
GetScopeRegistry(String)
Returns scope registry by a provided url.
Declaration
public ScopeRegistry GetScopeRegistry(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Scope registry url. |
Returns
Type | Description |
---|---|
ScopeRegistry | Scope registry with the given url. |
IsDependencyExists(String)
Searches for a specific dependency by the provided name.
Declaration
public bool IsDependencyExists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The dependency name to search for. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsScopeRegistryExists(String)
Searches for ScopeRegistry with the provided Url.
Declaration
public bool IsScopeRegistryExists(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | ScopeRegistry url to search for. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RemoveDependency(Dependency)
Removes the Dependency from current manifest.
Declaration
public void RemoveDependency(Dependency dependency)
Parameters
Type | Name | Description |
---|---|---|
Dependency | dependency | The Dependency to remove. |
RemoveDependency(String)
Removes the Dependency with the specified name from current manifest.
Declaration
public void RemoveDependency(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of Dependency to remove. |
SetDependency(String)
Sets Dependency by given full name. If manifest already contains Dependency with given name, existing Dependency will be overwritten.
Declaration
public void SetDependency(string fullName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fullName | Dependency full name. |
SetDependency(String, String)
Sets Dependency by given name. If manifest already contains Dependency with given name, existing Dependency will be overwritten.
Declaration
public void SetDependency(string name, string version)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Dependency name. |
System.String | version | Dependency version. |
SetOrUpdateDependency(String)
Sets Dependency by given full name. If manifest already contains Dependency with given name, its' SemanticVersions will be taken into account. Dependency with higher SemanticVersion will be placed into the Manifest.
Declaration
public Dependency SetOrUpdateDependency(string fullName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fullName | Dependency full name. |
Returns
Type | Description |
---|---|
Dependency | New or existing Dependency with given name. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when dependency fullName has wrong format |
SetOrUpdateDependency(String, String)
Sets Dependency by given name. If manifest already contains Dependency with given name, its' SemanticVersions will be taken into account. Dependency with higher SemanticVersion will be placed into the Manifest.
Declaration
public Dependency SetOrUpdateDependency(string name, string version)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Dependency name. |
System.String | version | Dependency name. |
Returns
Type | Description |
---|---|
Dependency | New or existing Dependency with given name. |
SetScopeRegistry(String, ScopeRegistry)
Sets ScopeRegistry by given url. If manifest already contains ScopeRegistry with given url, existing ScopeRegistry will be overwritten.
Declaration
public void SetScopeRegistry(string url, ScopeRegistry registry)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Scope registry url. |
ScopeRegistry | registry | ScopeRegistry to set. |
TryGetDependency(String, out Dependency)
Gets the Dependency associated with the specified name.
Declaration
public bool TryGetDependency(string name, out Dependency dependency)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the Dependency to get. |
Dependency | dependency | When this method returns, contains the Dependency associated with the specified name,
if the name is found; otherwise, |
Returns
Type | Description |
---|---|
System.Boolean | true if the Manifest contains a Dependency with the specified name; otherwise, false. |
TryGetScopeRegistry(String, out ScopeRegistry)
Gets the ScopeRegistry associated with the specified url.
Declaration
public bool TryGetScopeRegistry(string url, out ScopeRegistry registry)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The url of the ScopeRegistry to get. |
ScopeRegistry | registry | When this method returns, contains the ScopeRegistry associated with the specified url,
if the url is found; otherwise, |
Returns
Type | Description |
---|---|
System.Boolean | true if the Manifest contains a ScopeRegistry with the specified url; otherwise, false. |