-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileModel.cs
More file actions
48 lines (42 loc) · 1.4 KB
/
FileModel.cs
File metadata and controls
48 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
namespace ATK.Command.Communication.Models
{
/// <summary>
/// Presents the model for the upload or download files.
/// </summary>
public class FileModel
{
/// <summary>
/// Gets or sets the content of the file.
/// </summary>
public byte[] Content { get; set; }
/// <summary>
/// Gets or sets the base64 encoded content of the file.
/// </summary>
public string Base64EncodedContent { get; set; }
/// <summary>
/// Gets or sets the name of the file.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the content type of the file.
/// </summary>
public string ContentType { get; set; } = string.Empty;
/// <summary>
/// Converts the Content to Base64EncodedContent and clears the Content.
/// </summary>
public void ToBase64()
{
this.Base64EncodedContent = Convert.ToBase64String(this.Content);
this.Content = null;
}
/// <summary>
/// Converts the Base64EncodedContent to Content and clears the Base64EncodedContent.
/// </summary>
public void FromBase64()
{
this.Content = Convert.FromBase64String(this.Base64EncodedContent);
this.Base64EncodedContent = null;
}
}
}