SDK
There is one class that is used to calculate checksums. The class is declared
as follow:
-
public class
CRC : System.Object
Enumerations:
CRC.CRCalgorithm - has values that are used to initialize an
instance of the class (pass through the
constructor
or the
Init
function). For details look
here.
Properties:
Methods:
-
Constructor 1
public
CRC
(
CRC.CRCalgorithm
a
)
Parameters:
a
[in] - A member of CRC.CRCalgorithm enumeration (except
CRC_custom). The value is used to initialize the instance of the
class like
Init
function.
-
Constructor 2
public
CRC
()
Internally initializes with the
CRC.CRCalgorithm.CRC32
value
-
Init
public void
Init
(
CRC.CRCalgorithm
a
)
Parameters:
a
[in] - The function is used to initialize an existing instance of class. Can be
called more than once.
-
InitCustom
public void
InitCustom
(
int
variant,
int
width,
uint
poly,
bool
reflectIn,
bool
reflectOut,
uint
xoroutMask,
uint
InitValue
)
Parameters:
variant
[in] - Variant of calculations. Can be 1 or 2.
width
[in] - It is the width of the polynom.
poly
[in] - The polynom's family ( i.e. 0x1021 for CCITT, for example).
reflectIn
[in] - The flag is used to point that all input sequence will be reflected
becore processing.
reflectOut
[in] - The flag is used to point that the result of calculations will be
reflected before it returns.
xoroutMask
[in] - An unsigned number that is XOR'ed with the result before it returns.
InitValue
[in] - It is the initial value of the custom algorithm.
-
crcNext
public void
crcNext
(
System.Byte
ch
)
Parameters:
ch
[in] - The function is used to count passed bytech
into the checksum.
-
GetFileCrc
public System.UInt32
GetFileCrc
(
System.String
FileName
)
Parameters:
FileName
[in] - The name of a file which checksum will be calculated.
-
GetStreamCrc
public System.UInt32
GetStreamCrc
(
System.IO.BinaryReader
binaryReader
)
Parameters:
binaryReader
[in] - A pointer to an instance of BinaryReader that will give bytes for
the checksum calculation.
-
GetStreamCrc
public System.UInt32
GetStreamCrc
(
System.IO.Stream
stream
)
Parameters:
stream
[in] - A pointer to an instance of System.IO.Stream that will give bytes
for the checksum calculation.