This commit is contained in:
Kathy Ruffing 2011-01-21 16:00:12 +00:00
parent 84732957e3
commit c175393f85

View File

@ -916,9 +916,33 @@ namespace Volian.Controls.Library
string rofstPath = rdi.FolderPath + @"\ro.fst"; string rofstPath = rdi.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath)) return false; if (!File.Exists(rofstPath)) return false;
FileInfo fiRofst = new FileInfo(rofstPath); FileInfo fiRofst = new FileInfo(rofstPath);
if (roFstInfo.DTS == fiRofst.LastWriteTime) return false;
if (roFstInfo.DTS > fiRofst.LastWriteTime) return false; // if the database Ro.Fst is newer or if the files have identical DTS,
return true; // assume that they are the same file.
if (roFstInfo.DTS >= fiRofst.LastWriteTime) return false;
// next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTime > roFstInfo.DTS;
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes. If
ROFstInfoList fstList = ROFstInfoList.GetBySize(rdi.RODbID, (int)fiRofst.Length);
if (fstList.Count > 0)
{
FileStream fsIn = new FileStream(rofstPath, FileMode.Open, FileAccess.Read, FileShare.Read);
// Create an instance of StreamReader that can read characters from the FileStream.
BinaryReader r = new BinaryReader(fsIn);
byte[] ab = r.ReadBytes((int)fsIn.Length);
fsIn.Close();
foreach (ROFstInfo irofst in fstList)
{
// compare contents by comparing each byte.
for (int i = 0; i < fiRofst.Length; i++)
if (ab[i] != irofst.ROLookup[i]) return true;
}
}
return false;
} }
public void SetUpdRoValBtn(bool en) public void SetUpdRoValBtn(bool en)
{ {