This section mainly completes the data of the image file and performs corresponding encoding function according to the requirements: compiled into MMS_Function.dll (CSC / T: library /out;**/mms_function.dll * .cs)
Using system.io; using system.global;
Namespace MMSFUNC {public class test {
Static char [] hexdigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A' , 'B', 'c', 'd', 'e', 'f'};
Private string tohexstring (byte [] bytes) {char [] chars = new char [bytes.length * 2]; for (int i = 0; i {int b = bytes [i]; chars [i * 2] = hexdigits [B >> 4]; Chars [i * 2 1] = HEXDIGITS [B & 0xF];} Return New String (Chars);
public string get_pro (string fname) {FileStream fs = new FileStream (fname, FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader (fs); int nBytes = Convert.ToInt32 (fs.Length); byte [] bArray = New byte [nbytes]; int nbytesread = fs.read (barray, 0, nbytes);
Return tohexstring (barray);}}}