public DirectoryRootInfo(string protocol, string server, ushort port, LdapPath path) { _protocol = protocol; _server = server; _port = port; _path = path; }
internal string GetEntryPSPath(DirectoryEntry entry) { LdapPath path = LdapPath.Parse(DirectoryUtils.GetDistinguishedName(entry)); foreach (DirectoryServiceDriveInfo drive in ProviderInfo.Drives) { if (path.IsChildOf(drive.RootInfo.Path)) { return(NormalizeSlashes(drive.Name + ":\\" + path.GetChildPart().ToCanonicalName(false))); } } return(NormalizeSlashes(ProviderInfo.PSSnapIn.Name + '\\' + ProviderInfo.Name + "::" + entry.Path)); }
private void ParsePSPath(string path, out DirectoryRootInfo root, out string childPath) { foreach (DirectoryServiceDriveInfo drive in ProviderInfo.Drives) { if (path.StartsWith(drive.Root, StringComparison.OrdinalIgnoreCase)) { root = drive.RootInfo; childPath = path.Substring(drive.Root.Length); childPath = childPath.Trim(Slash, Backslash); return; } } string protocol = DSProtocol.GetProtocol(ref path); string server = null; ushort port = DSProtocol.DefaultPort; int slash = path.IndexOfAny(new char[] { Slash, Backslash }); if (slash > -1) { server = path.Substring(0, slash); path = path.Substring(slash + 1); int colon = server.IndexOf(':'); if (colon > -1) { port = ushort.Parse(server.Substring(colon + 1)); server = server.Substring(0, colon); } } slash = path.IndexOfAny(new char[] { Slash, Backslash }); if (slash < 0) { slash = path.Length; } Utils.SplitString(path, slash, out path, out childPath); root = new DirectoryRootInfo(protocol, server, port, LdapPath.Parse(path)); }
public DirectoryRootInfo(string protocol, LdapPath path) : this(protocol, null, 0, path) { }