本文整理汇总了C#中IFile类的典型用法代码示例。如果您正苦于以下问题:C# IFile类的具体用法?C# IFile怎么用?C# IFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFile类属于命名空间,在下文中一共展示了IFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Import
public override void Import(IFile fileSystem, string rootPath)
{
string folderPath = GetFolder(rootPath);
string fileFullPath = System.IO.Path.Combine(folderPath, GetExportedFilename());
content = fileSystem.ReadBinary(fileFullPath);
}
开发者ID:FrankNine,项目名称:Heartache,代码行数:7,代码来源:WholeChunk.cs
示例2: ExploreFile
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
{
if ((psiFile.Language.Is<JavaScriptLanguage>() && !psiFile.Language.Is<JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null))
{
psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile())));
}
}
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:7,代码来源:JasmineTestFileExplorer.cs
示例3: FileStream
public FileStream(IFile file)
{
if (file == null)
throw new ArgumentNullException("file");
File = file;
}
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:FileStream.cs
示例4: CreateModelReference
public static ModelReference CreateModelReference(IFile file)
{
var model = LoadModel(file);
var reference = new ModelReference(file.FullPathName, model);
References.Add(reference);
return reference;
}
开发者ID:KonstantinUb,项目名称:sledge,代码行数:7,代码来源:ModelProvider.cs
示例5: Suite
public Suite(IFile systemFile)
{
System = Path.GetFileNameWithoutExtension(systemFile.FullPath);
SystemFile = systemFile;
LastRun = DateTime.MinValue;
}
开发者ID:dolittle,项目名称:Forseti,代码行数:7,代码来源:Suite.cs
示例6: Compile
public string Compile(string source, IFile sourceFile)
{
lock (_lock)
{
rootDirectory = sourceFile.Directory;
Initialize();
StartRecordingOpenedFiles();
dependentFileList.Add(sourceFile.FullPath);
try
{
var compilerOptions = GetCompilerOptions(sourceFile);
return (string)sassCompiler.compile(source, compilerOptions);
}
catch (Exception e)
{
// Provide more information for SassSyntaxErrors
if (e.Message == "Sass::SyntaxError")
{
throw CreateSassSyntaxError(sourceFile, e);
}
else
{
throw;
}
}
finally
{
StopRecordingOpenedFiles();
}
}
}
开发者ID:ryansroberts,项目名称:cassette,代码行数:33,代码来源:SassCompiler.cs
示例7: SetUp
public void SetUp()
{
_file = MockRepository.GenerateMock<IFile>();
_recentActivities = new RecentActivities(_file);
_recentActivities.Update(FIRST_ACTIVITY);
}
开发者ID:archnaut,项目名称:sandbox,代码行数:7,代码来源:RecentActivitiesFixtures.cs
示例8: 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
示例9: Compile
public string Compile(string lessSource, IFile sourceFile)
{
Trace.Source.TraceInformation("Compiling {0}", sourceFile.FullPath);
lock (engine)
{
currentFiles.Clear();
var result = CompileImpl(lessSource, sourceFile);
if (result.Css != null)
{
Trace.Source.TraceInformation("Compiled {0}", sourceFile.FullPath);
return result.Css;
}
else
{
var message = string.Format(
"Less compile error in {0}:\r\n{1}",
sourceFile.FullPath,
result.ErrorMessage
);
Trace.Source.TraceEvent(TraceEventType.Critical, 0, message);
throw new LessCompileException(message);
}
}
}
开发者ID:JamesTryand,项目名称:cassette,代码行数:25,代码来源:LessCompiler.cs
示例10: ExploreFile
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
{
if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC")
return;
psiFile.ProcessDescendants(new XunitFileExplorer(provider, psiFile.GetSourceFile().ToProjectFile(), consumer, interrupted));
}
开发者ID:Eskat0n,项目名称:ReSharper.XUnitTestRunner,代码行数:7,代码来源:XUnitTestFileExplorer.cs
示例11: Post
public OperationResult Post(IFile file)
{
return new OperationResult.SeeOther
{
RedirectLocation = typeof(UploadedFile).CreateUri(new { id = this.ReceiveStream(file.ContentType, file.OpenStream()) })
};
}
开发者ID:endjin,项目名称:openrasta-stable,代码行数:7,代码来源:UploadedFileHandler.cs
示例12: ReplaceLegacyControlTags
private static void ReplaceLegacyControlTags(IFile file)
{
var contents = file.Contents;
var regex = new Regex
(@"(<%@\s*?Register\s+?TagPrefix="")(.+?)(""\s+?Namespace="".+?""\s+?Assembly="")(Subtext.Web.Controls)(""\s*?%>)"
, RegexOptions.IgnoreCase | RegexOptions.Multiline
);
var newContent = regex.Replace(contents, delegate(Match m)
{
if (m.Groups[2].Value.Equals("st", StringComparison.CurrentCultureIgnoreCase))
{
return string.Empty;
}
var sb = new StringBuilder();
sb.Append(m.Groups[1].Value);
sb.Append(m.Groups[2].Value);
sb.Append(m.Groups[3].Value);
sb.Append("Subtext.Web");
sb.Append(m.Groups[5].Value);
return sb.ToString();
});
if (contents != newContent)
{
var stream = new StreamWriter(file.OpenWrite());
stream.Write(newContent);
stream.Close();
}
}
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:33,代码来源:SkinUpgrader.cs
示例13: DecryptToStream
public void DecryptToStream(IFile file, Stream outputStream)
{
if (file == null)
throw new ArgumentNullException(nameof(file));
if (outputStream == null)
throw new ArgumentNullException(nameof(outputStream));
//Read IV
int ivSize = _encryptionProvider.BlockSize / 8;
byte[] iv = new byte[ivSize];
using (Stream fileData = file.Read())
{
fileData.Seek(0, SeekOrigin.Begin);
fileData.Read(iv, 0, iv.Length);
//Write decrypted data
byte[] key = _key.GenerateBlock(_encryptionProvider.BlockSize);
ICryptoTransform decryptor = _encryptionProvider.CreateDecryptor(key, iv);
using (var cryptoStream = new CryptoStream(fileData, decryptor, CryptoStreamMode.Read))
{
cryptoStream.CopyTo(outputStream);
}
}
}
开发者ID:AdrianLThomas,项目名称:altCrypt,代码行数:25,代码来源:StreamEncryptor.cs
示例14: AddFile
/// <summary>
/// Adds a <see cref="IFile"/> to the current <see cref="IDirectory"/>.
/// </summary>
public void AddFile(IFile file)
{
if (_files.Contains(file)) return;
file.Directory = this;
_files.Add(file);
}
开发者ID:jimmah,项目名称:tridion-less-tbb,代码行数:10,代码来源:VirtualDirectory.cs
示例15: Read
public PackageDescriptor Read(IFile filePath)
{
if (!filePath.Exists)
return null;
IOException ioException = null;
int tries = 0;
while (tries < FILE_READ_RETRIES)
{
try
{
using (var fileStream = filePath.OpenRead())
{
var descriptor = Read(fileStream);
if (descriptor.Name == null)
descriptor.Name = PackageNameUtility.GetName(filePath.NameWithoutExtension);
return descriptor;
}
}
catch (IOException ex)
{
ioException = ex;
tries++;
Thread.Sleep(FILE_READ_RETRIES_WAIT);
continue;
}
}
throw ioException;
}
开发者ID:adymitruk,项目名称:openwrap,代码行数:28,代码来源:PackageDescriptorReaderWriter.cs
示例16: ConfigWriter
public ConfigWriter(IFile file, string filePath)
{
mDoc = XDocument.Parse(file.ReadAllText(filePath));
mDoc.Declaration = new XDeclaration("1.0", null, null);
mFile = file;
mPath = filePath;
}
开发者ID:msipe,项目名称:SupaCharge,代码行数:7,代码来源:ConfigWriter.cs
示例17: AcceptElement
public IEnumerable<UnitTestElementDisposition> AcceptElement(IElement element, IFile file)
#endif
{
IDeclaration declaration = (IDeclaration)element;
var behaviorElement = _behaviorFactory.CreateBehavior(declaration.DeclaredElement);
if (behaviorElement == null)
{
yield break;
}
yield return new UnitTestElementDisposition(behaviorElement,
#if RESHARPER_6
file.GetSourceFile().ToProjectFile(),
#else
file.ProjectFile,
#endif
declaration.GetNavigationRange().TextRange,
declaration.GetDocumentRange().TextRange);
var behaviorSpecifications =
_behaviorSpecificationFactory.CreateBehaviorSpecificationsFromBehavior(behaviorElement,
declaration.DeclaredElement);
foreach (var behaviorSpecificationElement in behaviorSpecifications)
{
yield return new UnitTestElementDisposition(new UnitTestElementLocation[0],
behaviorSpecificationElement);
}
}
开发者ID:hhariri,项目名称:machine.specifications,代码行数:30,代码来源:BehaviorElementHandler.cs
示例18: Read
// TODO: Read-retry should be part of an extension method that can be reused for reading the index in indexed folder repositories.
public IPackageDescriptor Read(IFile filePath)
{
if (!filePath.Exists)
return null;
IOException ioException = null;
int tries = 0;
while (tries < FILE_READ_RETRIES)
{
try
{
using (var fileStream = filePath.OpenRead())
{
var descriptor = new PackageDescriptorReader().Read(fileStream);
if (descriptor.Name == null)
descriptor.Name = PackageNameUtility.GetName(filePath.NameWithoutExtension);
return descriptor;
}
}
catch (InvalidPackageException ex)
{
throw new InvalidPackageException(String.Format("Invalid package for file '{0}'.", filePath.Path), ex);
}
catch (IOException ex)
{
ioException = ex;
tries++;
Thread.Sleep(FILE_READ_RETRIES_WAIT);
continue;
}
}
throw ioException;
}
开发者ID:scrummyin,项目名称:openwrap,代码行数:33,代码来源:PackageDescriptorReaderWriter.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: 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
注:本文中的IFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论