using System;
namespace Shared
{
public class Utlis
{
/////
///// 将int数值转换为占四个字节的byte数组
/////
/////
/////
//public static byte [] IntToByteArray (int i)
//{
// byte [] result = new byte [4];
// // 由高位到低位
// result [0] = (byte)((i >> 24) & 0xFF);
// result [1] = (byte)((i >> 16) & 0xFF);
// result [2] = (byte)((i >> 8) & 0xFF);
// result [3] = (byte)(i & 0xFF);
// return result;
//}
/////
///// byte[]转int
/////
/////
/////
//public static int ByteArrayToInt (byte [] bytes)
//{
// int value = 0;
// // 由高位到低位
// for (int i = 0; i < 4; i++) {
// int shift = (4 - 1 - i) * 8;
// value += (bytes [i] & 0x000000FF) << shift;// 往高位游
// }
// return value;
//}
public static int StringToInt (string mStr) {
try {
return int.Parse (mStr);
} catch {
return 0;
}
}
}
}