本文整理汇总了C#中FileReference.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# FileReference.Delete方法的具体用法?C# FileReference.Delete怎么用?C# FileReference.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReference
的用法示例。
在下文中一共展示了FileReference.Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
/// <summary>
/// Loads the cache from disk
/// </summary>
/// <param name="Cache">The file to load</param>
/// <returns>The loaded instance</returns>
public static FlatCPPIncludeDependencyCache Load(FileReference BackingFile)
{
FlatCPPIncludeDependencyCache Result = null;
try
{
string CacheBuildMutexPath = BackingFile.FullName + ".buildmutex";
// If the .buildmutex file for the cache is present, it means that something went wrong between loading
// and saving the cache last time (most likely the UBT process being terminated), so we don't want to load
// it.
if (!File.Exists(CacheBuildMutexPath))
{
using (File.Create(CacheBuildMutexPath))
{
}
using (BinaryReader Reader = new BinaryReader(new FileStream(BackingFile.FullName, FileMode.Open, FileAccess.Read)))
{
// @todo ubtmake: We can store the cache in a cheaper/smaller way using hash file names and indices into included headers, but it might actually slow down load times
// @todo ubtmake: If we can index PCHs here, we can avoid storing all of the PCH's included headers (PCH's action should have been invalidated, so we shouldn't even have to report the PCH's includes as our indirect includes)
if (Reader.ReadInt32() == FileSignature)
{
Result = Deserialize(Reader);
}
}
}
}
catch (Exception Ex)
{
Console.Error.WriteLine("Failed to read FlatCPPIncludeDependencyCache: {0}", Ex.Message);
BackingFile.Delete();
}
return Result;
}
示例2: Load
/// <summary>
/// Loads the cache from the passed in file.
/// </summary>
/// <param name="Cache">File to deserialize from</param>
public static DependencyCache Load(FileReference CacheFile)
{
DependencyCache Result = null;
try
{
string CacheBuildMutexPath = CacheFile.FullName + ".buildmutex";
// If the .buildmutex file for the cache is present, it means that something went wrong between loading
// and saving the cache last time (most likely the UBT process being terminated), so we don't want to load
// it.
if (!File.Exists(CacheBuildMutexPath))
{
using (File.Create(CacheBuildMutexPath))
{
}
using (BinaryReader Reader = new BinaryReader(new FileStream(CacheFile.FullName, FileMode.Open, FileAccess.Read)))
{
if (Reader.ReadInt32() == FileSignature)
{
Result = DependencyCache.Deserialize(Reader);
}
}
}
}
catch (Exception Ex)
{
Console.Error.WriteLine("Failed to read dependency cache: {0}", Ex.Message);
CacheFile.Delete();
}
return Result;
}