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


C# IFile.Exists方法代码示例

本文整理汇总了C#中IFile.Exists方法的典型用法代码示例。如果您正苦于以下问题:C# IFile.Exists方法的具体用法?C# IFile.Exists怎么用?C# IFile.Exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFile的用法示例。


在下文中一共展示了IFile.Exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     file = Substitute.For<IFile>();
     file.Exists(Arg.Any<string>()).Returns(true);
     registryWriter = Substitute.For<IContextMenuRegistryWriter>();
     installer = new ContextMenuInstaller(file, registryWriter);
 }
开发者ID:faktumsoftware,项目名称:Cloney,代码行数:7,代码来源:ContextMenuInstallerTests.cs

示例2: GetCommandListForFileTask

        public List<ICommand> GetCommandListForFileTask(IFile linkTo, IFile linkFrom, bool copyBeforeDelete, bool overwriteTargetFiles)
        {
            var commandList = new List<ICommand>();

            if (linkTo.Exists())
            {
                if (copyBeforeDelete)
                {
                    var moveFileCommand = _factory.MoveFileCommand(linkTo, linkFrom, overwriteTargetFiles);
                    commandList.Add(moveFileCommand);
                }
                else
                {
                    var delFileCommand = _factory.DeleteFileCommand(linkTo);
                    commandList.Add(delFileCommand);
                }
            }

            commandList.Add(_factory.CreateFileLinkCommand(linkTo, linkFrom));

            return commandList;
        }
开发者ID:DiligentKeyPresser,项目名称:DirLinker,代码行数:22,代码来源:CommandDiscovery.cs

示例3: WaitFor

		void WaitFor(IFile uriFile, TimeSpan timeout)
		{
			var timer = Stopwatch.StartNew();
			while (!uriFile.Exists() && timer.Elapsed < timeout)
				System.Threading.Thread.Sleep(0);
		}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-CodeEditor-Unity-Technologies,代码行数:6,代码来源:IObservableServiceClientProvider.cs

示例4: ResolveDocCommentsLocation

        /// <summary>
        /// Locates the XML doc comment file corresponding to the given
        /// <see cref="System.Reflection.Assembly"/>, in the given directories.
        /// </summary>
        /// 
        /// <param name="assembly">
        /// The assembly whose doc comments are retrieved.
        /// </param>
        /// 
        /// <param name="directories">
        /// The directory names to search.
        /// </param>
        /// 
        /// <param name="fileProxy">
        /// The proxy to the file system.
        /// </param>
        /// 
        /// <returns>
        /// The full path to the requested XML doc comment file, if it exists.
        /// </returns>
        /// 
        /// <exception cref="System.IO.FileNotFoundException">
        /// The XML doc comments file was not found, for the given set of parameters.
        /// </exception>
        private static string ResolveDocCommentsLocation(Assembly assembly, XmlDocCommentDirectoryElementCollection directories, IFile fileProxy)
        {
            string assemblyFileName = assembly.GetName().Name;
            string xmlDocCommentsFilename = String.Concat(assemblyFileName, XmlFileExtension);

            foreach (XmlDocCommentDirectoryElement directory in directories)
            {
                string xmlDocCommentsFullPath = Path.GetFullPath(Path.Combine(directory.Name, xmlDocCommentsFilename));
                if (fileProxy.Exists(xmlDocCommentsFullPath))
                {
                    return xmlDocCommentsFullPath;
                }
            }

            throw new FileNotFoundException(
                String.Format(Resources.Error_XmlDocComments_AssemblyNotResolved, assemblyFileName),
                assemblyFileName);
        }
开发者ID:modulexcite,项目名称:JoltNet-core,代码行数:42,代码来源:XmlDocCommentReader.cs

示例5: XmlDocCommentReader

        /// <summary>
        /// Creates a new instance of the <see cref="XmlDocCommentReader"/> class
        /// with a given path to the XML doc comments, and configures the reader
        /// to use a user-defined read policy.
        /// </summary>
        /// 
        /// <param name="docCommentsFullPath">
        /// The full path of the XML doc comments.
        /// </param>
        /// 
        /// <param name="fileProxy">
        /// The proxy to the file system.
        /// </param>
        /// 
        /// <param name="readPolicy">
        /// The doc comment read policy.
        /// </param>
        /// 
        /// <remarks>
        /// Used internally by test code to override file IO operations.
        /// </remarks>
        /// 
        /// <exception cref="System.IO.FileNotFoundException">
        /// <paramref name="docCommentsFullPath"/> could does not exist or is inaccessible.
        /// </exception>
        internal XmlDocCommentReader(string docCommentsFullPath, IFile fileProxy, IXmlDocCommentReadPolicy readPolicy)
        {
            if (!fileProxy.Exists(docCommentsFullPath))
            {
                throw new FileNotFoundException(
                    String.Format(Resources.Error_XmlDocComments_FileNotFound, docCommentsFullPath),
                    docCommentsFullPath);
            }

            m_fileProxy = fileProxy;
            m_docCommentsFullPath = docCommentsFullPath;
            m_docCommentsReadPolicy = readPolicy;
            m_settings = XmlDocCommentReaderSettings.Default;
        }
开发者ID:modulexcite,项目名称:JoltNet-core,代码行数:39,代码来源:XmlDocCommentReader.cs

示例6: SetUp

 public void SetUp()
 {
     file = Substitute.For<IFile>();
     file.Exists(Arg.Any<string>()).Returns(true);
     resolver = new SolutionFileNamespaceResolver(file);
 }
开发者ID:faktumsoftware,项目名称:Cloney,代码行数:6,代码来源:SolutionFileNamespaceResolverBehavior.cs


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