B2016-115 the comparison of the contents of RO.FST files would also be seen as different (and loading into memory) even when user created a new RO.fst without making any RO changes. We needed to skip past the RO.FST header information in the file which contains the date/time the FST was created. Also needed to do a garbage collection.
This commit is contained in:
@@ -1079,6 +1079,41 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on RoFstInfoList.GetBySize", ex);
|
||||
}
|
||||
}
|
||||
public static bool ROFstDiffBySize(string rofstPath, int roDbID, int len)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDifferent = false;
|
||||
using (ROFstInfoList tmp = GetBySize(roDbID, len))
|
||||
{
|
||||
if (tmp.Count > 0)
|
||||
{
|
||||
// B2017-078 WCN users with Read only access to the RO FST file where not able to open the file for reading when
|
||||
// another user was accessing the file. Changed FileShare from Read to ReadWrite
|
||||
FileStream fsIn = new FileStream(rofstPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
// Create an instance of StreamReader that can read characters from the FileStream.
|
||||
BinaryReader r = new BinaryReader(fsIn);
|
||||
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
||||
r.Close();
|
||||
fsIn.Close();
|
||||
foreach (ROFstInfo irofst in tmp)
|
||||
{
|
||||
// compare contents by comparing each byte.
|
||||
for (int i = 20; i < len; i++) // this skips past RO.FST header which has the FST creation date/time
|
||||
if (ab[i] != irofst.ROLookup[i]) isDifferent = true;
|
||||
irofst.Dispose();
|
||||
if (isDifferent) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
GC.Collect();
|
||||
return isDifferent;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on RoFstInfoList.ROFstDiffBySize", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(RoFstSizeCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
|
Reference in New Issue
Block a user