public static int Write(string value, int maxCharCount, bool unicode, byte[] buffer, int offset) { int num = Math.Min(value.Length, maxCharCount); if (!unicode) { for (int i = 0; i < num; i++) { buffer[offset++] = ((value[i] < '\u0080') ? ((byte)value[i]) : 63); } buffer[offset++] = 0; return(num + 1); } int bytes = CTSGlobals.UnicodeEncoding.GetBytes(value, 0, num, buffer, offset); return(bytes + ExBitConverter.Write(0, buffer, offset + bytes)); }
public static int Write(string value, bool unicode, byte[] buffer, int offset) { return(ExBitConverter.Write(value, value.Length, unicode, buffer, offset)); }
public static int Write(char value, byte[] buffer, int offset) { return(ExBitConverter.Write((short)value, buffer, offset)); }
public unsafe static int Write(double value, byte[] buffer, int offset) { return(ExBitConverter.Write(*(long *)(&value), buffer, offset)); }
public unsafe static int Write(float value, byte[] buffer, int offset) { return(ExBitConverter.Write(*(int *)(&value), buffer, offset)); }
public static int Write(ulong value, byte[] buffer, int offset) { return(ExBitConverter.Write((long)value, buffer, offset)); }
public static int Write(long value, byte[] buffer, int offset) { ExBitConverter.Write((int)value, buffer, offset); ExBitConverter.Write((int)(value >> 32), buffer, offset + 4); return(8); }