Crosstales.Common.Util.NetworkHelper Class Reference

Base for various helper functions for networking. More...

Static Public Member Functions

static bool OpenURL (string url)
 Opens the given URL with the file explorer or browser. More...
 
static bool RemoteCertificateValidationCallback (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
 HTTPS-certification callback. More...
 
static string GetURLFromFile (string path)
 Returns the URL of a given file. More...
 
static string ValidateURL (string url, bool removeProtocol=false, bool removeWWW=true, bool removeSlash=true)
 Validates a given URL. More...
 
static bool isURL (string url)
 Checks if the input is an URL. More...
 
static bool isIPv4 (string ip)
 Checks if the input is an IPv4 address. More...
 
static string GetIP (string host)
 Returns the IP of a given host name. More...
 
static string ValidURLFromFilePath (string path)
 Returns the URL of a given file. More...
 
static string CleanUrl (string url, bool removeProtocol=true, bool removeWWW=true, bool removeSlash=true)
 Cleans a given URL. More...
 
static bool isValidURL (string url)
 Checks if the URL is valid. More...
 

Static Protected Attributes

const string FILE_PREFIX = "file://"
 
const string CONTENT_PREFIX = "content://"
 

Properties

static bool isInternetAvailable [get]
 Checks if an Internet connection is available. More...
 

Detailed Description

Base for various helper functions for networking.

Member Function Documentation

◆ CleanUrl()

static string Crosstales.Common.Util.NetworkHelper.CleanUrl ( string  url,
bool  removeProtocol = true,
bool  removeWWW = true,
bool  removeSlash = true 
)
static

Cleans a given URL.

Parameters
urlURL to clean
removeProtocolRemove the protocol, e.g. http:// (optional, default: true)
removeWWWRemove www (optional, default: true)
removeSlashRemove slash at the end (optional, default: true)
Returns
Clean URL

◆ GetIP()

static string Crosstales.Common.Util.NetworkHelper.GetIP ( string  host)
static

Returns the IP of a given host name.

Parameters
hostHost name
Returns
IP of a given host name.

◆ GetURLFromFile()

static string Crosstales.Common.Util.NetworkHelper.GetURLFromFile ( string  path)
static

Returns the URL of a given file.

Parameters
pathFile path
Returns
URL of the file path

◆ isIPv4()

static bool Crosstales.Common.Util.NetworkHelper.isIPv4 ( string  ip)
static

Checks if the input is an IPv4 address.

Parameters
urlInput as possible IPv4
Returns
True if the given path is an IPv4 address

◆ isURL()

static bool Crosstales.Common.Util.NetworkHelper.isURL ( string  url)
static

Checks if the input is an URL.

Parameters
urlInput as possible URL
Returns
True if the given path is an URL

◆ isValidURL()

static bool Crosstales.Common.Util.NetworkHelper.isValidURL ( string  url)
static

Checks if the URL is valid.

Parameters
urlURL to check
Returns
True if the URL is valid.

◆ OpenURL()

static bool Crosstales.Common.Util.NetworkHelper.OpenURL ( string  url)
static

Opens the given URL with the file explorer or browser.

Parameters
urlURL to open
Returns
True if the operation was successful

◆ RemoteCertificateValidationCallback()

static bool Crosstales.Common.Util.NetworkHelper.RemoteCertificateValidationCallback ( object  sender,
System.Security.Cryptography.X509Certificates.X509Certificate  certificate,
System.Security.Cryptography.X509Certificates.X509Chain  chain,
System.Net.Security.SslPolicyErrors  sslPolicyErrors 
)
static

HTTPS-certification callback.

◆ ValidateURL()

static string Crosstales.Common.Util.NetworkHelper.ValidateURL ( string  url,
bool  removeProtocol = false,
bool  removeWWW = true,
bool  removeSlash = true 
)
static

Validates a given URL.

Parameters
urlURL to validate
removeProtocolRemove the protocol, e.g. http:// (optional, default: false)
removeWWWRemove www (optional, default: true)
removeSlashRemove slash at the end (optional, default: true)
Returns
Clean URL

◆ ValidURLFromFilePath()

static string Crosstales.Common.Util.NetworkHelper.ValidURLFromFilePath ( string  path)
static

Returns the URL of a given file.

Parameters
pathFile path
Returns
URL of the file path

Property Documentation

◆ isInternetAvailable

bool Crosstales.Common.Util.NetworkHelper.isInternetAvailable
staticget

Checks if an Internet connection is available.

Returns
True if an Internet connection is available.

The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/DJPro/DJPro/Assets/Plugins/crosstales/Common/Scripts/Util/NetworkHelper.cs