コード例 #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);
        }
        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);
        }