/// <summary> /// Constructor with UNC /// </summary> /// <param name="path">The share name - UNC</param> public NetworkShare( String path ) { String hostName = ""; // check if the UNC is valid unc = (String) path.Clone(); if( path.StartsWith( @"\\" ) ) { path = path.Remove( 0, 2 ); int i = path.IndexOf( @"\" ); if( i < 0 ) { goto _abort; } hostName = path.Substring( 0, path.IndexOf( @"\" ) ); path = path.Remove( 0, i ); if( path == null || path.Length < 1 ) { goto _abort; } // remove the first "\" remotePath = (String) path.Remove( 0, 1 ); if( remotePath == null || remotePath.Length < 1 ) { goto _abort; } goto _ok; } _abort: throw new Exception( "Invalid UNC path: " + unc ); _ok: { host = new NetworkHost( hostName, 0 /* dummy */ ); } }
///<summary> /// Copy constructor ///</summary> public NetworkHost( NetworkHost other ) { ipAddress = other.ipAddress; dnsName = other.dnsName; }
/// <summary> /// Default constructor /// </summary> public NetworkShare( ) { unc = ""; host = new NetworkHost(); remotePath = ""; }