示例#1
0
        private void createRecord(Storage.Database db, IUserWaypointData data)
        {
            using (MemoryStream ms = new MemoryStream(DataBuffer))
            using (BinaryWriter bw = new BinaryWriter(ms))
            {
                ms.Position = 0;

                ms.Position = 150;
                bw.Write(Utils.Conversion.DateTimeToLong(data.Date)); //150
                bw.Write(data.Lat); //158
                bw.Write(data.Lon); //166
                ms.Position = 200;
                bw.Write(data.GeocacheCode);
                ms.Position = 220;
                bw.Write(data.Description);

                RecordInfo = db.RequestUserWaypointRecord(data.ID, data.GeocacheCode ?? "", DataBuffer, ms.Position, 50);
            }
        }
示例#2
0
        //new record to be stored
        public UserWaypoint(Storage.Database db, IUserWaypointData data)
            : base(null)
        {
            _id = data.ID;
            using (MemoryStream ms = new MemoryStream(_buffer))
            using (BinaryWriter bw = new BinaryWriter(ms))
            {
                ms.Position = 0;
                //todo: add string length checks!!!

                ms.Position = 150;
                bw.Write(data.Date.ToFileTime()); //150
                bw.Write(data.Lat); //158
                bw.Write(data.Lon); //166
                ms.Position = 200;
                bw.Write(data.GeocacheCode); 
                ms.Position = 220;
                bw.Write(data.Description);

                RecordInfo = db.RequestUserWaypointRecord(data.ID, _buffer, ms.Position, 50);
            }
            db.UserWaypointCollection.Add(this);
        }