Example #1
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //projected_maps_info
                arraylength = rand.Next(10);
                if (projected_maps_info == null)
                {
                    projected_maps_info = new Messages.map_msgs.ProjectedMapInfo[arraylength];
                }
                else
                {
                    Array.Resize(ref projected_maps_info, arraylength);
                }
                for (int i = 0; i < projected_maps_info.Length; i++)
                {
                    //projected_maps_info[i]
                    projected_maps_info[i] = new Messages.map_msgs.ProjectedMapInfo();
                    projected_maps_info[i].Randomize();
                }
            }
Example #2
0
            public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
            {
                int  arraylength       = -1;
                bool hasmetacomponents = false;

                byte[] thischunk, scratch1, scratch2;
                object __thing;
                int    piecesize = 0;
                IntPtr h;

                //projected_maps_info
                hasmetacomponents |= true;
                arraylength        = BitConverter.ToInt32(SERIALIZEDSTUFF, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (projected_maps_info == null)
                {
                    projected_maps_info = new Messages.map_msgs.ProjectedMapInfo[arraylength];
                }
                else
                {
                    Array.Resize(ref projected_maps_info, arraylength);
                }
                for (int i = 0; i < projected_maps_info.Length; i++)
                {
                    //projected_maps_info[i]
                    projected_maps_info[i] = new Messages.map_msgs.ProjectedMapInfo(SERIALIZEDSTUFF, ref currentIndex);
                }
            }
Example #3
0
            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;

                //projected_maps_info
                hasmetacomponents |= true;
                if (projected_maps_info == null)
                {
                    projected_maps_info = new Messages.map_msgs.ProjectedMapInfo[0];
                }
                pieces.Add(BitConverter.GetBytes(projected_maps_info.Length));
                for (int i = 0; i < projected_maps_info.Length; i++)
                {
                    //projected_maps_info[i]
                    if (projected_maps_info[i] == null)
                    {
                        projected_maps_info[i] = new Messages.map_msgs.ProjectedMapInfo();
                    }
                    pieces.Add(projected_maps_info[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);
            }