1
+ #region BSD License
2
+ /*
3
+ * New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
4
+ * Modifications by Peter Wagner (aka Wagnerp), Simon Coghlan (aka Smurf-IV), Giduac & Ahmed Abdelhameed, tobitege et al. 2025 - 2025. All rights reserved.
5
+ */
6
+ #endregion
7
+
8
+ namespace Krypton . Build ;
9
+
10
+ public sealed class AppState
11
+ {
12
+ public ChannelType Channel { get ; set ; }
13
+ public BuildAction Action { get ; set ; }
14
+ public string Configuration { get ; set ; } = "Release" ;
15
+ public string RootPath { get ; set ; } = string . Empty ;
16
+ public string MsBuildPath { get ; set ; } = string . Empty ;
17
+
18
+ public string ProjectFile { get ; set ; } = string . Empty ;
19
+ public string TextLogPath { get ; set ; } = string . Empty ;
20
+ public string BinLogPath { get ; set ; } = string . Empty ;
21
+
22
+ public TailBuffer Tail { get ; } = new TailBuffer ( 200 ) ;
23
+ public int TailLines { get ; set ; }
24
+ public bool IsRunning { get ; set ; }
25
+ public int LastExitCode { get ; set ; }
26
+ public DateTime ? StartTimeUtc { get ; set ; }
27
+ public int ErrorCount { get ; set ; }
28
+ public int WarningCount { get ; set ; }
29
+
30
+ public bool SummaryReady { get ; set ; }
31
+ public IReadOnlyList < string > ? SummaryLines { get ; set ; }
32
+ public int SummaryOffset { get ; set ; }
33
+
34
+ public Action < string > ? OnOutput { get ; set ; }
35
+ public Process ? Process { get ; set ; }
36
+ public Queue < string > ? PendingTargets { get ; set ; }
37
+ public PackMode PackMode { get ; set ; } = PackMode . Pack ;
38
+ public Action ? RequestRenderAll { get ; set ; }
39
+ public bool AutoScroll { get ; set ; } = true ;
40
+
41
+ public Queue < string > ? NuGetPushQueue { get ; set ; }
42
+ public TasksPage TasksPage { get ; set ; } = TasksPage . Ops ;
43
+ public NuGetAction NuGetAction { get ; set ; } = NuGetAction . RebuildPack ;
44
+ public NuGetSource NuGetSource { get ; set ; } = NuGetSource . Default ;
45
+ public bool NuGetCreateZip { get ; set ; }
46
+ public string NuGetCustomSource { get ; set ; } = string . Empty ;
47
+ public bool NuGetIncludeSymbols { get ; set ; }
48
+ public string ? NuGetLastZipPath { get ; set ; }
49
+ public bool NuGetRunPushAfterMsBuild { get ; set ; }
50
+ public bool NuGetRunZipAfterMsBuild { get ; set ; }
51
+ public bool NuGetSkipDuplicate { get ; set ; } = true ;
52
+ public string ? LastCompletedTarget { get ; set ; }
53
+ }
54
+
55
+ public sealed class TailBuffer
56
+ {
57
+ private int capacity ;
58
+ private readonly LinkedList < string > lines = new LinkedList < string > ( ) ;
59
+ private readonly object sync = new object ( ) ;
60
+
61
+ public TailBuffer ( int capacity )
62
+ {
63
+ this . capacity = capacity ;
64
+ }
65
+
66
+ public void SetCapacity ( int newCapacity )
67
+ {
68
+ if ( newCapacity <= 0 )
69
+ {
70
+ return ;
71
+ }
72
+ lock ( sync )
73
+ {
74
+ capacity = newCapacity ;
75
+ while ( lines . Count > capacity )
76
+ {
77
+ lines . RemoveFirst ( ) ;
78
+ }
79
+ }
80
+ }
81
+
82
+ public void Clear ( )
83
+ {
84
+ lock ( sync )
85
+ {
86
+ lines . Clear ( ) ;
87
+ }
88
+ }
89
+ }
0 commit comments