Esempio n. 1
0
        private void createRecord(Storage.Database db, IGeocacheImageData 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.DataFromDate)); //150
                ms.Position = 180;
                bw.Write(data.GeocacheCode ?? "");
                ms.Position = 220;
                bw.Write(data.Url);
                ms.Position = 420;
                bw.Write(data.MobileUrl ?? "");
                ms.Position = 520;
                bw.Write(data.ThumbUrl ?? "");
                ms.Position = 620;
                bw.Write(GetSafeString(620, 800, data.Name) ?? "");
                ms.Position = 800;
                bw.Write(data.Description ?? "");

                RecordInfo = db.RequestGeocacheImageRecord(data.ID, data.GeocacheCode ?? "", DataBuffer, ms.Position, 10);
            }
        }
Esempio n. 2
0
        //new record to be stored
        public GeocacheImage(Storage.Database db, IGeocacheImageData 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.DataFromDate.ToFileTime()); //150
                ms.Position = 180;
                bw.Write(data.GeocacheCode??"");
                ms.Position = 220;
                bw.Write(data.Url);
                ms.Position = 420;
                bw.Write(data.MobileUrl??"");
                ms.Position = 520;
                bw.Write(data.ThumbUrl??"");
                ms.Position = 620;
                bw.Write(data.Name??"");
                ms.Position = 800;
                bw.Write(data.Description??"");

                RecordInfo = db.RequestGeocacheImageRecord(data.ID, _buffer, ms.Position, 10);
            }
            db.GeocacheImageCollection.Add(this);
        }