Beispiel #1
0
        /*
         * Invalidate until the first memory-mapped node is found.
         */
        private bool Invalidate(EsfNode node)
        {
            MemoryMappedRecordNode mapped = node as MemoryMappedRecordNode;
            bool continuteIteration       = mapped == null;

            if (mapped != null)
            {
                mapped.Invalid = true;
            }
            // don't continue when a node was invalidated
            return(!continuteIteration);
        }
Beispiel #2
0
//        protected byte[] EncodeArrayNode<T>(T[] array, ValueWriter<T> WriteItem) {
//            byte[] result;
//            MemoryStream bufferStream = new MemoryStream();
//            using (BinaryWriter writer = new BinaryWriter(bufferStream)) {
//                for (int i = 0; i < array.Length; i++) {
//                    WriteItem(writer, array[i]);
//                }
//                result = bufferStream.ToArray();
//            }
//            return result;
//        }
        #endregion

        #region Record Nodes
        // read an identified node from the reader at its current position
        public virtual RecordNode ReadRecordNode(BinaryReader reader, byte typeCode, bool forceDecode = false)
        {
            RecordNode node;

            if (!forceDecode && buffer != null)
            {
                node = new MemoryMappedRecordNode(this, buffer, (int)reader.BaseStream.Position);
            }
            else
            {
                node = new RecordNode(this, typeCode);
            }
            node.Decode(reader, EsfType.RECORD);
            return(node);
        }