/// <summary>Create a OpenConnectionInfo instance.</summary> internal OpenConnectionInfo(string host, NativeMethods.CONNECTION_INFO_1 connectionInfo) { Host = host; Id = connectionInfo.coni1_id; ShareType = connectionInfo.coni1_type; TotalOpenFiles = connectionInfo.coni1_num_opens; TotalUsers = connectionInfo.coni1_num_users; ConnectedSeconds = connectionInfo.coni1_time; UserName = connectionInfo.coni1_username; NetName = connectionInfo.oni1_netname.Replace(Path.LongPathUncPrefix, string.Empty).Replace(Path.UncPrefix, string.Empty); }
/// <summary>Create an OpenConnectionInfo instance.</summary> internal OpenConnectionInfo(string hostName, NativeMethods.CONNECTION_INFO_1 connectionInfo) { HostName = hostName; Id = connectionInfo.coni1_id; ShareType = connectionInfo.coni1_type; TotalOpenFiles = connectionInfo.coni1_num_opens; TotalUsers = connectionInfo.coni1_num_users; ConnectedTime = TimeSpan.FromSeconds(connectionInfo.coni1_time); UserName = connectionInfo.coni1_username; NetName = connectionInfo.oni1_netname; }