本文整理汇总了C#中IFileSystem.Load方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystem.Load方法的具体用法?C# IFileSystem.Load怎么用?C# IFileSystem.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FakeItEasyMockFactory
/// <summary>
/// Initializes a new instance of the <see cref="FakeItEasyMockFactory"/> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <exception cref="System.InvalidOperationException">Unable to find Type FakeItEasy.A in assembly + assembly.Location</exception>
public FakeItEasyMockFactory(IFileSystem fileSystem)
{
var assembly = fileSystem.Load("FakeItEasy");
_mockOpenType = fileSystem.GetTypeFrom(assembly, "FakeItEasy.A");
if (_mockOpenType == null)
throw new InvalidOperationException("Unable to find Type FakeItEasy.A in assembly " + assembly.Location);
}
示例2: NSubstituteMockFactory
/// <summary>
/// Initializes a new instance of the <see cref="NSubstituteMockFactory"/> class.
/// </summary>
/// <param name="fileSystem">The file system wrapper.</param>
/// <exception cref="System.InvalidOperationException">Unable to find Type NSubstitute.Substitute in assembly + assembly.Location</exception>
public NSubstituteMockFactory(IFileSystem fileSystem)
{
var assembly = fileSystem.Load("NSubstitute");
_mockOpenType = fileSystem.GetTypeFrom(assembly, "NSubstitute.Substitute");
if (_mockOpenType == null)
throw new InvalidOperationException("Unable to find Type NSubstitute.Substitute in assembly " + assembly.Location);
}
示例3: CopyFromIndex
private void CopyFromIndex(
string indexFile,
string targetFolder,
IFileSystem fileSystem,
ILogger logger,
IIntegrationResult result)
{
var basePath = Path.GetDirectoryName(indexFile);
using (var reader = fileSystem.Load(indexFile))
{
XDocument document = null;
try
{
document = XDocument.Load(reader);
}
catch (Exception error)
{
throw new CruiseControlException(
"Unable to load index file - " + error.Message ?? string.Empty,
error);
}
var rootEl = document.Element("ReportResources");
if (rootEl == null)
{
throw new CruiseControlException("Unable to load contents manifest - unable to find root node");
}
var files = new List<string>();
foreach (var fileEl in rootEl.Elements("File"))
{
var fullPath = fileEl.Value;
if (!Path.IsPathRooted(fullPath))
{
fullPath = Path.Combine(basePath, fileEl.Value);
}
files.Add(fullPath);
}
foreach (var folder in rootEl.Elements("Directory"))
{
var fullPath = folder.Value;
if (!Path.IsPathRooted(fullPath))
{
fullPath = Path.Combine(basePath, fullPath);
}
files.AddRange(fileSystem.GetFilesInDirectory(fullPath, true));
}
var baseLength = basePath.Length;
foreach (var file in files)
{
logger.Info("Copying file '{0}' to '{1}'", file, targetFolder);
var targetFile = file.StartsWith(basePath) ?
file.Substring(baseLength) :
Path.GetFileName(file);
result.BuildProgressInformation.AddTaskInformation(
string.Format(CultureInfo.CurrentCulture, "Copying file '{0}' to '{1}'", targetFile, targetFolder));
fileSystem.Copy(file, Path.Combine(targetFolder, targetFile));
}
}
}