Exemplo n.º 1
0
        //new record to be stored
        public Log(Storage.Database db, ILogData 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.LogType.ID); //150
                bw.Write(data.Date.ToFileTime()); //154
                bw.Write(data.DataFromDate.ToFileTime()); //162
                bw.Write(data.Encoded); //170
                ms.Position = 180;
                bw.Write(data.GeocacheCode??"");
                ms.Position = 220;
                bw.Write(data.Finder??"");
                ms.Position = 320;
                bw.Write(data.FinderId??"");
                ms.Position = 350;
                bw.Write(data.TBCode??"");
                ms.Position = 380;
                bw.Write(data.Text??"");

                RecordInfo = db.RequestLogRecord(data.ID, _buffer, ms.Position, 100);
            }
            db.LogCollection.Add(this);
        }
Exemplo n.º 2
0
        private void createRecord(Storage.Database db, ILogData data)
        {
            using (MemoryStream ms = new MemoryStream(DataBuffer))
            using (BinaryWriter bw = new BinaryWriter(ms))
            {
                ms.Position = 0;

                ms.Position = 150;
                bw.Write(data.LogType.ID); //150
                bw.Write(Utils.Conversion.DateTimeToLong(data.Date)); //154
                bw.Write(Utils.Conversion.DateTimeToLong(data.DataFromDate)); //162
                bw.Write(data.Encoded); //170
                ms.Position = 180;
                bw.Write(data.GeocacheCode ?? "");
                ms.Position = 220;
                bw.Write(data.Finder ?? "");
                ms.Position = 320;
                bw.Write(data.FinderId ?? "");
                ms.Position = 350;
                bw.Write(data.TBCode ?? "");
                ms.Position = 380;
                bw.Write(data.Text ?? "");

                RecordInfo = db.RequestLogRecord(data.ID, data.GeocacheCode ?? "", DataBuffer, ms.Position, 100);
            }

        }
Exemplo n.º 3
0
 public static void Copy(ILogData src, ILogData dest)
 {
     dest.ID = src.ID;
     dest.LogType = src.LogType;
     dest.GeocacheCode = src.GeocacheCode;
     dest.TBCode = src.TBCode;
     dest.Date = src.Date;
     dest.DataFromDate = src.DataFromDate;
     dest.FinderId = src.FinderId;
     dest.Finder = src.Finder;
     dest.Text = src.Text;
     dest.Encoded = src.Encoded;
 }
Exemplo n.º 4
0
        public LogData(XElement input, ILogData view)
            : this(view)
        {
            this.logForClassName = input.Attribute(Log.ATTRIBUTE_NAME_FOR).Value;
            this.logNumber = input.Attribute(Log.ATTRIBUTE_NAME_NUMBER).Value.ParseTo<int>();
            Logger.AddToQueue("LogData", "Attempting to enter log information from xml.", 3);
            var exception = input.Element(Log.NODE_NAME_EXCEPTION);
            if (!exception.IsNull())
            {
                this.exceptionType = CheckAndAssign(exception, Log.ATTRIBUTE_NAME_EXCEPTION_TYPE);
                this.exceptionMethodName = CheckAndAssign(exception, Log.ATTRIBUTE_NAME_METHOD);
                this.exceptionMessage = CheckAndAssign(exception, Log.ATTRIBUTE_NAME_MESSAGE);
                this.exceptionStack = CheckAndAssign(exception, Log.ATTRIBUTE_NAME_STACK);
            }

            var comment = input.Element(Log.NODE_NAME_COMMENT);
            if (!comment.IsNull())
            {
                this.logComment = CheckAndAssign(comment, Log.ATTRIBUTE_NAME_COMMENT);
            }
        }
Exemplo n.º 5
0
 private LogData(ILogData view)
 {
     this.view = view;
 }
Exemplo n.º 6
0
 //new record to be stored
 public Log(Storage.Database db, ILogData data)
     : this(null)
 {
     createRecord(db, data);
     db.LogCollection.Add(this);
 }