BadScript 2
Loading...
Searching...
No Matches
BadFileSystemStackConfig.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Collections.Generic;
3
using
System.IO;
4
using
Newtonsoft.Json.Linq;
5
6
namespace
BadScript2.Container
7
{
8
public
class
BadFileSystemStackConfig
9
{
10
public
string
?
Name
{
get
;
set
; }
11
public
string
Type
{
get
;
set
; } =
string
.Empty;
12
public
string
Source
{
get
;
set
; } =
string
.Empty;
13
public
string
?
Target
{
get
;
set
; }
14
15
public
static
BadFileSystemStackConfig
[]
FromFile
(
string
path)
16
{
17
List<BadFileSystemStackConfig> configs =
new
List<BadFileSystemStackConfig>();
18
var lines = File.ReadAllLines(path);
19
foreach
(var line
in
lines)
20
{
21
if
(!
string
.IsNullOrEmpty(line))
22
{
23
continue
;
24
}
25
configs.Add(
Parse
(line));
26
}
27
28
return
configs.ToArray();
29
}
30
31
public
static
BadFileSystemStackConfig
Parse
(
string
line)
32
{
33
var parts = line.Split(
'|'
);
34
if
(parts.Length != 2 && parts.Length != 3)
35
{
36
throw
new
Exception(
"Invalid Format"
);
37
}
38
var type = parts[0];
39
var source = parts[1];
40
var target =
"/"
;
41
if
(parts.Length == 3)
42
{
43
target = parts[2];
44
}
45
46
return
new
BadFileSystemStackConfig
47
{
48
Type
= type,
49
Source
= source,
50
Target
= target
51
};
52
}
53
}
54
}
BadScript2.Container.BadFileSystemStackConfig
Definition
BadFileSystemStackConfig.cs:9
BadScript2.Container.BadFileSystemStackConfig.FromFile
static BadFileSystemStackConfig[] FromFile(string path)
Definition
BadFileSystemStackConfig.cs:15
BadScript2.Container.BadFileSystemStackConfig.Name
string? Name
Definition
BadFileSystemStackConfig.cs:10
BadScript2.Container.BadFileSystemStackConfig.Parse
static BadFileSystemStackConfig Parse(string line)
Definition
BadFileSystemStackConfig.cs:31
BadScript2.Container.BadFileSystemStackConfig.Type
string Type
Definition
BadFileSystemStackConfig.cs:11
BadScript2.Container.BadFileSystemStackConfig.Target
string? Target
Definition
BadFileSystemStackConfig.cs:13
BadScript2.Container.BadFileSystemStackConfig.Source
string Source
Definition
BadFileSystemStackConfig.cs:12
BadScript2.Container
Definition
BadContainerRuntimeExtensions.cs:4
src
BadScript2.Container
BadFileSystemStackConfig.cs
Generated by
1.9.8