コード例 #1
0
        private bool TryToTransformSingleFileSource(SingleFileSource source, FilesList filesList)
        {
            if (!_transformations.ContainsKey(source.Id))
            {
                return(false);
            }

            CopyProcessorTransformation transformation = _transformations[source.Id];

            if ((transformation.Options & CopyProcessorTransformationOptions.SingleFile) == 0)
            {
                return(false);
            }

            LocalPath destinationPath = transformation.DestinationPath;

            PackagedFileInfo sourceFile              = source.ListFiles().ToList().First();
            FullPath         destinationFullPath     = _destinationRootDir.CombineWith(destinationPath);
            FileFullPath     destinationFileFullPath = destinationFullPath.ToFileFullPath();

            filesList.AddFile(new PackagedFileInfo(destinationFileFullPath));
            _copier.Copy(sourceFile.FileFullPath, destinationFileFullPath);

            return(true);
        }
コード例 #2
0
ファイル: CopyManager.cs プロジェクト: obrien83/AxelotTest
        /// <summary>
        /// Вызов копировальщика, в соответствие с типом item
        /// </summary>
        /// <param name="items">список объектов для копирования</param>
        /// <param name="dest">каталог назначения</param>
        /// <param name="interval">интервал копирования</param>
        public void Copy(List <Item> items, string dest, int interval, bool isDeleteMode)
        {
            ICopier copier = null;

            foreach (var item in items)
            {
                if (!item.IsHandled)
                {
                    lock (_locker)
                    {
                        item.IsHandled = true;
                        if (item.IsDirectory)
                        {
                            copier = DirectoryRecursiveCopier.GetCopier();
                        }
                        else
                        {
                            copier = FileCopier.GetCopier();
                        }

                        copier.Copy(item.Name, Path.Combine(dest, Path.GetFileName(item.Name)), isDeleteMode);
                        Thread.Sleep(interval);
                    }
                }
            }
        }
コード例 #3
0
        private static void CopyStudentToPerson(Student s, ICopier copier, String message)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Person p = null;

            for (int i = 0; i < NUM_REPETITIONS; ++i)
            {
                p = new Person();
                copier.Copy(s, p);
            }
            // Compare the last one just for sanity check
            Assert.AreEqual(s.Name, p.Name);
            Assert.AreEqual(s.Nr, p.Nr);
            sw.Stop();
            Console.WriteLine("{1} copy took {0}ms", sw.ElapsedMilliseconds, message);
        }
コード例 #4
0
        //using decorator pattern below

        public void Copy(Document document)
        {
            _copier.Copy(document);
        }
コード例 #5
0
ファイル: FastCopy.cs プロジェクト: thild/numpy.net
 public static void Copy(byte[] source, byte[] dest, int offset, uint count)
 {
     _copier.Copy(source, dest, offset, count);
 }
コード例 #6
0
 public async Task <List <Paper> > Copy(Paper paper, int count)
 {
     return(await _copier.Copy(paper, count));
 }
コード例 #7
0
 public void Copy(Student s, Person p)
 {
     dynCopier.Copy(s, p);
 }