2025-11-05 09:42:31 +01:00
|
|
|
// Copyright (c) Microsoft Corporation
|
2022-10-13 13:05:43 +02:00
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
2025-11-05 09:42:31 +01:00
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2022-10-13 13:05:43 +02:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
using Settings.UI.Library.Enumerations;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
|
|
|
|
{
|
|
|
|
|
public class HostsProperties
|
|
|
|
|
{
|
|
|
|
|
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
|
|
|
|
public bool ShowStartupWarning { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
|
|
|
|
public bool LaunchAdministrator { get; set; }
|
|
|
|
|
|
2023-02-27 19:11:57 +01:00
|
|
|
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
|
|
|
|
public bool LoopbackDuplicates { get; set; }
|
|
|
|
|
|
2023-06-06 17:11:37 +02:00
|
|
|
public HostsAdditionalLinesPosition AdditionalLinesPosition { get; set; }
|
|
|
|
|
|
|
|
|
|
public HostsEncoding Encoding { get; set; }
|
2022-10-13 13:05:43 +02:00
|
|
|
|
2025-08-19 00:58:10 -05:00
|
|
|
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
|
|
|
|
public bool NoLeadingSpaces { get; set; }
|
|
|
|
|
|
2025-11-05 09:42:31 +01:00
|
|
|
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
|
|
|
|
public bool BackupHosts { get; set; }
|
|
|
|
|
|
|
|
|
|
public string BackupPath { get; set; }
|
|
|
|
|
|
|
|
|
|
public HostsDeleteBackupMode DeleteBackupsMode { get; set; }
|
|
|
|
|
|
|
|
|
|
public int DeleteBackupsDays { get; set; }
|
|
|
|
|
|
|
|
|
|
public int DeleteBackupsCount { get; set; }
|
|
|
|
|
|
2022-10-13 13:05:43 +02:00
|
|
|
public HostsProperties()
|
|
|
|
|
{
|
|
|
|
|
ShowStartupWarning = true;
|
|
|
|
|
LaunchAdministrator = true;
|
2023-02-27 19:11:57 +01:00
|
|
|
LoopbackDuplicates = false;
|
2023-06-06 17:11:37 +02:00
|
|
|
AdditionalLinesPosition = HostsAdditionalLinesPosition.Top;
|
|
|
|
|
Encoding = HostsEncoding.Utf8;
|
2025-08-19 00:58:10 -05:00
|
|
|
NoLeadingSpaces = false;
|
2025-11-05 09:42:31 +01:00
|
|
|
BackupHosts = true;
|
|
|
|
|
BackupPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), @"System32\drivers\etc");
|
|
|
|
|
DeleteBackupsMode = HostsDeleteBackupMode.Age;
|
|
|
|
|
DeleteBackupsDays = 15;
|
|
|
|
|
DeleteBackupsCount = 5;
|
2022-10-13 13:05:43 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|