Example #1
0
        protected override PSDriveInfo NewDrive(PSDriveInfo drive)
        {
            // Check if the drive object is null.
            if (drive == null)
            {
                WriteError(new ErrorRecord(
                               new ArgumentNullException("drive"),
                               "NullDrive",
                               ErrorCategory.InvalidArgument,
                               null));

                return(null);
            }
            if (String.IsNullOrEmpty(drive.Root))
            {
                WriteError(new ErrorRecord(
                               new ArgumentException("drive.Root"),
                               "NoRoot",
                               ErrorCategory.InvalidArgument,
                               drive));

                return(null);
            }
            NosDBPSDriveInfo noSPSDrive = new NosDBPSDriveInfo(drive);

            return(noSPSDrive);
        }
Example #2
0
        protected override Collection <PSDriveInfo> InitializeDefaultDrives()
        {
            PSDriveInfo              drive    = new PSDriveInfo(ProviderUtil.DRIVE_NAME, this.ProviderInfo, ProviderUtil.DRIVE_ROOT, "", null);
            NosDBPSDriveInfo         nosdrive = new NosDBPSDriveInfo(drive);
            Collection <PSDriveInfo> drives   = new Collection <PSDriveInfo>()
            {
                nosdrive
            };

            return(drives);
        }
Example #3
0
        protected override PSDriveInfo RemoveDrive(PSDriveInfo drive)
        {
            if (drive == null)
            {
                WriteError(new ErrorRecord(
                               new ArgumentNullException("drive"),
                               "NullDrive",
                               ErrorCategory.InvalidArgument,
                               drive));
                return(null);
            }
            NosDBPSDriveInfo noSDrive = drive as NosDBPSDriveInfo;

            return(noSDrive);
        }