本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例6: SetUp
public void SetUp()
{
file = Substitute.For<IFile>();
file.Exists(Arg.Any<string>()).Returns(true);
resolver = new SolutionFileNamespaceResolver(file);
}