Projektdateien hinzufügen.

This commit is contained in:
Kevin Krüger
2023-07-24 12:00:34 +02:00
parent 656751e10b
commit 0d00a90942
210 changed files with 45049 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
namespace VideoBrowser.Controls.CefSharpBrowser.Helpers
{
using System;
using System.Globalization;
using System.Net;
/// <summary>
/// Defines the <see cref="UrlHelper" />.
/// </summary>
public static class UrlHelper
{
#region Methods
/// <summary>
/// The IsImageUrl.
/// </summary>
/// <param name="URL">The URL<see cref="string"/>.</param>
/// <returns>The <see cref="bool"/>.</returns>
public static bool IsImageUrl(this string URL)
{
if (!(HttpWebRequest.Create(URL) is HttpWebRequest req))
{
return false;
}
req.Method = "HEAD";
try
{
using (var resp = req.GetResponse())
{
return resp.ContentType.ToLower(CultureInfo.InvariantCulture).StartsWith("image/");
}
}
catch (Exception)
{
return false;
}
}
#endregion Methods
}
}