12 internal class WinGetAdminSettingBuilder : WinGetObjectBuilder<WinGetAdminSetting?>
14 private string _entryName =
string.Empty;
15 private string _rawContent =
string.Empty;
16 private bool _hasShortenedContent =
false;
17 private bool? _isEnabled =
false;
22 public WinGetAdminSettingBuilder()
31 public void AddEntryName(
string entryName)
33 _entryName = entryName;
43 public void AddRawContent(
string rawContent)
45 _hasShortenedContent = CheckShortenedValue(rawContent);
47 if (_hasShortenedContent)
50#if NETCOREAPP3_1_OR_GREATER
51 _rawContent = rawContent[..^1];
53 _rawContent = rawContent.Remove(rawContent.Length - 1);
58 _rawContent = rawContent;
61 SetIsEnabled(_rawContent, _hasShortenedContent);
74 public void AddStatus(
bool status)
81 _rawContent =
"Enabled";
85 _rawContent =
"Disabled";
97 if (!_isEnabled.HasValue)
102 return new WinGetAdminSetting(_entryName, _rawContent, _hasShortenedContent, _isEnabled.Value);
106 public override void Clear()
108 _entryName =
string.Empty;
109 _rawContent =
string.Empty;
110 _hasShortenedContent =
false;
123 private void SetIsEnabled(
string rawContent,
bool hasShortenedContent)
127 if (!hasShortenedContent)
129 switch (rawContent.ToUpper())
143#if NETCOREAPP3_1_OR_GREATER
144 if (rawContent.ToUpper().StartsWith(
'E'))
148 else if (rawContent.ToUpper().StartsWith(
'D'))
153 if (rawContent.ToUpper().StartsWith(
"E"))
157 else if (rawContent.ToUpper().StartsWith(
"D"))