public override byte[] Serialize(bool partofsomethingelse) { int currentIndex = 0, length = 0; bool hasmetacomponents = false; byte[] thischunk, scratch1, scratch2; List <byte[]> pieces = new List <byte[]>(); GCHandle h; IntPtr ptr; int x__size; //controller_ready thischunk = new byte[1]; thischunk[0] = (byte)((bool)controller_ready ? 1 : 0); pieces.Add(thischunk); //power_on thischunk = new byte[1]; thischunk[0] = (byte)((bool)power_on ? 1 : 0); pieces.Add(thischunk); //operation_mode if (operation_mode == null) { operation_mode = new Messages.motoman_msgs.OperationMode(); } pieces.Add(operation_mode.Serialize(true)); //play_status if (play_status == null) { play_status = new Messages.motoman_msgs.PlayStatus(); } pieces.Add(play_status.Serialize(true)); //cur_job if (cur_job == null) { cur_job = new Messages.motoman_msgs.JobStatus(); } pieces.Add(cur_job.Serialize(true)); //combine every array in pieces into one array and return it int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length); int __a_b__e = 0; byte[] __a_b__d = new byte[__a_b__f]; foreach (var __p__ in pieces) { Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length); __a_b__e += __p__.Length; } return(__a_b__d); }
public override void Deserialize(byte[] serializedMessage, ref int currentIndex) { int arraylength = -1; bool hasmetacomponents = false; int piecesize = 0; byte[] thischunk, scratch1, scratch2; IntPtr h; object __thing; //controller_ready controller_ready = serializedMessage[currentIndex++] == 1; //power_on power_on = serializedMessage[currentIndex++] == 1; //operation_mode operation_mode = new Messages.motoman_msgs.OperationMode(serializedMessage, ref currentIndex); //play_status play_status = new Messages.motoman_msgs.PlayStatus(serializedMessage, ref currentIndex); //cur_job cur_job = new Messages.motoman_msgs.JobStatus(serializedMessage, ref currentIndex); }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //controller_ready controller_ready = rand.Next(2) == 1; //power_on power_on = rand.Next(2) == 1; //operation_mode operation_mode = new Messages.motoman_msgs.OperationMode(); operation_mode.Randomize(); //play_status play_status = new Messages.motoman_msgs.PlayStatus(); play_status.Randomize(); //cur_job cur_job = new Messages.motoman_msgs.JobStatus(); cur_job.Randomize(); }