Repository navigation
Expand file tree
/
Copy pathTemplateItemFile.cs
More file actions
69 lines (60 loc) · 2.47 KB
/
Copy pathTemplateItemFile.cs
File metadata and controls
69 lines (60 loc) · 2.47 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
using PSModuleDevelopment.Utility;
namespace PSModuleDevelopment.Template
{
/// <summary>
/// Describes a file that is part of a template
/// </summary>
[Serializable]
public class TemplateItemFile : TemplateItemBase
{
/// <summary>
/// The value of the file. May contain plaintext UTF8 in cases of script files or similar text files. Base64 Encoded string in case of binary files.
/// </summary>
public string Value;
/// <summary>
/// Whether the file is interpreted as plain text. If not, it will be assumed to be a Base64 encoded binary file.
/// </summary>
public bool PlainText = true;
/// <summary>
/// List of flat string insertion parameters for the plaintext file
/// </summary>
public List<string> ContentParameterFlat = new List<string>();
/// <summary>
/// List of script value insertion parameters for the plaintext file
/// </summary>
public List<string> ContentParameterScript = new List<string>();
/// <summary>
/// Creates an empty TemplateItemFile
/// </summary>
public TemplateItemFile()
{
}
/// <summary>
/// Creates a filled-out TemplateItemFile.
/// Usually called when deserializing a template.
/// </summary>
/// <param name="PSItem">The deserialized instance of this template item file.</param>
public TemplateItemFile(PSObject PSItem)
{
Name = PSItem.GetValue<string>("Name");
RelativePath = PSItem.GetValue<string>("RelativePath");
Identifier = PSItem.GetValue<string>("Identifier");
foreach (string entry in PSItem.GetValues("FileSystemParameterFlat"))
FileSystemParameterFlat.Add(entry);
foreach (string entry in PSItem.GetValues("FileSystemParameterScript"))
FileSystemParameterScript.Add(entry);
foreach (string entry in PSItem.GetValues("ContentParameterFlat"))
ContentParameterFlat.Add(entry);
foreach (string entry in PSItem.GetValues("ContentParameterScript"))
ContentParameterScript.Add(entry);
Value = PSItem.GetValue<string>("Value");
PlainText = PSItem.GetValue<bool>("PlainText");
}
}
}