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


C# IFileSystem.Load方法代码示例

本文整理汇总了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);
 }
开发者ID:AlexKeySmith,项目名称:Specify,代码行数:12,代码来源:FakeItEasyMockFactory.cs

示例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);
 }
开发者ID:AlexKeySmith,项目名称:Specify,代码行数:12,代码来源:NSubstituteMockFactory.cs

示例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));
                }
            }

        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:65,代码来源:MergeFilesTask.cs


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