public static string Get(BasicTypeDeSerializerContext context, string text) { byte IsASCII = 0; IsASCII = Get(context); ushort length = 0; length = Get(context, length); if (length != 0) { if (IsASCII == 1) { var bytes = new byte[length]; var index = 0; while (length-- != 0) { bytes[index++] = Get(context); } return(new string(Encoding.UTF8.GetChars(bytes))); } else { var unicodeChars = new char[length]; var index = 0; ushort unicodeChar = 0; while (length-- != 0) { unicodeChars[index++] = (char)Get(context, unicodeChar); } return(new string(unicodeChars)); } } return(""); }
public static UInt16 Get(BasicTypeDeSerializerContext context, UInt16 data) { data = Get(context); data <<= 8; data |= Get(context); return data; }
public static UInt16 Get(BasicTypeDeSerializerContext context, UInt16 data) { data = Get(context); data <<= 8; data |= Get(context); return(data); }
public static Int16 Get(BasicTypeDeSerializerContext context, Int16 data) { UInt16 temp; temp = Get(context); temp <<= 8; temp |= Get(context); return (Int16)temp; }
public static Int16 Get(BasicTypeDeSerializerContext context, Int16 data) { UInt16 temp; temp = Get(context); temp <<= 8; temp |= Get(context); return((Int16)temp); }
public static Int32 Get(BasicTypeDeSerializerContext context, Int32 data) { data = Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); return(data); }
public static Int32 Get(BasicTypeDeSerializerContext context, Int32 data) { data = Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); return data; }
public static byte[] Get(BasicTypeDeSerializerContext context, byte[] bytes) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new byte[length]; var index = 0; while (length-- != 0) { buffer[index++] = Get(context); } return(buffer); } return(null); }
public static unsafe float Get(BasicTypeDeSerializerContext context, float data) { var temp = new byte[4]; if (context.IsLittleEndian) { // Reverse the buffer going from Big Endian (network byte order) to Little Endian temp[3] = context.Retrieve(); temp[2] = context.Retrieve(); temp[1] = context.Retrieve(); temp[0] = context.Retrieve(); } else { // Already in Big Endian format temp[0] = context.Retrieve(); temp[1] = context.Retrieve(); temp[2] = context.Retrieve(); temp[3] = context.Retrieve(); } UInt32 value = Utility.ExtractValueFromArray(temp, 0, 4); return *((float*)&value); }
public static UInt64[] Get(BasicTypeDeSerializerContext context, UInt64[] array) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new UInt64[length]; var index = 0; UInt64 data = 0; while (length-- != 0) { buffer[index++] = Get(context, data); } return(buffer); } return(null); }
public static unsafe float Get(BasicTypeDeSerializerContext context, float data) { var temp = new byte[4]; if (context.IsLittleEndian) { // Reverse the buffer going from Big Endian (network byte order) to Little Endian temp[3] = context.Retrieve(); temp[2] = context.Retrieve(); temp[1] = context.Retrieve(); temp[0] = context.Retrieve(); } else // Already in Big Endian format { temp[0] = context.Retrieve(); temp[1] = context.Retrieve(); temp[2] = context.Retrieve(); temp[3] = context.Retrieve(); } UInt32 value = Utility.ExtractValueFromArray(temp, 0, 4); return(*((float *)&value)); }
private void GetDrawProgressBar(BasicTypeDeSerializerContext context) { ushort x = 0; ushort y = 0; ushort width = 0; ushort height = 0; ushort borderCorners = 0; ushort progressCorners = 0; ushort borderColor = 0; ushort borderFillColor = 0; ushort progressBorderColor = 0; ushort progressFillColor = 0; ushort progress = 0; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); width = BasicTypeDeSerializer.Get(context, width); height = BasicTypeDeSerializer.Get(context, height); borderCorners = BasicTypeDeSerializer.Get(context, borderCorners); progressCorners = BasicTypeDeSerializer.Get(context, progressCorners); borderColor = BasicTypeDeSerializer.Get(context, borderColor); borderFillColor = BasicTypeDeSerializer.Get(context, borderFillColor); progressBorderColor = BasicTypeDeSerializer.Get(context, progressBorderColor); progressFillColor = BasicTypeDeSerializer.Get(context, progressFillColor); progress = BasicTypeDeSerializer.Get(context, progress); DrawProgressBar( x, y, width, height, (RoundedCornerStyle)borderCorners,(RoundedCornerStyle)progressCorners, (BasicColor)borderColor, (BasicColor)borderFillColor, (BasicColor)progressBorderColor, (BasicColor)progressFillColor, progress); }
private void GetDrawPixel(BasicTypeDeSerializerContext context) { ushort x = 0; ushort y = 0; ushort color = 0; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); color = BasicTypeDeSerializer.Get(context, color); DrawPixel(x, y, (BasicColor)color); }
private void GetDrawLineDotted(BasicTypeDeSerializerContext context) { ushort x0 = 0; ushort y0 = 0; ushort x1 = 0; ushort y1 = 0; ushort empty = 0; ushort solid = 0; ushort color = 0; x0 = BasicTypeDeSerializer.Get(context, x0); y0 = BasicTypeDeSerializer.Get(context, y0); x1 = BasicTypeDeSerializer.Get(context, x1); y1 = BasicTypeDeSerializer.Get(context, y1); color = BasicTypeDeSerializer.Get(context, color); empty = BasicTypeDeSerializer.Get(context, empty); solid = BasicTypeDeSerializer.Get(context, solid); DrawLineDotted(x0, y0, x1, y1, empty, solid, (BasicColor)color); }
private void GetDrawIcon16(BasicTypeDeSerializerContext context) { ushort x = 0; ushort y = 0; ushort color = 0; ushort[] icon = null; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); color = BasicTypeDeSerializer.Get(context, color); icon = BasicTypeDeSerializer.Get(context, icon); DrawIcon16(x, y, (BasicColor)color, icon); }
private void GetDrawFill(BasicTypeDeSerializerContext context) { ushort color = 0; color = BasicTypeDeSerializer.Get(context, color); DrawFill((BasicColor)color); }
private void GetDrawString(BasicTypeDeSerializerContext context) { ushort x = 0; ushort y = 0; ushort color = 0; ushort fontInfoID = 0; string text; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); color = BasicTypeDeSerializer.Get(context, color); fontInfoID = BasicTypeDeSerializer.Get(context, fontInfoID); text = BasicTypeDeSerializer.Get(context, ""); DrawString(x, y, (BasicColor)color, FontInfoLookUp(fontInfoID), text); }
public static UInt64[] Get(BasicTypeDeSerializerContext context, UInt64[] array) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new UInt64[length]; var index = 0; UInt64 data = 0; while (length-- != 0) { buffer[index++] = Get(context, data); } return buffer; } return null; }
private void GetDrawCircleFilled(BasicTypeDeSerializerContext context) { ushort xCenter = 0; ushort yCenter = 0; ushort radius = 0; ushort color = 0; xCenter = BasicTypeDeSerializer.Get(context, xCenter); yCenter = BasicTypeDeSerializer.Get(context, yCenter); radius = BasicTypeDeSerializer.Get(context, radius); color = BasicTypeDeSerializer.Get(context, color); DrawCircleFilled(xCenter, yCenter, radius, (BasicColor)color); }
private void GetSetOrientation(BasicTypeDeSerializerContext context) { ushort orientation = 0; orientation = BasicTypeDeSerializer.Get(context, orientation); SetOrientation((LCD.Orientation)orientation); }
private void GetDrawArrow(BasicTypeDeSerializerContext context) { ushort x = 0; ushort y = 0; ushort size = 0; ushort direction = 0; ushort color = 0; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); size = BasicTypeDeSerializer.Get(context, size); direction = BasicTypeDeSerializer.Get(context, direction); color = BasicTypeDeSerializer.Get(context, color); DrawArrow(x, y, size, (DrawingDirection)direction, (BasicColor)color); }
public static byte Get(BasicTypeDeSerializerContext context) { return context.Retrieve(); }
public static Int64 Get(BasicTypeDeSerializerContext context, Int64 data) { return((Int64)Get(context, (UInt64)data)); }
public static Int64 Get(BasicTypeDeSerializerContext context, Int64 data) { return (Int64)Get(context, (UInt64)data); }
private void GetDrawRectangle(BasicTypeDeSerializerContext context) { ushort x0 = 0; ushort y0 = 0; ushort x1 = 0; ushort y1 = 0; ushort color = 0; x0 = BasicTypeDeSerializer.Get(context, x0); y0 = BasicTypeDeSerializer.Get(context, y0); x1 = BasicTypeDeSerializer.Get(context, x1); y1 = BasicTypeDeSerializer.Get(context, y1); color = BasicTypeDeSerializer.Get(context, color); DrawRectangle(x0, y0, x1, y1, (BasicColor)color); }
private void GetDrawCirclePoints(BasicTypeDeSerializerContext context) { ushort cx = 0; ushort cy = 0; ushort x = 0; ushort y = 0; ushort color = 0; cx = BasicTypeDeSerializer.Get(context, cx); cy = BasicTypeDeSerializer.Get(context, cy); x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); color = BasicTypeDeSerializer.Get(context, color); DrawCirclePoints(cx, cy, x, y, (BasicColor)color); }
private void GetDrawRectangleRounded(BasicTypeDeSerializerContext context) { ushort x0 = 0; ushort y0 = 0; ushort x1 = 0; ushort y1 = 0; ushort color = 0; ushort radius = 0; ushort corners = 0; x0 = BasicTypeDeSerializer.Get(context, x0); y0 = BasicTypeDeSerializer.Get(context, y0); x1 = BasicTypeDeSerializer.Get(context, x1); y1 = BasicTypeDeSerializer.Get(context, y1); color = BasicTypeDeSerializer.Get(context, color); radius = BasicTypeDeSerializer.Get(context, radius); corners = BasicTypeDeSerializer.Get(context, corners); DrawRectangleRounded(x0, y0, x1, y1, (BasicColor)color, radius, (RoundedCornerStyle)corners); }
private void GetDrawCornerFilled(BasicTypeDeSerializerContext context) { ushort xCenter = 0; ushort yCenter = 0; ushort radius = 0; ushort position = 0; ushort color = 0; xCenter = BasicTypeDeSerializer.Get(context, xCenter); yCenter = BasicTypeDeSerializer.Get(context, yCenter); radius = BasicTypeDeSerializer.Get(context, radius); position = BasicTypeDeSerializer.Get(context, position); color = BasicTypeDeSerializer.Get(context, color); DrawCornerFilled(xCenter, yCenter, radius, (CornerPosition)position, (BasicColor)color); }
private void GetDrawTriangleFilled(BasicTypeDeSerializerContext context) { ushort x0 = 0; ushort y0 = 0; ushort x1 = 0; ushort y1 = 0; ushort x2 = 0; ushort y2 = 0; ushort color = 0; x0 = BasicTypeDeSerializer.Get(context, x0); y0 = BasicTypeDeSerializer.Get(context, y0); x1 = BasicTypeDeSerializer.Get(context, x1); y1 = BasicTypeDeSerializer.Get(context, y1); x2 = BasicTypeDeSerializer.Get(context, x2); y2 = BasicTypeDeSerializer.Get(context, y2); color = BasicTypeDeSerializer.Get(context, color); DrawTriangleFilled(x0, y0, x1, y1, x2, y2, (BasicColor)color); }
public static string Get(BasicTypeDeSerializerContext context, string text) { byte IsASCII = 0; IsASCII = Get(context); ushort length = 0; length = Get(context, length); if (length != 0) { if (IsASCII == 1) { var bytes = new byte[length]; var index = 0; while (length-- != 0) { bytes[index++] = Get(context); } return new string(Encoding.UTF8.GetChars(bytes)); } else { var unicodeChars = new char[length]; var index = 0; ushort unicodeChar = 0; while (length-- != 0) { unicodeChars[index++] = (char)Get(context, unicodeChar); } return new string(unicodeChars); } } return ""; }
public void Replay(BasicTypeDeSerializerContext context) { if (context == null) throw new ArgumentNullException("context"); byte command = 0; while (context.MoreData) { command = BasicTypeDeSerializer.Get(context); switch ((Command)command) { case Command.DrawTestPattern: DrawTestPattern(); break; case Command.DrawPixel: GetDrawPixel(context); break; case Command.DrawFill: GetDrawFill(context); break; case Command.DrawLine: GetDrawLine(context); break; case Command.DrawLineDotted: GetDrawLineDotted(context); break; case Command.DrawCircle: GetDrawCircle(context); break; case Command.DrawCircleFilled: GetDrawCircleFilled(context); break; case Command.DrawCornerFilled: GetDrawCornerFilled(context); break; case Command.DrawArrow: GetDrawArrow(context); break; case Command.DrawRectangle: GetDrawRectangle(context); break; case Command.DrawRectangleFilled: GetDrawRectangleFilled(context); break; case Command.DrawRectangleRounded: GetDrawRectangleRounded(context); break; case Command.DrawTriangle: GetDrawTriangle(context); break; case Command.DrawTriangleFilled: GetDrawTriangleFilled(context); break; case Command.DrawProgressBar: GetDrawProgressBar(context); break; case Command.DrawButton: GetDrawButton(context); break; case Command.DrawIcon16: GetDrawIcon16(context); break; case Command.DrawString: GetDrawString(context); break; case Command.DrawBitmapImage: throw new NotImplementedException("command"); case Command.DrawCirclePoints: GetDrawCirclePoints(context); break; case Command.SetOrientation: GetSetOrientation(context); break; default: throw new ApplicationException("command"); } } }
public static byte Get(BasicTypeDeSerializerContext context) { return(context.Retrieve()); }
private void GetDrawButton(BasicTypeDeSerializerContext context) { ushort x=0; ushort y=0; ushort width=0; ushort height=0; ushort fontInfoID=0; ushort fontHeight=0; ushort borderColor=0; ushort fillColor=0; ushort fontColor=0; string text; ushort cornerStyle = 0; x = BasicTypeDeSerializer.Get(context, x); y = BasicTypeDeSerializer.Get(context, y); width = BasicTypeDeSerializer.Get(context, width); height = BasicTypeDeSerializer.Get(context, height); fontInfoID = BasicTypeDeSerializer.Get(context, fontInfoID); fontHeight = BasicTypeDeSerializer.Get(context, fontHeight); borderColor = BasicTypeDeSerializer.Get(context, borderColor); fillColor = BasicTypeDeSerializer.Get(context, fillColor); fontColor = BasicTypeDeSerializer.Get(context, fontColor); text = BasicTypeDeSerializer.Get(context, ""); cornerStyle = BasicTypeDeSerializer.Get(context, cornerStyle); DrawButton( x, y, width, height, FontInfoLookUp(fontInfoID), fontHeight, (BasicColor)borderColor, (BasicColor)fillColor, (BasicColor)fontColor, text, (RoundedCornerStyle)cornerStyle); }
public static byte[] Get(BasicTypeDeSerializerContext context, byte[] bytes) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new byte[length]; var index = 0; while (length-- != 0) { buffer[index++] = Get(context); } return buffer; } return null; }