예제 #1
0
            public FtpRemoteItem(FtpListItem sourceItem, FtpUpdater source, string rootFolder)
            {
                if (sourceItem == null)
                {
                    throw new ArgumentNullException(nameof(sourceItem));
                }
                if (source == null)
                {
                    throw new ArgumentNullException(nameof(source));
                }

                if (rootFolder != null)
                {
                    _rootFolder = rootFolder;
                    if (!sourceItem.FullName.StartsWith(_rootFolder))
                    {
                        throw new IOException($"Remote item full path {sourceItem.FullName} doesn't start with the specified root path {_rootFolder}");
                    }
                    ClientRelativeFileName = sourceItem.FullName.Substring(_rootFolder.Length);
                }

                SourceItem   = sourceItem;
                Source       = source;
                ItemSize     = SourceItem.Size;
                ModifiedTime = GetDate(SourceItem);
            }
예제 #2
0
 public FtpUpdateItem(FtpListItem item, FtpUpdater source, FileSystemInfo targetPath)
 {
     TargetPath   = targetPath ?? throw new ArgumentNullException(nameof(targetPath));
     SourceItem   = item ?? throw new ArgumentNullException(nameof(item));
     _source      = source ?? throw new ArgumentNullException(nameof(source));
     ItemSize     = FileSize.FromBytes(item.Size);
     ModifiedTime = GetDate(SourceItem);
 }