| | | 1 | | using Kestrun.Forms; |
| | | 2 | | |
| | | 3 | | namespace Kestrun.Hosting; |
| | | 4 | | /// <summary> |
| | | 5 | | /// Represents runtime information for a Kestrun host. |
| | | 6 | | /// </summary> |
| | | 7 | | |
| | | 8 | | public record KestrunHostRuntime |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets the form parsing options for Kestrun hosts. |
| | | 12 | | /// </summary> |
| | 639 | 13 | | public Dictionary<string, KrFormOptions> FormOptions { get; } = new Dictionary<string, KrFormOptions>(StringComparer |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets the form part rules for Kestrun hosts. |
| | | 17 | | /// </summary> |
| | 671 | 18 | | public Dictionary<string, KrFormPartRule> FormPartRules { get; } = new Dictionary<string, KrFormPartRule>(StringComp |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets the timestamp when the Kestrun host was started. |
| | | 22 | | /// </summary> |
| | 28 | 23 | | public DateTime? StartTime { get; internal set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets the timestamp when the Kestrun host was stopped. |
| | | 27 | | /// </summary> |
| | 26 | 28 | | public DateTime? StopTime { get; internal set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the uptime duration of the Kestrun host. |
| | | 32 | | /// While running (no StopTime yet), this returns DateTime.UtcNow - StartTime. |
| | | 33 | | /// After stopping, it returns StopTime - StartTime. |
| | | 34 | | /// If StartTime is not set, returns null. |
| | | 35 | | /// </summary> |
| | | 36 | | public TimeSpan? Uptime => |
| | 3 | 37 | | !StartTime.HasValue |
| | 3 | 38 | | ? null |
| | 3 | 39 | | : StopTime.HasValue |
| | 3 | 40 | | ? StopTime - StartTime |
| | 3 | 41 | | : DateTime.UtcNow - StartTime.Value; |
| | | 42 | | } |