当前位置: 首页>>代码示例>>C#>>正文


C# IDirectoryInfo类代码示例

本文整理汇总了C#中IDirectoryInfo的典型用法代码示例。如果您正苦于以下问题:C# IDirectoryInfo类的具体用法?C# IDirectoryInfo怎么用?C# IDirectoryInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IDirectoryInfo类属于命名空间,在下文中一共展示了IDirectoryInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LibraryFileInfo

 public LibraryFileInfo(ISDataClient client, bool formMode, IDirectoryInfo directory, LibraryDocument document)
     : base(directory)
 {
     _client = client;
     _formMode = formMode;
     _document = document;
 }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:LibraryFileInfo.cs

示例2: CopyDirectory

        private static IDirectoryInfo CopyDirectory(IDirectoryInfo source, IDirectoryInfo destination)
        {
            var targetDir = destination.GetDirectories().FirstOrDefault(dir => string.Equals(dir.Name, source.Name, StringComparison.OrdinalIgnoreCase))
                            ?? destination.CreateSubdirectory(source.Name);

            foreach (var sourceFile in source.GetFiles())
            {
                var name = sourceFile.Name;
                var targetFile = targetDir.GetFiles().FirstOrDefault(item => string.Equals(item.Name, name, StringComparison.OrdinalIgnoreCase))
                                 ?? destination.DriveInfo.GetFileInfo(Path.Combine(targetDir.FullName, name));

                using (var input = sourceFile.Open(FileMode.Open, FileAccess.Read))
                using (var output = targetFile.Open(FileMode.OpenOrCreate, FileAccess.Write))
                {
                    input.CopyTo(output);
                }
            }

            foreach (var subSource in source.GetDirectories())
            {
                CopyDirectory(subSource, targetDir);
            }

            return targetDir;
        }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:25,代码来源:MainForm.cs

示例3: AttachmentFileInfo

 public AttachmentFileInfo(ISDataClient client, bool formMode, IDirectoryInfo directory, Attachment attachment)
     : base(directory)
 {
     _client = client;
     _formMode = formMode;
     _attachment = attachment;
 }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:AttachmentFileInfo.cs

示例4: CreateDirectory

        /// <summary>
        /// Creates the specified directory in the target directory.
        /// </summary>
        /// <param name="sourceDirectory">The source directory.</param>
        /// <param name="targetDirectory">The target directory.</param>
        /// <exception cref="AccessException">The directory could not be accessed.</exception>
        public void CreateDirectory(IDirectoryInfo sourceDirectory, IDirectoryInfo targetDirectory)
        {
            sourceDirectory.ThrowIfNull(() => sourceDirectory);
            targetDirectory.ThrowIfNull(() => targetDirectory);

            try
            {
                Directory.CreateDirectory(this.CombinePath(targetDirectory.FullName, sourceDirectory.Name));
            }

            catch (DirectoryNotFoundException ex)
            {
                throw new AccessException("The file could not be accessed.", ex);
            }

            catch (PathTooLongException ex)
            {
                throw new AccessException("The file could not be accessed.", ex);
            }

            catch (IOException ex)
            {
                throw new AccessException("The file could not be accessed.", ex);
            }

            catch (UnauthorizedAccessException ex)
            {
                throw new AccessException(ex.Message, ex);
            }
        }
开发者ID:SmartFire,项目名称:FlagSync,代码行数:36,代码来源:LocalFileSystem.cs

示例5: DescendantsTreeBuilder

        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Producer.Crawler.DescendantsTreeBuilder"/> class.
        /// </summary>
        /// <param name='storage'>
        /// The MetadataStorage.
        /// </param>
        /// <param name='remoteFolder'>
        /// Remote folder.
        /// </param>
        /// <param name='localFolder'>
        /// Local folder.
        /// </param>
        /// <param name='filter'>
        /// Aggregated Filters.
        /// </param>
        /// <exception cref='ArgumentNullException'>
        /// <attribution license="cc4" from="Microsoft" modified="false" /><para>The exception that is thrown when a
        /// null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. </para>
        /// </exception>
        public DescendantsTreeBuilder(
            IMetaDataStorage storage,
            IFolder remoteFolder,
            IDirectoryInfo localFolder,
            IFilterAggregator filter,
            IIgnoredEntitiesStorage ignoredStorage)
        {
            if (remoteFolder == null) {
                throw new ArgumentNullException("remoteFolder");
            }

            if (localFolder == null) {
                throw new ArgumentNullException("localFolder");
            }

            if (storage == null) {
                throw new ArgumentNullException("storage");
            }

            if (filter == null) {
                throw new ArgumentNullException("filter");
            }

            if (ignoredStorage == null) {
                throw new ArgumentNullException("ignoredStorage");
            }

            this.storage = storage;
            this.remoteFolder = remoteFolder;
            this.localFolder = localFolder;
            this.filter = filter;
            this.matcher = new PathMatcher(localFolder.FullName, remoteFolder.Path);
            this.ignoredStorage = ignoredStorage;
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:53,代码来源:DescendantsTreeBuilder.cs

示例6: DescendantsCrawler

        /// <summary>
        /// Initializes a new instance of the <see cref="DescendantsCrawler"/> class.
        /// </summary>
        /// <param name="queue">Sync Event Queue.</param>
        /// <param name="remoteFolder">Remote folder.</param>
        /// <param name="localFolder">Local folder.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="filter">Aggregated filter.</param>
        /// <param name="activityListener">Activity listner.</param>
        public DescendantsCrawler(
            ISyncEventQueue queue,
            IFolder remoteFolder,
            IDirectoryInfo localFolder,
            IMetaDataStorage storage,
            IFilterAggregator filter,
            IActivityListener activityListener,
            IIgnoredEntitiesStorage ignoredStorage)
            : base(queue)
        {
            if (remoteFolder == null) {
                throw new ArgumentNullException("remoteFolder");
            }

            if (localFolder == null) {
                throw new ArgumentNullException("localFolder");
            }

            if (storage == null) {
                throw new ArgumentNullException("storage");
            }

            if (filter == null) {
                throw new ArgumentNullException("filter");
            }

            if (activityListener == null) {
                throw new ArgumentNullException("activityListener");
            }

            this.activityListener = activityListener;
            this.treebuilder = new DescendantsTreeBuilder(storage, remoteFolder, localFolder, filter, ignoredStorage);
            this.eventGenerator = new CrawlEventGenerator(storage);
            this.notifier = new CrawlEventNotifier(queue);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:44,代码来源:DescendantsCrawler.cs

示例7: DirectoryCreationEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="DirectoryCreationEventArgs"/> class.
        /// </summary>
        /// <param name="directory">The directory.</param>
        /// <param name="targetDirectory">The target directory.</param>
        public DirectoryCreationEventArgs(IDirectoryInfo directory, IDirectoryInfo targetDirectory)
        {
            directory.ThrowIfNull(() => directory);
            targetDirectory.ThrowIfNull(() => targetDirectory);

            this.Directory = directory;
            this.TargetDirectory = targetDirectory;
        }
开发者ID:SmartFire,项目名称:FlagSync,代码行数:13,代码来源:DirectoryCreationEventArgs.cs

示例8: CrawlRequestEvent

        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Events.CrawlRequestEvent"/> class.
        /// </summary>
        /// <param name='localFolder'>
        /// Local folder.
        /// </param>
        /// <param name='remoteFolder'>
        /// Remote folder.
        /// </param>
        public CrawlRequestEvent(IDirectoryInfo localFolder, IFolder remoteFolder) {
            if (localFolder == null) {
                throw new ArgumentNullException("localFolder");
            }

            this.RemoteFolder = remoteFolder;
            this.LocalFolder = localFolder;
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:17,代码来源:CrawlRequestEvent.cs

示例9: TryToCreateDirectory

        public bool TryToCreateDirectory(IDirectoryInfo directory)
        {
            if (directory.Exists)
                return false;

            directory.Create();
            return true;
        }
开发者ID:OpenSharp,项目名称:UnitWrappers,代码行数:8,代码来源:DirectoryInfoSample.cs

示例10: FileCopyErrorEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="FileCopyErrorEventArgs"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="targetDirectory">The target directory.</param>
        public FileCopyErrorEventArgs(IFileInfo file, IDirectoryInfo targetDirectory)
        {
            file.ThrowIfNull(() => file);
            targetDirectory.ThrowIfNull(() => targetDirectory);

            this.File = file;
            this.TargetDirectory = targetDirectory;
        }
开发者ID:dineshkummarc,项目名称:FlagSync,代码行数:13,代码来源:FileCopyErrorEventArgs.cs

示例11: ZipFileInfo

 public ZipFileInfo(IDirectoryInfo parentDir, string zipPath, ZipEntry entry)
 {
     _parentDir = parentDir;
     _zipPath = zipPath;
     _fullPath = entry.Name;
     _lastModifiedTime = entry.DateTime;
     _size = entry.Size;
 }
开发者ID:amirsalah,项目名称:moonview,代码行数:8,代码来源:ZipFileInfo.cs

示例12: RarFileInfo

 public RarFileInfo(IDirectoryInfo parentDir, string rarPath, Schematrix.RARFileInfo rarFileInfo)
 {
     _parentDir = parentDir;
     _rarPath = rarPath; //The rar archive file path
     _lastModifiedTime = rarFileInfo.FileTime;
     _size = rarFileInfo.UnpackedSize;
     _filePath = rarFileInfo.FileName; //Path of the file within the rar archive
 }
开发者ID:amirsalah,项目名称:moonview,代码行数:8,代码来源:RarFileInfo.cs

示例13: GetDirectories

        /// <summary>
        /// Gets the directories of the original instance wrapped by new DirectoryInfoWrapper instances.
        /// </summary>
        /// <returns>The directories.</returns>
        public IDirectoryInfo[] GetDirectories() {
            DirectoryInfo[] originalDirs = this.original.GetDirectories();
            IDirectoryInfo[] wrappedDirs = new IDirectoryInfo[originalDirs.Length];
            for (int i = 0; i < originalDirs.Length; i++) {
                wrappedDirs[i] = new DirectoryInfoWrapper(originalDirs[i]);
            }

            return wrappedDirs;
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:13,代码来源:DirectoryInfoWrapper.cs

示例14: ExtractedZipEntryAsFileInfo

    public ExtractedZipEntryAsFileInfo (ZipFile zipFile, ZipEntry zipEntry, IDirectoryInfo directory)
    {
      ArgumentUtility.CheckNotNull ("zipFile", zipFile);
      ArgumentUtility.CheckNotNull ("zipEntry", zipEntry);

      _zipFile = zipFile;
      _zipEntry = zipEntry;
      _directory = directory;
    }
开发者ID:FlorianDecker,项目名称:IO-ReleaseProcessScriptTest,代码行数:9,代码来源:ExtractedZipEntryAsFileInfo.cs

示例15: RepositoryRootDeletedDetection

        public RepositoryRootDeletedDetection(IDirectoryInfo localRootPath) {
            if (localRootPath == null) {
                throw new ArgumentNullException();
            }

            this.path = localRootPath;
            this.absolutePath = this.path.FullName;
            this.isRootFolderAvailable = this.IsRootFolderAvailable();
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:9,代码来源:RepositoryRootDeletedDetection.cs


注:本文中的IDirectoryInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。