本文整理匯總了C#中ROMVault2.RvDB.RvDir.Read方法的典型用法代碼示例。如果您正苦於以下問題:C# RvDir.Read方法的具體用法?C# RvDir.Read怎麽用?C# RvDir.Read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROMVault2.RvDB.RvDir
的用法示例。
在下文中一共展示了RvDir.Read方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Read
public static void Read(object sender, DoWorkEventArgs e)
{
Bgw = sender as BackgroundWorker;
Program.SyncCont = e.Argument as SynchronizationContext;
if (!File.Exists(Settings.CacheFile))
{
OpenDefaultDB();
Bgw = null;
Program.SyncCont = null;
return;
}
DirTree = new RvDir(FileType.Dir);
FileStream fs = new FileStream(Settings.CacheFile, FileMode.Open, FileAccess.Read);
if (fs.Length < 4)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
BinaryReader br = new BinaryReader(fs);
if (Bgw != null)
Bgw.ReportProgress(0, new bgwSetRange((int)fs.Length));
DBVersion.VersionNow = br.ReadInt32();
if (DBVersion.VersionNow != DBVersion.Version)
{
ReportError.Show(Resources.DB_Read_Data_Cache_version_is_out_of_date_you_should_now_rescan_your_dat_directory_and_roms_directory_);
OpenDefaultDB();
}
else
{
DirTree.Read(br, null);
}
if (fs.Position > fs.Length - 8)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
ulong testEOF = br.ReadUInt64();
if (testEOF != EndCacheMarker)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
br.Close();
fs.Close();
fs.Dispose();
Bgw = null;
Program.SyncCont = null;
}