private Int32 FigureCrc32()
{
if (_crcCalculated == false)
{
Stream input = null;
// get the original stream:
if (this._Source == ZipEntrySource.WriteDelegate)
{
var output = new Crisis.Ionic.Crc.CrcCalculatorStream(Stream.Null);
// allow the application to write the data
this._WriteDelegate(this.FileName, output);
_Crc32 = output.Crc;
}
else if (this._Source == ZipEntrySource.ZipFile)
{
// nothing to do - the CRC is already set
}
else
{
if (this._Source == ZipEntrySource.Stream)
{
PrepSourceStream();
input = this._sourceStream;
}
else if (this._Source == ZipEntrySource.JitStream)
{
// allow the application to open the stream
if (this._sourceStream == null)
_sourceStream = this._OpenDelegate(this.FileName);
PrepSourceStream();
input = this._sourceStream;
}
else if (this._Source == ZipEntrySource.ZipOutputStream)
{
}
else
{
//input = File.OpenRead(LocalFileName);
input = File.Open(LocalFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
var crc32 = new Crisis.Ionic.Crc.CRC32();
_Crc32 = crc32.GetCrc32(input);
if (_sourceStream == null)
{
#if NETCF
input.Close();
#else
input.Dispose();
#endif
}
}
_crcCalculated = true;
}
return _Crc32;
}