Exemple #1
0
 /// <summary>
 /// Write the record.
 /// </summary>
 public void WriteRecord
 (
     [NotNull] XrfRecord32 record
 )
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Search and read found records.
        /// </summary>
        public IrbisRecord[] SearchReadSimple
        (
            string key
        )
        {
            int[] mfns = InvertedFile.SearchSimple(key);
            List <IrbisRecord> result = new List <IrbisRecord>();

            foreach (int mfn in mfns)
            {
                try
                {
                    XrfRecord32 xrfRecord = Xrf.ReadRecord(mfn);
                    if (!xrfRecord.Deleted)
                    {
                        MstRecord32 mstRecord = Mst.ReadRecord2(xrfRecord.AbsoluteOffset);
                        if (!mstRecord.Deleted)
                        {
                            IrbisRecord irbisRecord = mstRecord.DecodeRecord();
                            irbisRecord.Database = Database;
                            result.Add(irbisRecord);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }

            return(result.ToArray());
        }
Exemple #3
0
        /// <summary>
        /// Lock/unlock the record.
        /// </summary>
        public void LockRecord
        (
            int mfn,
            bool flag
        )
        {
            XrfRecord32 record = ReadRecord(mfn);

            if (flag != record.Locked)
            {
                WriteRecord(record);
            }
        }
        public IrbisRecord ReadRecord
        (
            int mfn
        )
        {
            XrfRecord32 xrfRecord = Xrf.ReadRecord(mfn);

            if ((xrfRecord.Status & RecordStatus.PhysicallyDeleted) != 0)
            {
                return(null);
            }

            MstRecord32 mstRecord = Mst.ReadRecord2
                                    (
                xrfRecord.AbsoluteOffset
                                    );
            IrbisRecord result = mstRecord.DecodeRecord();

            result.Database = Database;

            return(result);
        }
Exemple #5
0
        public XrfRecord32 Decode
        (
            int value
        )
        {
            unchecked
            {
                RecordStatus status = 0;
                if ((value & 0xFFFFF800) == 0xFFFFF800)
                {
                    status = RecordStatus.PhysicallyDeleted;
                }
                else if (value < 0)
                {
                    status = RecordStatus.LogicallyDeleted;
                }

                int blockNumber = value < 0
                    ? (-(int)(value & 0xFFFFF800) >> 11) - 1
                    : (value & 0x7FFFF800) >> 11;
                int blockOffset = value < 0
                    ? -value & 0x7FF
                    : value & 0x7FF;

                XrfRecord32 result = new XrfRecord32
                {
                    BlockNumber    = blockNumber,
                    BlockOffset    = blockOffset,
                    AbsoluteOffset = MstRecord32.MstBlockSize * (blockNumber - 1)
                                     + blockOffset,
                    Status = status
                };

                return(result);
            }
        }