本文整理汇总了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;
}
示例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;
}
示例3: AttachmentFileInfo
public AttachmentFileInfo(ISDataClient client, bool formMode, IDirectoryInfo directory, Attachment attachment)
: base(directory)
{
_client = client;
_formMode = formMode;
_attachment = attachment;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例9: TryToCreateDirectory
public bool TryToCreateDirectory(IDirectoryInfo directory)
{
if (directory.Exists)
return false;
directory.Create();
return true;
}
示例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;
}
示例11: ZipFileInfo
public ZipFileInfo(IDirectoryInfo parentDir, string zipPath, ZipEntry entry)
{
_parentDir = parentDir;
_zipPath = zipPath;
_fullPath = entry.Name;
_lastModifiedTime = entry.DateTime;
_size = entry.Size;
}
示例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
}
示例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;
}
示例14: ExtractedZipEntryAsFileInfo
public ExtractedZipEntryAsFileInfo (ZipFile zipFile, ZipEntry zipEntry, IDirectoryInfo directory)
{
ArgumentUtility.CheckNotNull ("zipFile", zipFile);
ArgumentUtility.CheckNotNull ("zipEntry", zipEntry);
_zipFile = zipFile;
_zipEntry = zipEntry;
_directory = directory;
}
示例15: RepositoryRootDeletedDetection
public RepositoryRootDeletedDetection(IDirectoryInfo localRootPath) {
if (localRootPath == null) {
throw new ArgumentNullException();
}
this.path = localRootPath;
this.absolutePath = this.path.FullName;
this.isRootFolderAvailable = this.IsRootFolderAvailable();
}