Class File
Represents a file and provides methods to retrieve and set its properties.
Implements
Inherited Members
Namespace: DataWeb.Media
Assembly: DataWeb.Core.dll
Syntax
public class File : IFile
Remarks
Initializes a new instance of the File class with the specified file store.
Constructors
File(IFileStore)
Represents a file and provides methods to retrieve and set its properties.
Declaration
public File(IFileStore fileStore)
Parameters
Type | Name | Description |
---|---|---|
IFileStore | fileStore | The file store. |
Remarks
Initializes a new instance of the File class with the specified file store.
Properties
Code
Gets or sets the code of the file.
Declaration
public string Code { get; set; }
Property Value
Type | Description |
---|---|
string |
DateModified
Gets or sets the date and time when the file was last modified.
Declaration
public DateTimeOffset? DateModified { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
Domain
Gets or sets the domain of the file.
Declaration
public string Domain { get; set; }
Property Value
Type | Description |
---|---|
string |
Extension
Gets or sets the extension of the file.
Declaration
public string Extension { get; set; }
Property Value
Type | Description |
---|---|
string |
IdMaster
Gets or sets the unique identifier.
Declaration
public string IdMaster { get; set; }
Property Value
Type | Description |
---|---|
string |
IsInStorage
Gets or sets a value indicating whether the file is in the storage service.
Declaration
public bool IsInStorage { get; set; }
Property Value
Type | Description |
---|---|
bool |
Length
Gets or sets the length of the file in bytes.
Declaration
public long Length { get; set; }
Property Value
Type | Description |
---|---|
long |
Name
Gets or sets the name of the file.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Settings
Gets or sets the ssettings of the file.
Declaration
public string Settings { get; set; }
Property Value
Type | Description |
---|---|
string |
StorageContainer
Gets or sets the name of the container where the file is stored.
Declaration
public string StorageContainer { get; set; }
Property Value
Type | Description |
---|---|
string |
StorageFileName
Gets or sets the name of the file in the storage service.
Declaration
public string StorageFileName { get; set; }
Property Value
Type | Description |
---|---|
string |
StorageName
Gets or sets the name of the storage service where the file is stored.
Declaration
public string StorageName { get; set; }
Property Value
Type | Description |
---|---|
string |
TagName
Gets or sets the tag name of the file.
Declaration
public string TagName { get; set; }
Property Value
Type | Description |
---|---|
string |
Type
Gets or sets the type of the file.
Declaration
public string Type { get; set; }
Property Value
Type | Description |
---|---|
string |
VersionName
Gets or sets the version name of the file.
Declaration
public string VersionName { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
GetFileSettings()
Declaration
public FileSettings GetFileSettings()
Returns
Type | Description |
---|---|
FileSettings |
Init(FileData)
Initializes the file from a file data object.
Declaration
public void Init(FileData fileData)
Parameters
Type | Name | Description |
---|---|---|
FileData | fileData | The FileData object. |
Init(SectionPart)
Initializes the file from an item section part.
Declaration
public void Init(Item.SectionPart sectionPart)
Parameters
Type | Name | Description |
---|---|---|
Item.SectionPart | sectionPart | The Item.SectionPart of the item. |
InitByCodeAsync(string, string, string, string, PublishMode?, CancellationToken)
Initializes the file by its code, tag name, version name, version culture, and publish mode.
Declaration
public Task InitByCodeAsync(string code, string tagName = null, string versionName = null, string versionCulture = null, PublishMode? publishMode = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | code | The code of the file. |
string | tagName | The tag name of the file. |
string | versionName | The version name of the file. |
string | versionCulture | The version culture of the file. |
PublishMode? | publishMode | The publish mode of the file. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
InitByIdMasterAsync(string, string, string, string, PublishMode?, CancellationToken)
Initializes the file by its IdMaster.
Declaration
public Task InitByIdMasterAsync(string idMaster, string tagName = null, string versionName = null, string versionCulture = null, PublishMode? publishMode = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | idMaster | The IdMaster of the file. |
string | tagName | The tag name of the file. Default is null. |
string | versionName | The version name of the file. Default is null. |
string | versionCulture | The version culture of the file. Default is null. |
PublishMode? | publishMode | The PublishMode of the file. Default is null. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |