Ejemplo n.º 1
0
        private static List <TransferItem> GetTransformItemsForAllDirTransferDirections(bool resume)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllDirectoryValidDirections())
            {
                string dirName = GetTransferDirName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                DirNode dirNode = directoryNodes[dirName];

                dynamic options = DMLibTestBase.GetDefaultTransferDirectoryOptions(direction.SourceType, direction.DestType);
                options.Recursive = true;

                TransferItem item = new TransferItem()
                {
                    SourceObject        = sourceAdaptor.GetTransferObject(string.Empty, dirNode),
                    DestObject          = destAdaptor.GetTransferObject(string.Empty, dirNode),
                    SourceType          = direction.SourceType,
                    DestType            = direction.DestType,
                    CopyMethod          = direction.CopyMethod,
                    IsDirectoryTransfer = true,
                    Options             = options,
                    TransferContext     = new DirectoryTransferContext()
                    {
                        SetAttributesCallbackAsync = AllTransferDirectionTest.SetAttributesCallbackMethodAsync
                    }
                };

                allItems.Add(item);
            }

            return(allItems);
        }
Ejemplo n.º 2
0
        private static List <TransferItem> GetTransformItemsForAllSingleTransferDirections(bool resume)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllValidDirections())
            {
                if (resume && (direction.SourceType == DMLibDataType.Stream || direction.DestType == DMLibDataType.Stream))
                {
                    continue;
                }

                string fileName = GetTransferFileName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                FileNode     fileNode = singleObjectNodes[fileName];
                TransferItem item     = new TransferItem()
                {
                    SourceObject    = sourceAdaptor.GetTransferObject(string.Empty, fileNode),
                    DestObject      = destAdaptor.GetTransferObject(string.Empty, fileNode),
                    SourceType      = direction.SourceType,
                    DestType        = direction.DestType,
                    CopyMethod      = direction.CopyMethod,
                    TransferContext = new SingleTransferContext()
                    {
                        SetAttributesCallbackAsync = AllTransferDirectionTest.SetAttributesCallbackMethodAsync
                    }
                };
                allItems.Add(item);
            }

            return(allItems);
        }
        private static List <TransferItem> GetTransformItemsForAllDirections(bool resume)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllValidDirections())
            {
                if (resume && (direction.SourceType == DMLibDataType.Stream || direction.DestType == DMLibDataType.Stream))
                {
                    continue;
                }

                string fileName = GetTransferFileName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                FileNode     fileNode = singleObjectNodes[fileName];
                TransferItem item     = new TransferItem()
                {
                    SourceObject  = sourceAdaptor.GetTransferObject(string.Empty, fileNode),
                    DestObject    = destAdaptor.GetTransferObject(string.Empty, fileNode),
                    SourceType    = direction.SourceType,
                    DestType      = direction.DestType,
                    IsServiceCopy = direction.IsAsync,
                };
                allItems.Add(item);
            }

            foreach (DMLibTransferDirection direction in GetAllDirectoryValidDirections())
            {
                string dirName = GetTransferDirName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                DirNode dirNode = directoryNodes[dirName];

                dynamic options = DMLibTestBase.GetDefaultTransferDirectoryOptions(direction.SourceType, direction.DestType);
                options.Recursive = true;

                TransferItem item = new TransferItem()
                {
                    SourceObject        = sourceAdaptor.GetTransferObject(string.Empty, dirNode),
                    DestObject          = destAdaptor.GetTransferObject(string.Empty, dirNode),
                    SourceType          = direction.SourceType,
                    DestType            = direction.DestType,
                    IsServiceCopy       = direction.IsAsync,
                    IsDirectoryTransfer = true,
                    Options             = options,
                };

                allItems.Add(item);
            }

            return(allItems);
        }
        private List <TransferItem> GetTransformItemsForAllDirections(Dictionary <string, FileNode> fileNodes)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllValidDirections())
            {
                string fileName = GetTransferFileName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                FileNode     fileNode = fileNodes[fileName];
                TransferItem item     = new TransferItem()
                {
                    SourceObject  = sourceAdaptor.GetTransferObject(fileNode),
                    DestObject    = destAdaptor.GetTransferObject(fileNode),
                    SourceType    = direction.SourceType,
                    DestType      = direction.DestType,
                    IsServiceCopy = direction.IsAsync,
                };
                allItems.Add(item);
            }

            return(allItems);
        }