示例#1
0
        public string GetPersonalAccessToken()
        {
            if (!this.UsePersonalAccessToken)
            {
                return(null);
            }

            return(SecureStringHelper.ConvertToString(this.PersonalAccessToken));
        }
示例#2
0
        public DriveInfo(PSDriveInfo driveInfo, DriveParameters driveParameters) : base(driveInfo)
        {
            // Validate root.
            new Uri(this.Root, UriKind.Absolute);
            if (this.Root.Contains(@"\") || this.Root.EndsWith("/"))
            {
                throw new ArgumentException(@"Root must not contain '\' or end with '/'.");
            }

            // Store the drive parameters.
            this.driveParameters = driveParameters;

            // Store the personal access token as secure string and set the unsecure string to null.
            if (!string.IsNullOrEmpty(this.driveParameters.PersonalAccessToken))
            {
                this.PersonalAccessToken = SecureStringHelper.ConvertToSecureString(this.driveParameters.PersonalAccessToken);
                this.driveParameters.PersonalAccessToken = null;
            }
        }