PackageSession Class
Namespace: Stride.Core.AssetsAssembly: Stride.Core.Assets.dll
A session for editing a package.
public sealed class PackageSession : IDisposable, IAssetFinder
Name | Description | |
---|---|---|
Constructors | ||
PackageSession() | Initializes a new instance of the PackageSession class. |
|
PackageSession(Package) | Initializes a new instance of the PackageSession class. |
|
Fields | ||
DefaultVisualStudioVersion | The visual studio version property used for newly created project solution files |
|
Properties | ||
AssemblyContainer | ||
CurrentProject | Gets or sets the selected current package. |
|
DependencyManager | Gets the dependency manager. |
|
HasDependencyManager | Gets a value indicating whether this instance has dependency manager. |
|
IsDirty | ||
LocalPackages | Gets the user packages (excluding system packages). |
|
Packages | Gets the packages referenced by the solution. |
|
Projects | The projects referenced by the solution. |
|
SaveCompletion | Gets a task that completes when the session is finished saving. |
|
SolutionPath | Gets or sets the solution path (sln) in case the session was loaded from a solution. |
|
SourceTracker | ||
VisualStudioVersion | The targeted visual studio version (if specified by the loaded package) |
|
Methods | ||
AddExistingPackage(Package, ILogger) | Adds an existing package to the current session and runs the package analysis before adding it. |
|
AddExistingProject(UFile, ILogger, PackageLoadParameters) | Adds an existing package to the current session. |
|
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
|
FindAsset(AssetId) | Finds an asset by its identifier. |
|
FindAsset(UFile) | Finds an asset by its location. |
|
FindAssetFromProxyObject(Object) | Finds an asset from a proxy object. |
|
GetPackagesFromCurrent() | Gets the packages referenced by the current package. |
|
Load(String, PackageLoadParameters) | Loads a package from specified file path. |
|
Load(String, PackageSessionResult, PackageLoadParameters) | Loads a package from specified file path. |
|
LoadMissingAssets(ILogger, IEnumerable<Package>, PackageLoadParameters) | Make sure packages have their assets loaded. |
|
LoadMissingDependencies(ILogger, PackageLoadParameters) | Make sure packages have their dependencies loaded. |
|
LoadMissingReferences(ILogger, PackageLoadParameters) | Make sure packages have their dependencies and assets loaded. |
|
Save(ILogger, PackageSaveParameters) | Saves all packages and assets. |
|
UpdateAssemblyReferences(LoggerResult) | Loads the assembly references that were not loaded before. |
|
UpdateDependencies(SolutionProject, Boolean, Boolean) | ||
Events | ||
AssetDirtyChanged |
Constructors
PackageSession()
Initializes a new instance of the PackageSession class.
public PackageSession()
PackageSession(Package)
Initializes a new instance of the PackageSession class.
public PackageSession(Package package)
Parameters
Type | Name | Description |
---|---|---|
Package | package |
Fields
DefaultVisualStudioVersion
The visual studio version property used for newly created project solution files
public static readonly Version DefaultVisualStudioVersion
Field Value
Type | Description |
---|---|
System.Version |
Properties
AssemblyContainer
public AssemblyContainer AssemblyContainer { get; }
Property Value
Type | Description |
---|---|
Stride.Core.Reflection.AssemblyContainer |
CurrentProject
Gets or sets the selected current package.
public SolutionProject CurrentProject { get; set; }
Property Value
Type | Description |
---|---|
SolutionProject | The selected current package. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Expecting a package that is already registered in this session |
DependencyManager
Gets the dependency manager.
public AssetDependencyManager DependencyManager { get; }
Property Value
Type | Description |
---|---|
AssetDependencyManager | AssetDependencyManager. |
HasDependencyManager
Gets a value indicating whether this instance has dependency manager.
public bool HasDependencyManager { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsDirty
public bool IsDirty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LocalPackages
Gets the user packages (excluding system packages).
public IEnumerable<Package> LocalPackages { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Package> | The user packages. |
Packages
Gets the packages referenced by the solution.
public IReadOnlyPackageCollection Packages { get; }
Property Value
Type | Description |
---|---|
IReadOnlyPackageCollection | The packages. |
Projects
The projects referenced by the solution.
public ProjectCollection Projects { get; }
Property Value
Type | Description |
---|---|
ProjectCollection |
SaveCompletion
Gets a task that completes when the session is finished saving.
public Task SaveCompletion { get; }
Property Value
Type | Description |
---|---|
System.Threading.Tasks.Task |
SolutionPath
Gets or sets the solution path (sln) in case the session was loaded from a solution.
public UFile SolutionPath { get; set; }
Property Value
Type | Description |
---|---|
Stride.Core.IO.UFile | The solution path. |
SourceTracker
public AssetSourceTracker SourceTracker { get; }
Property Value
Type | Description |
---|---|
AssetSourceTracker |
VisualStudioVersion
The targeted visual studio version (if specified by the loaded package)
public Version VisualStudioVersion { get; set; }
Property Value
Type | Description |
---|---|
System.Version |
Methods
AddExistingPackage(Package, ILogger)
Adds an existing package to the current session and runs the package analysis before adding it.
public void AddExistingPackage(Package package, ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
Package | package | The package to add |
ILogger | logger | The logger |
AddExistingProject(UFile, ILogger, PackageLoadParameters)
Adds an existing package to the current session.
public PackageContainer AddExistingProject(UFile projectPath, ILogger logger, PackageLoadParameters loadParametersArg = null)
Parameters
Type | Name | Description |
---|---|---|
Stride.Core.IO.UFile | projectPath | The project or package path. |
ILogger | logger | The session result. |
PackageLoadParameters | loadParametersArg | The load parameters argument. |
Returns
Type | Description |
---|---|
PackageContainer |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | packagePath |
System.ArgumentException | Invalid relative path. Expecting an absolute package path;packagePath |
System.IO.FileNotFoundException | Unable to find package |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FindAsset(AssetId)
Finds an asset by its identifier.
public AssetItem FindAsset(AssetId assetId)
Parameters
Type | Name | Description |
---|---|---|
AssetId | assetId | The identifier of the asset. |
Returns
Type | Description |
---|---|
AssetItem | The corresponding AssetItem if found; otherwise, |
Remarks
Looks for the asset amongst all the packages of this session.
FindAsset(UFile)
Finds an asset by its location.
public AssetItem FindAsset(UFile location)
Parameters
Type | Name | Description |
---|---|---|
Stride.Core.IO.UFile | location | The location of the asset. |
Returns
Type | Description |
---|---|
AssetItem | The corresponding AssetItem if found; otherwise, |
Remarks
Looks for the asset amongst all the packages of this session.
FindAssetFromProxyObject(Object)
Finds an asset from a proxy object.
public AssetItem FindAssetFromProxyObject(object proxyObject)
Parameters
Type | Name | Description |
---|---|---|
System.Object | proxyObject | The proxy object which is represent the targeted asset. |
Returns
Type | Description |
---|---|
AssetItem | The corresponding AssetItem if found; otherwise, |
Remarks
Looks for the asset amongst all the packages of this session.
GetPackagesFromCurrent()
Gets the packages referenced by the current package.
public IEnumerable<Package> GetPackagesFromCurrent()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Package> | IEnumerable<Package>. |
Load(String, PackageLoadParameters)
Loads a package from specified file path.
public static PackageSessionResult Load(string filePath, PackageLoadParameters loadParameters = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path to a package file. |
PackageLoadParameters | loadParameters | The load parameters. |
Returns
Type | Description |
---|---|
PackageSessionResult | A package. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | filePath |
Load(String, PackageSessionResult, PackageLoadParameters)
Loads a package from specified file path.
public static void Load(string filePath, PackageSessionResult sessionResult, PackageLoadParameters loadParameters = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path to a package file. |
PackageSessionResult | sessionResult | The session result. |
PackageLoadParameters | loadParameters | The load parameters. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | filePath |
System.ArgumentException | File [{0}] must exist.ToFormat(filePath);filePath |
LoadMissingAssets(ILogger, IEnumerable<Package>, PackageLoadParameters)
Make sure packages have their assets loaded.
public void LoadMissingAssets(ILogger log, IEnumerable<Package> packages, PackageLoadParameters loadParametersArg = null)
Parameters
Type | Name | Description |
---|---|---|
ILogger | log | The log. |
System.Collections.Generic.IEnumerable<Package> | packages | The packages to try to load missing assets from. |
PackageLoadParameters | loadParametersArg | The load parameters argument. |
LoadMissingDependencies(ILogger, PackageLoadParameters)
Make sure packages have their dependencies loaded.
public void LoadMissingDependencies(ILogger log, PackageLoadParameters loadParametersArg = null)
Parameters
Type | Name | Description |
---|---|---|
ILogger | log | The log. |
PackageLoadParameters | loadParametersArg | The load parameters argument. |
LoadMissingReferences(ILogger, PackageLoadParameters)
Make sure packages have their dependencies and assets loaded.
public void LoadMissingReferences(ILogger log, PackageLoadParameters loadParameters = null)
Parameters
Type | Name | Description |
---|---|---|
ILogger | log | The log. |
PackageLoadParameters | loadParameters | The load parameters. |
Save(ILogger, PackageSaveParameters)
Saves all packages and assets.
public void Save(ILogger log, PackageSaveParameters saveParameters = null)
Parameters
Type | Name | Description |
---|---|---|
ILogger | log | The LoggerResult in which to report result. |
PackageSaveParameters | saveParameters | The parameters for the save operation. |
UpdateAssemblyReferences(LoggerResult)
Loads the assembly references that were not loaded before.
public void UpdateAssemblyReferences(LoggerResult log)
Parameters
Type | Name | Description |
---|---|---|
LoggerResult | log | The log. |
UpdateDependencies(SolutionProject, Boolean, Boolean)
public static void UpdateDependencies(SolutionProject project, bool directDependencies, bool flattenedDependencies)
Parameters
Type | Name | Description |
---|---|---|
SolutionProject | project | |
System.Boolean | directDependencies | |
System.Boolean | flattenedDependencies |
Events
AssetDirtyChanged
public event DirtyFlagChangedDelegate<AssetItem> AssetDirtyChanged
Event Type
Type | Description |
---|---|
DirtyFlagChangedDelegate<AssetItem> |