namespace DesktopMagic.Api.Settings; /// /// Represents a file selector control that allows the user to browse for a file. /// public sealed class FileSelector : Setting { private string _value = string.Empty; /// /// Gets or sets the selected file path. /// public string Value { get => _value; set { if (_value != value) { _value = value; ValueChanged(); } } } /// /// Gets or sets the file filter for the file dialog (e.g., "Image Files|*.png;*.jpg|All Files|*.*"). /// public string Filter { get; set; } /// /// Gets or sets the title of the file dialog. /// public string Title { get; set; } /// /// Gets or sets a value indicating whether the file selector should select folders instead of files. /// public bool SelectFolder { get; set; } /// /// Initializes a new instance of the class. /// /// The default file path. /// The file filter for the file dialog. /// The title of the file dialog. /// If true, selects folders instead of files. public FileSelector(string defaultPath = "", string filter = "All Files|*.*", string title = "Select File", bool selectFolder = false) { _value = defaultPath; Filter = filter; Title = title; SelectFolder = selectFolder; } internal override string GetJsonValue() { return Value; } internal override void SetJsonValue(string value) { Value = value; } }