本文整理汇总了C#中IDirectory类的典型用法代码示例。如果您正苦于以下问题:C# IDirectory类的具体用法?C# IDirectory怎么用?C# IDirectory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDirectory类属于命名空间,在下文中一共展示了IDirectory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UrlGenerator
public UrlGenerator(IUrlModifier urlModifier, IDirectory sourceDirectory, string cassetteHandlerPrefix)
{
this.urlModifier = urlModifier;
this.cassetteHandlerPrefix = urlModifier.GetHandlerPrefix(cassetteHandlerPrefix);
this.sourceDirectory = sourceDirectory;
urlModifier.SetSourceDirectory(sourceDirectory);
}
开发者ID:Evengard,项目名称:cassette,代码行数:7,代码来源:UrlGenerator.cs
示例2: Write
public override void Write(Stream output, IDirectory inputDirectory)
{
BinaryWriter writer = new BinaryWriter(output, Encoding.ASCII, true);
const int sbpHeaderSize = 8;
int entityHeaderSize = Entries.Count * SbpEntry.HeaderSize;
int headerSize = sbpHeaderSize + entityHeaderSize;
long headerPosition = output.Position;
output.Position += headerSize;
output.AlignWrite(16, 0x00);
foreach (var entry in Entries)
{
entry.WriteData(output, inputDirectory);
output.AlignWrite(16, 0x00);
}
long endPosition = output.Position;
output.Position = headerPosition;
writer.Write(0x4C504253); // SBPL
writer.Write(Convert.ToByte(Entries.Count));
writer.Write(Convert.ToUInt16(headerSize));
writer.Write((byte)0x00);
foreach (var entry in Entries)
{
entry.Write(output);
}
output.Position = endPosition;
}
开发者ID:engrin,项目名称:GzsTool,代码行数:33,代码来源:SbpFile.cs
示例3: PruneOperation
/// <summary>
/// Initializes a new instance of the <see cref="SelfMediaDatabase.Core.Operations.Prune.PruneOperation"/> class.
/// </summary>
/// <param name="directory">Injection wrapper of <see cref="System.IO.Directory"/>.</param>
/// <param name="file">Injection wrapper of <see cref="System.IO.File"/>.</param>
/// <param name="path">Injection wrapper of <see cref="System.IO.Path"/>.</param>
/// <param name="imageComparer">Image comparer.</param>
/// <param name="fileSystemHelper">Helper to access to files.</param>
public PruneOperation(
IDirectory directory,
IFile file,
IPath path,
IImageComparer imageComparer,
IFileSystemHelper fileSystemHelper,
IDialog dialog,
IRenameOperation renameOperation)
{
if (directory == null)
throw new ArgumentNullException("directory");
if (file == null)
throw new ArgumentNullException("file");
if (imageComparer == null)
throw new ArgumentNullException("imageComparer");
if (fileSystemHelper == null)
throw new ArgumentNullException("fileSystemHelper");
if (path == null)
throw new ArgumentNullException("path");
if (dialog == null)
throw new ArgumentNullException("dialog");
if (renameOperation == null)
throw new ArgumentNullException("renameOperation");
_directory = directory;
_file = file;
_path = path;
_imageComparer = imageComparer;
_fileSystemHelper = fileSystemHelper;
_dialog = dialog;
_renameOperation = renameOperation;
}
开发者ID:crabouif,项目名称:Self-Media-Database,代码行数:40,代码来源:PruneOperation.cs
示例4: UncompressedPackage
public UncompressedPackage(IPackageRepository source,
IFile originalPackageFile,
IDirectory wrapCacheDirectory)
{
Check.NotNull(source, "source");
if (originalPackageFile == null || originalPackageFile.Exists == false)
{
IsValid = false;
return;
}
_originalPackageFile = originalPackageFile;
BaseDirectory = wrapCacheDirectory;
// get the descriptor file inside the package
Source = source;
var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();
if (wrapDescriptor == null)
{
IsValid = false;
return;
}
var versionFile = wrapCacheDirectory.GetFile("version");
_descriptor = new PackageDescriptorReader().Read(wrapDescriptor);
_semver = _descriptor.SemanticVersion ?? _descriptor.Version.ToSemVer();
if (_semver == null)
_semver = versionFile.Exists ? versionFile.ReadString().ToSemVer() : null;
IsValid = string.IsNullOrEmpty(Name) == false && _semver != null;
if (IsValid)
Identifier = new PackageIdentifier(Name, _semver);
}
开发者ID:simonlaroche,项目名称:openwrap,代码行数:33,代码来源:UncompressedPackage.cs
示例5: ProcessSingleBundle
protected Bundle ProcessSingleBundle(IFileHelper fileHelper, IDirectory directory, List<Bundle> bundlesToSort,
Dictionary<string, string> uncachedToCachedFiles, Bundle bundle, AssignHash hasher)
{
Trace.Source.TraceInformation("Processing {0} {1}", bundle.GetType().Name, bundle.Path);
//need to process early to generate an accurate hash.
if (IsCompositeBundle(bundle))
{
bundle.Process(settings);
}
else
{
hasher.Process(bundle, settings);
}
var bundleKey = CassetteSettings.bundles.GetSafeString(Encoding.Default.GetString(bundle.Hash));
if (CassetteSettings.bundles.ContainsKey(fileHelper, directory, uncachedToCachedFiles, bundleKey, bundle))
{
bundle = CassetteSettings.bundles.GetBundle(fileHelper, directory, uncachedToCachedFiles, bundleKey, bundle);
bundlesToSort.Add(bundle);
}
else
{
var unprocessedAssetPaths = CassetteSettings.bundles.GetAssetPaths(bundle);
if (!IsCompositeBundle(bundle))
{
bundle.Process(settings);
}
CassetteSettings.bundles.AddBundle(fileHelper, uncachedToCachedFiles, bundleKey, bundle, unprocessedAssetPaths);
}
return bundle;
}
开发者ID:Zocdoc,项目名称:cassette,代码行数:32,代码来源:BundleContainerFactoryBase.cs
示例6: UncompressedPackage
public UncompressedPackage(IPackageRepository source,
IFile originalPackageFile,
IDirectory wrapCacheDirectory)
{
Check.NotNull(source, "source");
if (originalPackageFile == null || originalPackageFile.Exists == false)
{
IsValid = false;
return;
}
_originalPackageFile = originalPackageFile;
BaseDirectory = wrapCacheDirectory;
// get the descriptor file inside the package
Source = source;
var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();
if (wrapDescriptor == null)
{
IsValid = false;
return;
}
var versionFile = wrapCacheDirectory.GetFile("version");
_descriptor = new PackageDescriptorReaderWriter().Read(wrapDescriptor);
PackageInfo = new DefaultPackageInfo(originalPackageFile.Name,
versionFile.Exists ? versionFile.Read(x => x.ReadString().ToVersion()) : null,
_descriptor);
Identifier = new PackageIdentifier(Name, Version);
IsValid = true;
}
开发者ID:scrummyin,项目名称:openwrap,代码行数:31,代码来源:UncompressedPackage.cs
示例7: FindFiles
/// <summary>
/// Searches the given directory for files matching the search parameters of this object.
/// </summary>
/// <param name="directory">The directory to search.</param>
/// <returns>A collection of files.</returns>
public IEnumerable<IFile> FindFiles(IDirectory directory)
{
return from pattern in GetFilePatterns()
from file in directory.GetFiles(pattern, SearchOption)
where IsAssetFile(file)
select file;
}
开发者ID:JamesTryand,项目名称:cassette,代码行数:12,代码来源:FileSearch.cs
示例8: VirtualDirectory
/// <summary>
/// Creates a new virtual directory.
/// </summary>
/// <param name="name">The name of the directory as it will be seen in the directory.</param>
/// <param name="parent">An <see cref="IDirectory" /> specifying the parent directory. This value should be <c>null</c> if this directory is to be the root directory.</param>
public VirtualDirectory(string name, IDirectory parent)
{
this.name = name;
this.parent = parent;
directories = new Hashtable();
files = new Hashtable();
}
开发者ID:GotenXiao,项目名称:blink1,代码行数:12,代码来源:VirtualDirectory.cs
示例9: CopyAsync
public async Task<IFile> CopyAsync(IDirectory destDirectory)
{
if (!(destDirectory is DirectoryWindowsStore))
throw new InvalidDirectoryException("destDirectory must be of WindowsStore Type");
var storeDirectory = destDirectory as DirectoryWindowsStore;
return new FileWindowsStore(await _storageFile.CopyAsync(storeDirectory.StorageFolder));
}
开发者ID:nukedbit,项目名称:nukedbit-xfile,代码行数:7,代码来源:FileWindowsStore.cs
示例10: BasicStats
// Methods
public BasicStats(string name, IDirectory parent, Dictionary<Guid, User> users)
{
this.name = name;
this.parent = parent;
this.users = users;
this.started = DateTime.UtcNow;
}
开发者ID:cfire24,项目名称:ajaxlife,代码行数:8,代码来源:BasicStats.cs
示例11: WriteData
public void WriteData(BinaryWriter writer, IDirectory inputDirectory)
{
long ftexHeaderPosition = writer.BaseStream.Position;
writer.BaseStream.Position += HeaderSize + Entries.Count * PftxsFtexsFileEntry.HeaderSize;
foreach (var entry in Entries)
{
entry.CalculateHash();
var data = inputDirectory.ReadFile(Hashing.NormalizeFilePath(entry.FilePath));
entry.Offset = Convert.ToInt32(writer.BaseStream.Position - ftexHeaderPosition);
entry.Size = Convert.ToInt32(data.Length);
writer.Write(data);
}
CalculateHash();
long endPosition = writer.BaseStream.Position;
writer.BaseStream.Position = ftexHeaderPosition;
writer.Write(Convert.ToUInt32(0x58455446)); // FTEX
writer.Write(Convert.ToUInt32(endPosition - ftexHeaderPosition)); // Size
writer.Write(Hash);
writer.Write(Convert.ToUInt32(Entries.Count));
writer.Write(0U);
writer.Write(0U);
writer.Write(0U);
foreach (var entry in Entries)
{
entry.Write(writer);
}
writer.BaseStream.Position = endPosition;
}
开发者ID:engrin,项目名称:GzsTool,代码行数:33,代码来源:PftxsFtexFile.cs
示例12: OnFileRequested
/// <summary>
/// Called when the file is requested by a client.
/// </summary>
/// <param name="request">The <see cref="HttpRequest"/> requesting the file.</param>
/// <param name="directory">The <see cref="IDirectory"/> of the parent directory.</param>
public void OnFileRequested(HttpRequest request, IDirectory directory)
{
if(request.IfModifiedSince != DateTime.MinValue)
{
if(File.GetLastWriteTimeUtc(path) < request.IfModifiedSince)
request.Response.ResponseCode = "304";
return;
}
if(request.IfUnmodifiedSince != DateTime.MinValue)
{
if(File.GetLastWriteTimeUtc(path) > request.IfUnmodifiedSince)
request.Response.ResponseCode = "304";
return;
}
if(System.IO.Path.GetFileName(path).StartsWith("."))
{
request.Response.ResponseCode = "403";
return;
}
try
{
request.Response.ResponseContent = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch(FileNotFoundException)
{
request.Response.ResponseCode = "404";
}
catch(IOException e)
{
request.Response.ResponseCode = "500";
request.Server.Log.WriteLine(e);
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:40,代码来源:DriveFile.cs
示例13: OptionsUtils
/// <summary>
/// Initializes a new instance of the <see cref="SelfMediaDatabase.Console.OptionsUtils"/> class.
/// </summary>
/// <param name="directory">Wrapper for <see cref="System.IO.Directory"/>.</param>
public OptionsUtils(IDirectory directory)
{
if (directory == null)
throw new ArgumentNullException("directory");
_directory = directory;
}
开发者ID:crabouif,项目名称:Self-Media-Database,代码行数:11,代码来源:OptionsUtils.cs
示例14: GitDirectory
public GitDirectory(IDirectory parent, string name, DateTime commitTime, Tree tree) : base(parent, name, Enumerable.Empty<IDirectory>(), Enumerable.Empty<IFile>())
{
m_Name = name;
m_CommitTime = commitTime;
m_Tree = tree;
}
开发者ID:ap0llo,项目名称:SyncTool,代码行数:7,代码来源:GitDirectory.cs
示例15: ProcessIsolatedEnvironment
public ProcessIsolatedEnvironment(IDirectory baseDirectory)
{
_baseDirectory = baseDirectory;
_environmentId = Guid.NewGuid().ToString();
_handle = new EventWaitHandle(false, EventResetMode.AutoReset, _environmentId);
_hostProcess = CreateProcess(_environmentId);
}
开发者ID:KyulingLee,项目名称:hadouken,代码行数:7,代码来源:ProcessIsolatedEnvironment.cs
示例16: PrintBody
internal virtual void PrintBody(StreamWriter writer,
HttpRequest request,
IDirectory directory,
ICollection dirs,
ICollection files
)
{
writer.WriteLine("<h2>Index of " + HttpWebServer.GetDirectoryPath(directory) + "</h2>");
if(directory.Parent != null)
writer.WriteLine("<a href=\"..\">[..]</a><br>");
foreach(IDirectory dir in dirs)
{
//if(dir is IPhysicalResource)
// if((File.GetAttributes((dir as IPhysicalResource).Path) & FileAttributes.Hidden) != 0)
// continue;
writer.WriteLine("<a href=\"" + UrlEncoding.Encode(dir.Name) + "/\">[" + dir.Name + "]</a><br>");
}
foreach(IFile file in files)
{
//if(file is IPhysicalResource)
// if((File.GetAttributes((file as IPhysicalResource).Path) & FileAttributes.Hidden) != 0)
// continue;
writer.WriteLine("<a href=\"" + UrlEncoding.Encode(file.Name) + "\">" + file.Name + "</a><br>");
}
}
开发者ID:GotenXiao,项目名称:blink1,代码行数:30,代码来源:IndexPage.cs
示例17: XunitFrameworkProvider_2_0
public XunitFrameworkProvider_2_0(IServiceProvider serviceProvider, IConfigurationSettings configurationSettings, INaming naming, IDirectory directory)
: base(serviceProvider, configurationSettings, naming, directory,
displayName: "xUnit.net 2.0",
xunitPackageVersion: "2.0.0",
xunitCoreAssemblyVersionPrefix: "2.0.0.",
visualStudioRunnerPackageVersion: "2.1.0")
{ }
开发者ID:xunit,项目名称:testextensions.xunit,代码行数:7,代码来源:XunitFrameworkProvider_2_0.cs
示例18: OnFileRequested
/// <summary>
/// Called when the file is requested by a client.
/// </summary>
/// <param name="request">The <see cref="HttpRequest"/> requesting the file.</param>
/// <param name="directory">The <see cref="IDirectory"/> of the parent directory.</param>
public void OnFileRequested(HttpRequest request, IDirectory directory)
{
ICollection dirs;
ICollection files;
try
{
dirs = directory.GetDirectories();
files = directory.GetFiles();
}
catch(UnauthorizedAccessException)
{
throw new HttpRequestException("403");
}
request.Response.BeginChunkedOutput();
StreamWriter writer = new StreamWriter(request.Response.ResponseContent);
writer.WriteLine("<html>");
writer.WriteLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
writer.WriteLine("<head><title>Index of " + HttpWebServer.GetDirectoryPath(directory) + "</title></head>");
writer.WriteLine("<body>");
PrintBody(writer, request, directory, dirs, files);
writer.WriteLine("<hr>" + request.Server.ServerName);
writer.WriteLine("</body></html>");
writer.WriteLine("</body>");
writer.WriteLine("</html>");
writer.Flush();
}
开发者ID:GotenXiao,项目名称:blink1,代码行数:36,代码来源:IndexPage.cs
示例19: CachedZipPackage
public CachedZipPackage(IPackageRepository source, IFile packageFile, IDirectory cacheDirectoryPath, IEnumerable<IExportBuilder> builders)
: base(packageFile)
{
Source = source;
_cacheDirectoryPathPath = cacheDirectoryPath;
_builders = builders;
}
开发者ID:petejohanson,项目名称:openwrap,代码行数:7,代码来源:CachedZipPackage.cs
示例20: LoadConfiguration
/// <summary>
/// Loads configuration for the specified directory and its subdirectories and file using the specified configuration node as parent node
/// </summary>
internal void LoadConfiguration(IConfigurationNode parentNode, IDirectory directory)
{
m_Logger.Info($"Loading configuration for directory '{directory.FullPath}'");
// determine configuration node for directory
IConfigurationNode configNode;
// config file present in directory => create new node
if (directory.FileExists(s_DirectoryConfigName))
{
configNode = new HierarchicalConfigurationNode(parentNode, LoadConfigurationFile(directory.GetFile(s_DirectoryConfigName)));
}
// no config file found => use parent node
else
{
configNode = parentNode;
}
m_Mapper.AddMapping(configNode, directory);
// load configuration for files in the directory
foreach (var file in directory.Files)
{
LoadConfiguration(configNode, file);
}
// load configuration for subdirectories
foreach (var dir in directory.Directories)
{
LoadConfiguration(configNode, dir);
}
}
开发者ID:ap0llo,项目名称:MusicFileCop,代码行数:35,代码来源:ConfigurationLoader.cs
注:本文中的IDirectory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论