FileMediaSourceConverter
using System;
using System.Runtime.CompilerServices;
using Xamarin.Forms.Xaml;
namespace Xamarin.CommunityToolkit.Core
{
[TypeConversion(typeof(FileMediaSource))]
public sealed class FileMediaSourceConverter
{
[System.Runtime.CompilerServices.NullableContext(1)]
public override object ConvertFromInvariantString(string value)
{
if (value == null)
throw new InvalidOperationException($"""{value}""{typeof(FileMediaSource)}");
return (FileMediaSource)MediaSource.FromFile(value);
}
public FileMediaSourceConverter()
: this()
{
}
}
}