protected CloudDriveBase(RootName rootName, CloudDriveParameters parameters)
 {
     _rootName   = rootName;
     DisplayRoot = rootName.Value;
     if (parameters != null)
     {
         _apiKey        = parameters.ApiKey;
         _encryptionKey = parameters.EncryptionKey;
     }
     if (string.IsNullOrEmpty(_encryptionKey))
     {
         DisplayRoot = DisplayRoot.Insert(0, "*");
     }
 }
        internal Drive CreateCloudDrive(PSDriveInfo driveInfo, CloudDriveParameters parameters)
        {
            var rootName = CreateRootName(driveInfo);

            var asyncGateway = default(IAsyncCloudGateway);
            if (GatewayManager.TryGetAsyncCloudGatewayForSchema(rootName.Schema, out asyncGateway))
                return new AsyncCloudDrive(CreateDriveInfo(driveInfo), rootName, asyncGateway, parameters);

            var gateway = default(ICloudGateway);
            if (GatewayManager.TryGetCloudGatewayForSchema(rootName.Schema, out gateway))
                return new CloudDrive(CreateDriveInfo(driveInfo), rootName, gateway, parameters);

            throw new KeyNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.NoGatewayForSchema, rootName.Schema));
        }
        protected CloudDriveBase(PSDriveInfo driveInfo, RootName rootName, CloudDriveParameters parameters) : base(driveInfo)
        {
            if (driveInfo == null)
            {
                throw new ArgumentNullException(nameof(driveInfo));
            }

            this.rootName = rootName;
            DisplayRoot   = rootName.Value;
            if (parameters != null)
            {
                apiKey        = parameters.ApiKey;
                encryptionKey = parameters.EncryptionKey;
            }
            if (string.IsNullOrEmpty(encryptionKey))
            {
                DisplayRoot = DisplayRoot.Insert(0, "*");
            }
        }
        internal Drive CreateCloudDrive(PSDriveInfo driveInfo, CloudDriveParameters parameters)
        {
            var rootName = CreateRootName(driveInfo);

            var asyncGateway = default(IAsyncCloudGateway);

            if (GatewayManager.TryGetAsyncCloudGatewayForSchema(rootName.Schema, out asyncGateway))
            {
                return(new AsyncCloudDrive(CreateDriveInfo(driveInfo), rootName, asyncGateway, parameters));
            }

            var gateway = default(ICloudGateway);

            if (GatewayManager.TryGetCloudGatewayForSchema(rootName.Schema, out gateway))
            {
                return(new CloudDrive(CreateDriveInfo(driveInfo), rootName, gateway, parameters));
            }

            throw new KeyNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.NoGatewayForSchema, rootName.Schema));
        }
Example #5
0
 public CloudDrive(RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters)
     : base(rootName, parameters)
 {
     _gateway    = gateway;
     _parameters = parameters.Parameters;
 }
        internal ICloudDrive CreateCloudDrive(string schema, string userName, string root, CloudDriveParameters parameters)
        {
            var rootName     = new RootName(schema, userName, root);
            var asyncGateway = new SAFENetworkGateway(
                parameters.EncryptionKey,
                parameters.Cancellation);

            return(new AsyncCloudDrive(rootName, asyncGateway, parameters));
        }
 public CloudDrive(PSDriveInfo driveInfo, RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters)
 {
     this.gateway = gateway;
 }
Example #8
0
 public FakeCloudDrive(RootName rootName, CloudDriveParameters parameters) : base(rootName, parameters)
 {
 }
 public AsyncCloudDrive(RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters)
 {
     this.gateway    = gateway;
     this.parameters = parameters.Parameters;
 }
 public CloudDrive(PSDriveInfo driveInfo, RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters)
 {
     this.gateway = gateway;
 }
        internal ICloudDrive CreateCloudDrive(string schema, string userName, string root, CloudDriveParameters parameters)
        {
            if (GatewayManager == null)
            {
                throw new InvalidOperationException($"{nameof(GatewayManager)} not initialized".ToString(CultureInfo.CurrentCulture));
            }

            var rootName = new RootName(schema, userName, root);

            var asyncGateway = default(IAsyncCloudGateway);

            if (GatewayManager.TryGetAsyncCloudGatewayForSchema(rootName.Schema, out asyncGateway))
            {
                return(new AsyncCloudDrive(rootName, asyncGateway, parameters));
            }

            var gateway = default(ICloudGateway);

            if (GatewayManager.TryGetCloudGatewayForSchema(rootName.Schema, out gateway))
            {
                return(new CloudDrive(rootName, gateway, parameters));
            }

            throw new KeyNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.NoGatewayForSchema, rootName.Schema));
        }