MacFileAssociationService.cs 1.1 KB

12345678910111213141516171819202122232425262728
  1. using PicView.Core.FileAssociations;
  2. namespace PicView.Core.MacOS.FileAssociation;
  3. /// <summary>
  4. /// macOS-specific implementation of IFileAssociationService
  5. /// </summary>
  6. public class MacFileAssociationService : IFileAssociationService
  7. {
  8. public async Task<bool> RegisterFileAssociation(string extension, string description) =>
  9. await FileAssociationHelper.RegisterFileAssociation(extension, "public.image");
  10. public async Task<bool> UnregisterFileAssociation(string extension) =>
  11. await FileAssociationHelper.UnregisterFileAssociationMacOS(extension);
  12. public async Task<bool> IsFileAssociated(string extension)
  13. {
  14. // Since the macOS implementation doesn't have an "IsFileAssociated" method yet,
  15. // we'll need to implement it. Here's a placeholder
  16. // Implementation for checking file association status on macOS would go here
  17. // This could involve checking the Launch Services database
  18. await Task.CompletedTask; // Just to make this async
  19. // For now, return a placeholder value
  20. return false;
  21. }
  22. }