日期:2014-05-18 浏览次数:20918 次
public string BTConvert(short i) { if (i < 0) { return (short.MaxValue + 1 - i).ToString("X2").PadLeft(6, '0'); } else { return i.ToString("X2").PadLeft(6, '0'); } } public short BTConvert(string s) { short i = short.Parse(s, System.Globalization.NumberStyles.HexNumber); if (i < 0) { return (short)(short.MaxValue + 1 - i); } else { return i; } }