Ejemplo n.º 1
0
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        public Echoer(IDataLister destination)
        {
            if (null == destination)
            {
                throw new ArgumentNullException("destination");
            }

            this.destination = destination;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        public Echoer(IDataLister destination)
        {
            if (null == destination)
            {
                throw new ArgumentNullException("destination");
            }

            this.destination = destination;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="config">Configuration Values</param>
        public Synchronizer(IConfigValues config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            if (null == config.Source)
            {
                throw new ArgumentNullException("source");
            }
            if (null == config.Destination)
            {
                throw new ArgumentNullException("destination");
            }
            if (Direction.Unknown == config.Direction)
            {
                throw new ArgumentException("Invalid Direction.");
            }

            switch (config.Direction)
            {
            case Direction.BlobToBlob:
                this.lister = new BlobReader(config.Source.ContainerName, config.Source.ConnectionString);
                this.writer = new BlobWriter(config.Destination.ContainerName, config.Destination.ConnectionString, config.CreateSnapshot);
                break;

            case Direction.BlobToFolder:
                this.lister = new BlobReader(config.Source.ContainerName, config.Source.ConnectionString);
                this.writer = new FolderWriter(config.Destination.Folder);
                break;

            case Direction.FolderToFolder:
                this.lister = new FolderReader(config.Source.Folder);
                this.writer = new FolderWriter(config.Destination.Folder);
                break;

            case Direction.FolderToBlob:
                this.lister = new FolderReader(config.Source.Folder);
                this.writer = new BlobWriter(config.Destination.ContainerName, config.Destination.ConnectionString);
                break;
            }

            if (config.Echo)
            {
                IDataLister echoLister = null;
                switch (config.Direction)
                {
                case Direction.FolderToBlob:
                case Direction.BlobToBlob:
                    echoLister = new BlobReader(config.Destination.ContainerName, config.Destination.ConnectionString);
                    break;

                case Direction.FolderToFolder:
                case Direction.BlobToFolder:
                    echoLister = new FolderReader(config.Destination.Folder);
                    break;
                }

                this.echoer = new Echoer(echoLister);
            }
        }