HostsProperties.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System; 6 using System.IO; 7 using System.Text.Json.Serialization; 8 using Settings.UI.Library.Enumerations; 9 10 namespace Microsoft.PowerToys.Settings.UI.Library 11 { 12 public class HostsProperties 13 { 14 [JsonConverter(typeof(BoolPropertyJsonConverter))] 15 public bool ShowStartupWarning { get; set; } 16 17 [JsonConverter(typeof(BoolPropertyJsonConverter))] 18 public bool LaunchAdministrator { get; set; } 19 20 [JsonConverter(typeof(BoolPropertyJsonConverter))] 21 public bool LoopbackDuplicates { get; set; } 22 23 public HostsAdditionalLinesPosition AdditionalLinesPosition { get; set; } 24 25 public HostsEncoding Encoding { get; set; } 26 27 [JsonConverter(typeof(BoolPropertyJsonConverter))] 28 public bool NoLeadingSpaces { get; set; } 29 30 [JsonConverter(typeof(BoolPropertyJsonConverter))] 31 public bool BackupHosts { get; set; } 32 33 public string BackupPath { get; set; } 34 35 public HostsDeleteBackupMode DeleteBackupsMode { get; set; } 36 37 public int DeleteBackupsDays { get; set; } 38 39 public int DeleteBackupsCount { get; set; } 40 41 public HostsProperties() 42 { 43 ShowStartupWarning = true; 44 LaunchAdministrator = true; 45 LoopbackDuplicates = false; 46 AdditionalLinesPosition = HostsAdditionalLinesPosition.Top; 47 Encoding = HostsEncoding.Utf8; 48 NoLeadingSpaces = false; 49 BackupHosts = true; 50 BackupPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), @"System32\drivers\etc"); 51 DeleteBackupsMode = HostsDeleteBackupMode.Age; 52 DeleteBackupsDays = 15; 53 DeleteBackupsCount = 5; 54 } 55 } 56 }