Public feed
#378676
private long getContentEnd(FileInfo imgFile, long end, int testLength)
{
FileStream img = SupportClass.RandomAccessFileSupport.CreateRandomAccessFile(imgFile, "r"); ;
byte[] bytes = { 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,};
int skip = bytes.Length;
int remainTestLength = testLength - skip;
byte[] testByte = new byte[skip];
byte[] byte2 = new byte[remainTestLength];
byte[] testByte2 = new byte[remainTestLength];
for (int i = 0; i < remainTestLength; i++)
byte2[i] = 255;
for (long j = testLength; j < end; j += testLength)
{
img.Seek(j, SeekOrigin.Begin );
Console.WriteLine(j);
img.Read(testByte, 0, testByte.Length);
if ( bytes.Equals(testByte) )
{
img.Read(testByte2, 0, testByte2.Length);
if (byte2.Equals(testByte2))
{
long k = 0L;
do
{
img.Read(testByte, 0, testByte.Length);
img.Read(testByte2, 0, testByte2.Length);
k += testLength;
if (k >= end)
return j;
}
while (k < end && bytes.Equals(testByte) &&
byte2.Equals( testByte2) );
}
}
}
return end;
}