-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathSegmentRequest.cs
More file actions
119 lines (98 loc) · 4.33 KB
/
SegmentRequest.cs
File metadata and controls
119 lines (98 loc) · 4.33 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
namespace Kevsoft.WLED;
public sealed class SegmentRequest
{
/// <inheritdoc cref="SegmentResponse.Id"/>
[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Id { get; set; }
/// <inheritdoc cref="SegmentResponse.Start"/>
[JsonPropertyName("start")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Start { get; set; }
/// <inheritdoc cref="SegmentResponse.Stop"/>
[JsonPropertyName("stop")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Stop { get; set; }
/// <inheritdoc cref="SegmentResponse.Length"/>
[JsonPropertyName("len")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Length { get; set; }
/// <inheritdoc cref="SegmentResponse.Group"/>
[JsonPropertyName("grp")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Group { get; set; }
/// <inheritdoc cref="SegmentResponse.Spacing"/>
[JsonPropertyName("spc")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Spacing { get; set; }
/// <inheritdoc cref="SegmentResponse.Offset"/>
[JsonPropertyName("of")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Offset { get; set; }
/// <inheritdoc cref="SegmentResponse.Colors"/>
[JsonPropertyName("col")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int[][]? Colors { get; set; }
/// <inheritdoc cref="SegmentResponse.EffectId"/>
[JsonPropertyName("fx")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? EffectId { get; set; }
/// <inheritdoc cref="SegmentResponse.EffectSpeed"/>
[JsonPropertyName("sx")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? EffectSpeed { get; set; }
/// <inheritdoc cref="SegmentResponse.EffectIntensity"/>
[JsonPropertyName("ix")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? EffectIntensity { get; set; }
/// <inheritdoc cref="SegmentResponse.ColorPaletteId"/>
[JsonPropertyName("pal")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? ColorPaletteId { get; set; }
/// <inheritdoc cref="SegmentResponse.Selected"/>
[JsonPropertyName("sel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Selected { get; set; }
/// <inheritdoc cref="SegmentResponse.Reverse"/>
[JsonPropertyName("rev")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Reverse { get; set; }
/// <inheritdoc cref="SegmentResponse.SegmentState"/>
[JsonPropertyName("on")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? SegmentState { get; set; }
/// <inheritdoc cref="SegmentResponse.Brightness"/>
[JsonPropertyName("bri")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Brightness { get; set; }
/// <inheritdoc cref="SegmentResponse.Mirror"/>
[JsonPropertyName("mi")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Mirror { get; set; }
[JsonPropertyName("i")]
public object[] IndividualLedControl { get; set; } = [];
public static SegmentRequest From(SegmentResponse segmentResponse)
{
return new SegmentRequest
{
Id = segmentResponse.Id,
Start = segmentResponse.Start,
Stop = segmentResponse.Stop,
Length = segmentResponse.Length,
Group = segmentResponse.Group,
Spacing = segmentResponse.Spacing,
Offset = segmentResponse.Offset,
Colors = segmentResponse.Colors,
EffectId = segmentResponse.EffectId,
EffectSpeed = segmentResponse.EffectSpeed,
EffectIntensity = segmentResponse.EffectIntensity,
ColorPaletteId = segmentResponse.ColorPaletteId,
Selected = segmentResponse.Selected,
Reverse = segmentResponse.Reverse,
SegmentState = segmentResponse.SegmentState,
Brightness = segmentResponse.Brightness,
Mirror = segmentResponse.Mirror
};
}
public static implicit operator SegmentRequest(SegmentResponse rhs) => From(rhs);
}