Playing with System.Uri

Started by stanl, August 09, 2020, 07:23:00 AM

Previous topic - Next topic

stanl

Just some Sunday fun. System.Uri also works with local/network files.....
Code (WINBATCH) Select


;Winbatch - more playing around with CLR
cURL = 'https://forum.winbatch.com'
ObjectClrOption("useany","System")
oURI = ObjectClrNew('System.Uri',cURL)


x = oURI.HostNameType
port = oURI.Port
ctype = ""


If x==1 Then ctype = "The host is set, but the type cannot be determined."
If x==2 Then ctype = "The host name is a domain name system (DNS) style host name."
If x==3 Then ctype = "The host name is an Internet Protocol (IP) version 4 host address."
If x==4 Then ctype = "The host name is an Internet Protocol (IP) version 6 host address."
If x==0 Then ctype = "The type of the host name is not supplied."


Message(cURL,"Authority: ":oURI.Authority:@LF:"Host Type: ":ctype:" Port: ":port)
oURI = 0
Exit