public ByteArray GetBytes() { if (writeObject == null) throw new Exception("write object is null"); var byteArray = new ByteArray(); byteArray.WriteObject(writeObject); return byteArray; }
/// <summary> /// AS的int转byte[] /// </summary> /// <param name="i"></param> /// <returns></returns> public static byte[] ASIntToByte(uint i) { ByteArray ba = new ByteArray(); ba.WriteObject(i); byte[] ss = new byte[16]; ba.Position = 1; ba.ReadBytes(ss, 0, (uint)ss.Length); byte[] rs = new byte[ba.Length - 1]; for (int j = 0; j < rs.Length; j++) rs[j] = ss[j]; return rs; }