Exemple #1
0
        public IrbisRecord[] SearchReadSimple
        (
            string key
        )
        {
            int[] mfns = InvertedFile.SearchSimple(key);
            List <IrbisRecord> result = new List <IrbisRecord>();

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

            return(result.ToArray());
        }
 /// <summary>
 /// Write the record.
 /// </summary>
 public void WriteRecord
 (
     [NotNull] XrfRecord64 record
 )
 {
     throw new NotImplementedException();
 }
        public XrfRecord64 ReadRecord
        (
            int mfn
        )
        {
            if (mfn <= 0)
            {
                throw new ArgumentOutOfRangeException("mfn");
            }

            long offset = _GetOffset(mfn);

            if (offset >= _stream.Length)
            {
                throw new ArgumentOutOfRangeException("mfn");
            }

            if (_stream.Seek(offset, SeekOrigin.Begin) != offset)
            {
                throw new IOException();
            }

            long ofs   = _stream.ReadInt64Network();
            int  flags = _stream.ReadInt32Network();

            XrfRecord64 result = new XrfRecord64
            {
                Mfn    = mfn,
                Offset = ofs,
                Status = (RecordStatus)flags
            };

            return(result);
        }
        /// <summary>
        /// Lock/unlock the record.
        /// </summary>
        public void LockRecord
        (
            int mfn,
            bool flag
        )
        {
            XrfRecord64 record = ReadRecord(mfn);

            if (flag != record.Locked)
            {
                WriteRecord(record);
            }
        }
Exemple #5
0
        public IrbisRecord ReadRecord
        (
            int mfn
        )
        {
            XrfRecord64 xrfRecord = Xrf.ReadRecord(mfn);

            if (xrfRecord.Offset == 0)
            {
                return(null);
            }

            MstRecord64 mstRecord = Mst.ReadRecord2(xrfRecord.Offset);
            IrbisRecord result    = mstRecord.DecodeRecord();

            result.Database = Database;

            return(result);
        }