public override void Deserialize(byte[] serializedMessage, ref int currentIndex) { int arraylength = -1; bool hasmetacomponents = false; byte[] thischunk, scratch1, scratch2; object __thing; int piecesize = 0; IntPtr h; //display_name display_name = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; display_name = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; //element_path element_path = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; element_path = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; //point point = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex); //transient transient = serializedMessage[currentIndex++] == 1; }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //point point = new Messages.xamlamoveit_msgs.JointValuesPoint(); point.Randomize(); //success success = rand.Next(2) == 1; //error strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate error = Encoding.ASCII.GetString(strbuf); }
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; //solutions hasmetacomponents |= true; if (solutions == null) { solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[0]; } pieces.Add(BitConverter.GetBytes(solutions.Length)); for (int i = 0; i < solutions.Length; i++) { //solutions[i] if (solutions[i] == null) { solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(); } pieces.Add(solutions[i].Serialize(true)); } //error_codes hasmetacomponents |= false; if (error_codes == null) { error_codes = new Messages.moveit_msgs.MoveItErrorCodes[0]; } pieces.Add(BitConverter.GetBytes(error_codes.Length)); for (int i = 0; i < error_codes.Length; i++) { //error_codes[i] if (error_codes[i] == null) { error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes(); } pieces.Add(error_codes[i].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 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; //display_name if (display_name == null) { display_name = ""; } scratch1 = Encoding.ASCII.GetBytes((string)display_name); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); //element_path if (element_path == null) { element_path = ""; } scratch1 = Encoding.ASCII.GetBytes((string)element_path); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); //point if (point == null) { point = new Messages.xamlamoveit_msgs.JointValuesPoint(); } pieces.Add(point.Serialize(true)); //transient thischunk = new byte[1]; thischunk[0] = (byte)((bool)transient ? 1 : 0); pieces.Add(thischunk); //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; //solutions hasmetacomponents |= true; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (solutions == null) { solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength]; } else { Array.Resize(ref solutions, arraylength); } for (int i = 0; i < solutions.Length; i++) { //solutions[i] solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex); } //error_codes hasmetacomponents |= false; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (error_codes == null) { error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength]; } else { Array.Resize(ref error_codes, arraylength); } for (int i = 0; i < error_codes.Length; i++) { //error_codes[i] error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex); } }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //solutions arraylength = rand.Next(10); if (solutions == null) { solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength]; } else { Array.Resize(ref solutions, arraylength); } for (int i = 0; i < solutions.Length; i++) { //solutions[i] solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(); solutions[i].Randomize(); } //error_codes arraylength = rand.Next(10); if (error_codes == null) { error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength]; } else { Array.Resize(ref error_codes, arraylength); } for (int i = 0; i < error_codes.Length; i++) { //error_codes[i] error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes(); error_codes[i].Randomize(); } }
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; //point point = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex); //success success = serializedMessage[currentIndex++] == 1; //error error = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; error = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //group_name strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate group_name = Encoding.ASCII.GetString(strbuf); //joint_names arraylength = rand.Next(10); if (joint_names == null) { joint_names = new string[arraylength]; } else { Array.Resize(ref joint_names, arraylength); } for (int i = 0; i < joint_names.Length; i++) { //joint_names[i] strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate joint_names[i] = Encoding.ASCII.GetString(strbuf); } //seed seed = new Messages.xamlamoveit_msgs.JointValuesPoint(); seed.Randomize(); //const_seed const_seed = rand.Next(2) == 1; //points arraylength = rand.Next(10); if (points == null) { points = new Messages.xamlamoveit_msgs.EndEffectorPoses[arraylength]; } else { Array.Resize(ref points, arraylength); } for (int i = 0; i < points.Length; i++) { //points[i] points[i] = new Messages.xamlamoveit_msgs.EndEffectorPoses(); points[i].Randomize(); } //collision_check collision_check = rand.Next(2) == 1; //attempts attempts = rand.Next(); //timeout timeout = new Duration(new TimeData( Convert.ToInt32(rand.Next()), Convert.ToInt32(rand.Next()))); }
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; //group_name if (group_name == null) { group_name = ""; } scratch1 = Encoding.ASCII.GetBytes((string)group_name); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); //joint_names hasmetacomponents |= false; if (joint_names == null) { joint_names = new string[0]; } pieces.Add(BitConverter.GetBytes(joint_names.Length)); for (int i = 0; i < joint_names.Length; i++) { //joint_names[i] if (joint_names[i] == null) { joint_names[i] = ""; } scratch1 = Encoding.ASCII.GetBytes((string)joint_names[i]); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); } //seed if (seed == null) { seed = new Messages.xamlamoveit_msgs.JointValuesPoint(); } pieces.Add(seed.Serialize(true)); //const_seed thischunk = new byte[1]; thischunk[0] = (byte)((bool)const_seed ? 1 : 0); pieces.Add(thischunk); //points hasmetacomponents |= true; if (points == null) { points = new Messages.xamlamoveit_msgs.EndEffectorPoses[0]; } pieces.Add(BitConverter.GetBytes(points.Length)); for (int i = 0; i < points.Length; i++) { //points[i] if (points[i] == null) { points[i] = new Messages.xamlamoveit_msgs.EndEffectorPoses(); } pieces.Add(points[i].Serialize(true)); } //collision_check thischunk = new byte[1]; thischunk[0] = (byte)((bool)collision_check ? 1 : 0); pieces.Add(thischunk); //attempts scratch1 = new byte[Marshal.SizeOf(typeof(int))]; h = GCHandle.Alloc(scratch1, GCHandleType.Pinned); Marshal.StructureToPtr(attempts, h.AddrOfPinnedObject(), false); h.Free(); pieces.Add(scratch1); //timeout pieces.Add(BitConverter.GetBytes(timeout.data.sec)); pieces.Add(BitConverter.GetBytes(timeout.data.nsec)); //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; byte[] thischunk, scratch1, scratch2; object __thing; int piecesize = 0; IntPtr h; //group_name group_name = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; group_name = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; //joint_names hasmetacomponents |= false; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (joint_names == null) { joint_names = new string[arraylength]; } else { Array.Resize(ref joint_names, arraylength); } for (int i = 0; i < joint_names.Length; i++) { //joint_names[i] joint_names[i] = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; joint_names[i] = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; } //seed seed = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex); //const_seed const_seed = serializedMessage[currentIndex++] == 1; //points hasmetacomponents |= true; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (points == null) { points = new Messages.xamlamoveit_msgs.EndEffectorPoses[arraylength]; } else { Array.Resize(ref points, arraylength); } for (int i = 0; i < points.Length; i++) { //points[i] points[i] = new Messages.xamlamoveit_msgs.EndEffectorPoses(serializedMessage, ref currentIndex); } //collision_check collision_check = serializedMessage[currentIndex++] == 1; //attempts piecesize = Marshal.SizeOf(typeof(int)); h = IntPtr.Zero; if (serializedMessage.Length - currentIndex != 0) { h = Marshal.AllocHGlobal(piecesize); Marshal.Copy(serializedMessage, currentIndex, h, piecesize); } if (h == IntPtr.Zero) { throw new Exception("Memory allocation failed"); } attempts = (int)Marshal.PtrToStructure(h, typeof(int)); Marshal.FreeHGlobal(h); currentIndex += piecesize; //timeout timeout = new Duration(new TimeData( BitConverter.ToInt32(serializedMessage, currentIndex), BitConverter.ToInt32(serializedMessage, currentIndex + Marshal.SizeOf(typeof(System.Int32))))); currentIndex += 2 * Marshal.SizeOf(typeof(System.Int32)); }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //points arraylength = rand.Next(10); if (points == null) { points = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength]; } else { Array.Resize(ref points, arraylength); } for (int i = 0; i < points.Length; i++) { //points[i] points[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(); points[i].Randomize(); } //names arraylength = rand.Next(10); if (names == null) { names = new string[arraylength]; } else { Array.Resize(ref names, arraylength); } for (int i = 0; i < names.Length; i++) { //names[i] strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate names[i] = Encoding.ASCII.GetString(strbuf); } //element_paths arraylength = rand.Next(10); if (element_paths == null) { element_paths = new string[arraylength]; } else { Array.Resize(ref element_paths, arraylength); } for (int i = 0; i < element_paths.Length; i++) { //element_paths[i] strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate element_paths[i] = Encoding.ASCII.GetString(strbuf); } //success success = rand.Next(2) == 1; //error strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate error = Encoding.ASCII.GetString(strbuf); }
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; //points hasmetacomponents |= true; if (points == null) { points = new Messages.xamlamoveit_msgs.JointValuesPoint[0]; } pieces.Add(BitConverter.GetBytes(points.Length)); for (int i = 0; i < points.Length; i++) { //points[i] if (points[i] == null) { points[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(); } pieces.Add(points[i].Serialize(true)); } //names hasmetacomponents |= false; if (names == null) { names = new string[0]; } pieces.Add(BitConverter.GetBytes(names.Length)); for (int i = 0; i < names.Length; i++) { //names[i] if (names[i] == null) { names[i] = ""; } scratch1 = Encoding.ASCII.GetBytes((string)names[i]); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); } //element_paths hasmetacomponents |= false; if (element_paths == null) { element_paths = new string[0]; } pieces.Add(BitConverter.GetBytes(element_paths.Length)); for (int i = 0; i < element_paths.Length; i++) { //element_paths[i] if (element_paths[i] == null) { element_paths[i] = ""; } scratch1 = Encoding.ASCII.GetBytes((string)element_paths[i]); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); } //success thischunk = new byte[1]; thischunk[0] = (byte)((bool)success ? 1 : 0); pieces.Add(thischunk); //error if (error == null) { error = ""; } scratch1 = Encoding.ASCII.GetBytes((string)error); thischunk = new byte[scratch1.Length + 4]; scratch2 = BitConverter.GetBytes(scratch1.Length); Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length); Array.Copy(scratch2, thischunk, 4); pieces.Add(thischunk); //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; //points hasmetacomponents |= true; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (points == null) { points = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength]; } else { Array.Resize(ref points, arraylength); } for (int i = 0; i < points.Length; i++) { //points[i] points[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex); } //names hasmetacomponents |= false; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (names == null) { names = new string[arraylength]; } else { Array.Resize(ref names, arraylength); } for (int i = 0; i < names.Length; i++) { //names[i] names[i] = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; names[i] = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; } //element_paths hasmetacomponents |= false; arraylength = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += Marshal.SizeOf(typeof(System.Int32)); if (element_paths == null) { element_paths = new string[arraylength]; } else { Array.Resize(ref element_paths, arraylength); } for (int i = 0; i < element_paths.Length; i++) { //element_paths[i] element_paths[i] = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; element_paths[i] = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; } //success success = serializedMessage[currentIndex++] == 1; //error error = ""; piecesize = BitConverter.ToInt32(serializedMessage, currentIndex); currentIndex += 4; error = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize); currentIndex += piecesize; }