mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect.git
synced 2025-06-24 13:34:13 +08:00
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
![]() |
using System;
|
|||
|
using System.Diagnostics;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
namespace WebViewControl {
|
|||
|
|
|||
|
internal static class UrlHelper {
|
|||
|
|
|||
|
private const string ChromeInternalProtocol = "devtools:";
|
|||
|
|
|||
|
public const string AboutBlankUrl = "about:blank";
|
|||
|
|
|||
|
public static ResourceUrl DefaultLocalUrl = new ResourceUrl(ResourceUrl.LocalScheme, "index.html");
|
|||
|
|
|||
|
public static bool IsChromeInternalUrl(string url) {
|
|||
|
return url != null && url.StartsWith(ChromeInternalProtocol, StringComparison.InvariantCultureIgnoreCase);
|
|||
|
}
|
|||
|
|
|||
|
public static bool IsInternalUrl(string url) {
|
|||
|
return IsChromeInternalUrl(url) || url.StartsWith(DefaultLocalUrl.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
|||
|
}
|
|||
|
|
|||
|
public static void OpenInExternalBrowser(string url) {
|
|||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
|||
|
Process.Start("explorer", "\"" + url + "\"");
|
|||
|
} else {
|
|||
|
Process.Start("open", url);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|