コード例 #1
0
        private ContextCookie EnterContext(string path)
        {
            ContextCookie cookie = new ContextCookie(_rootInfo, EnterContext());

            if (PSDriveInfo == null && !string.IsNullOrEmpty(path))
            {
                _rootInfo = ParsePSPathRoot(path);
            }

            return(cookie);
        }
コード例 #2
0
 internal DirectoryServiceDriveInfo
 (
     String name,
     ProviderInfo provider,
     String description,
     PSCredential credential,
     DirectoryRootInfo rootInfo
 )
     : base(name, provider, name + ':', description, credential)
 {
     _rootInfo = rootInfo;
 }
コード例 #3
0
 internal DirectoryServiceDriveInfo
 (
     String name,
     ProviderInfo provider,
     String description,
     PSCredential credential,
     DirectoryRootInfo rootInfo
 )
     : base(name, provider, name + ':', description, credential)
 {
     _rootInfo = rootInfo;
 }
コード例 #4
0
        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));
        }
コード例 #5
0
 internal ContextCookie(DirectoryRootInfo prev, PscxThreadContext.Cookie? providerCookie)
 {
     _prev = prev;
     _providerCookie = providerCookie;
 }
コード例 #6
0
 internal ContextCookie(DirectoryRootInfo prev) : this(prev, null)
 {
 }
コード例 #7
0
        private ContextCookie EnterContext(string path)
        {
            ContextCookie cookie = new ContextCookie(_rootInfo, EnterContext());

            if (PSDriveInfo == null && !string.IsNullOrEmpty(path))
            {
                _rootInfo = ParsePSPathRoot(path);
            }

            return cookie;
        }
コード例 #8
0
        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));
        }
コード例 #9
0
 private PSDriveInfo CreateDrive(string name, string description, PSCredential credential, DirectoryRootInfo rootInfo)
 {
     return new DirectoryServiceDriveInfo(name, ProviderInfo, description, credential, rootInfo);
 }
コード例 #10
0
 private PSDriveInfo CreateDrive(PSDriveInfo drive, DirectoryRootInfo rootInfo)
 {
     return CreateDrive(drive.Name, drive.Description, drive.Credential, rootInfo);
 }
コード例 #11
0
 internal ContextCookie(DirectoryRootInfo prev, PscxThreadContext.Cookie?providerCookie)
 {
     _prev           = prev;
     _providerCookie = providerCookie;
 }
コード例 #12
0
 internal ContextCookie(DirectoryRootInfo prev) : this(prev, null)
 {
 }
コード例 #13
0
 private PSDriveInfo CreateDrive(string name, string description, PSCredential credential, DirectoryRootInfo rootInfo)
 {
     return(new DirectoryServiceDriveInfo(name, ProviderInfo, description, credential, rootInfo));
 }
コード例 #14
0
 private PSDriveInfo CreateDrive(PSDriveInfo drive, DirectoryRootInfo rootInfo)
 {
     return(CreateDrive(drive.Name, drive.Description, drive.Credential, rootInfo));
 }