private List <FileSystemModel> GetDrives() { return(_diskProvider.GetDrives() .Select(d => new FileSystemModel { Type = FileSystemEntityType.Drive, Name = GetVolumeName(d), Path = d.Name, LastModified = null }) .ToList()); }
protected override bool IsValid(PropertyValidatorContext context) { if (context.PropertyValue == null) { return(false); } if (OsInfo.IsNotWindows) { return(true); } if (!_runtimeInfo.IsWindowsService) { return(true); } var path = context.PropertyValue.ToString(); if (!DriveRegex.IsMatch(path)) { return(true); } var drives = _diskProvider.GetDrives(); foreach (var drive in drives) { if (path.StartsWith(drive.Name, StringComparison.InvariantCultureIgnoreCase)) { if (drive.DriveType == DriveType.Network) { return(false); } } } return(true); }