public void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            CopyFileInternal(fromVirtualPath, destinationVirtualPath);

            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(destinationVirtualPath, fromVirtualPath));
            }
        }
예제 #2
0
        public void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            var source = isp.GetFile(ToRelative(fromVirtualPath));

            WriteFile(destinationVirtualPath, source.OpenRead());

            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(destinationVirtualPath, fromVirtualPath));
            }
        }
예제 #3
0
        /// <summary>Copies a file.</summary>
        /// <param name="fromVirtualPath">The path where the file is located.</param>
        /// <param name="destinationVirtualPath">The path the copy should assume when.</param>
        public virtual void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            string fromPath = MapPath(fromVirtualPath);
            string toPath   = MapPath(destinationVirtualPath);

            File.Copy(fromPath, toPath);

            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(destinationVirtualPath, fromVirtualPath));
            }
        }
예제 #4
0
        public void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            var copyRequest = new CopyObjectRequest()
                              .WithMetaData("Expires", DateTime.Now.AddYears(10).ToString("R"))
                              .WithSourceBucket(this.bucketName)
                              .WithSourceKey(fromVirtualPath)
                              .WithDestinationBucket(this.bucketName)
                              .WithDestinationKey(destinationVirtualPath)
                              .WithCannedACL(S3CannedACL.PublicRead);

            using (this.s3.CopyObject(copyRequest)) { }
            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(FixPathForN2(fromVirtualPath), FixPathForN2(destinationVirtualPath)));
            }
        }
예제 #5
0
        public void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            MongoGridFS mongoGridFs = GetGridFS();

            string fixedDestinationPath = FixPath(destinationVirtualPath);

            mongoGridFs.CopyTo(FixPath(fromVirtualPath), fixedDestinationPath);

            MongoGridFSFileInfo fileInfo = mongoGridFs.FindOne(fixedDestinationPath);

            mongoGridFs.SetMetadata(fileInfo, CreateMetadata(fixedDestinationPath, false));

            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(destinationVirtualPath, fromVirtualPath));
            }
        }
예제 #6
0
        public void CopyFile(string fromVirtualPath, string destinationVirtualPath)
        {
            var source = FileSystemPath.File(fromVirtualPath);
            var target = FileSystemPath.File(destinationVirtualPath);

            var s = Session;

            using (var trx = s.BeginTransaction())
            {
                AssertParentExists(target);

                var file = GetSpecificItem(source);

                var copy = new FileSystemItem
                {
                    Path    = target,
                    Length  = file.Length,
                    Created = Utility.CurrentTime(),
                    Updated = Utility.CurrentTime()
                };

                s.Save(copy);

                foreach (var sourceChunk in GetChunks(file))
                {
                    var chunkCopy = CreateChunk(copy, sourceChunk.Offset, sourceChunk.Data);
                    s.Save(chunkCopy);

                    s.Flush();
                    s.Evict(sourceChunk);
                    s.Evict(chunkCopy);
                }

                trx.Commit();
            }

            if (FileCopied != null)
            {
                FileCopied.Invoke(this, new FileEventArgs(destinationVirtualPath, fromVirtualPath));
            }
        }
예제 #7
0
 private void OnFileCopied(FileEventArgs e)
 {
     FileCopied?.Invoke(this, e);
 }
예제 #8
0
 protected virtual void OnFileCopied(FileCopyEventArgs e)
 {
     FileCopied?.Invoke(this, e);
 }
예제 #9
0
 /// <summary>
 /// Redirects the file copied event
 /// </summary>
 /// <param name="FileName">Name of the file that was copied</param>
 /// <param name="Processed">The amount of processed files</param>
 /// <param name="Total">The total files to process</param>
 private void Copier_FileCopied(String FileName, Int32 Processed, Int32 Total)
 {
     FileCopied?.Invoke(FileName, Processed, Total);
 }