Class ContentItemAssetFileSource
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Represents a source of a content item asset originating from a file.
public sealed class ContentItemAssetFileSource : IContentItemAssetSource
- Inheritance
-
objectContentItemAssetFileSource
- Implements
- Extension Methods
Constructors
ContentItemAssetFileSource(string, bool)
Initializes a new instance of the ContentItemAssetFileSource class.
public ContentItemAssetFileSource(string filePath, bool canMove)
Parameters
filePathstringPath to the file containing sourced content item asset binary.
canMoveboolIndicates whether the file can be moved from the
filePathsource location or a copy is to be performed.
Exceptions
- ArgumentException
Thrown when
filePathis null or empty.
Properties
CanMove
Indicates whether the file can be moved from the FilePath source location or a copy is to be performed.
public bool CanMove { get; }
Property Value
- bool
FilePath
Path to the file containing content item asset binary.
public string FilePath { get; }
Property Value
- string
HasData
Indicates whether the source has content item asset data.
public bool HasData { get; }
Property Value
- bool
Remarks
This implementation returns always true.
Methods
Write(string, CancellationToken)
Writes the asset binary to targetAssetFilePath by either moving or copying the underlying file depending on the CanMove flag.
public Task Write(string targetAssetFilePath, CancellationToken cancellationToken)
Parameters
targetAssetFilePathstringTarget file path where the asset binary is to be written.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task
Returns a task representing the asynchronous operation.
Exceptions
- ArgumentException
Thrown when
targetAssetFilePathis null or empty.