/// <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());
        }
        public IrbisRecord[] ReadAllRecordVersions
        (
            int mfn
        )
        {
            List <IrbisRecord> result      = new List <IrbisRecord>();
            IrbisRecord        lastVersion = ReadRecord(mfn);

            if (lastVersion != null)
            {
                result.Add(lastVersion);
                while (true)
                {
                    long offset = lastVersion.PreviousOffset;
                    if (offset == 0)
                    {
                        break;
                    }
                    MstRecord32 mstRecord       = Mst.ReadRecord2(offset);
                    IrbisRecord previousVersion = mstRecord.DecodeRecord();
                    if (previousVersion != null)
                    {
                        result.Add(previousVersion);
                        lastVersion = previousVersion;
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 3
0
        public IrbisRecord ReadRecord
        (
            int mfn
        )
        {
            XrfRecord xrfRecord = Xrf.ReadRecord(mfn);

            if (xrfRecord.Offset == 0)
            {
                return(null);
            }
            MstRecord   mstRecord = Mst.ReadRecord2(xrfRecord.Offset);
            IrbisRecord result    = mstRecord.DecodeRecord();

            result.Database = Database;
            return(result);
        }
        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);
        }