Example #1
0
        /// <summary>
        /// ��ȡһ������
        /// </summary>
        /// <param name="id">����ID</param>
        /// <returns></returns>
        public static oneHtmDat GetOneDat(int id)
        {
            oneHtmDat myTmp = new oneHtmDat();

               if (xl_lock_r == true)
               {
               return myTmp;
               }

               xl_lock_r = true; //����

            myTmp = myFS.GetData(id);

               xl_lock_r = false; //����

               return myTmp;
        }
Example #2
0
        /// <summary>
        /// ��ȡһ������
        /// </summary>
        /// <param name="id">���</param>
        /// <returns></returns>
        public oneHtmDat GetData(int id)
        {
            oneHtmDat back= new oneHtmDat();

            nSearch.DebugShow.ClassDebugShow.WriteLine(" FileSystem GetData--> "+ id.ToString());

            if (id < FS_D_D.Count)
            {
                oneFS one = (oneFS)FS_D_D[id];

                if (fs_mCacheName == one.file)
                {
                    //��ǰ�������е��ļ���������Ҫ���ļ�
                    //��һ������
                }
                else
                {
                    //��ǰ���������ļ� ������Ҫ���ļ�
                    //�ļ����ݶ��뻺����
                    //��һ������

                    FileStream cfs = new FileStream(mDirPath + one.file + ".TDB", FileMode.Open, FileAccess.Read);
                    BinaryReader cr = new BinaryReader(cfs);
                    byte[] mTmp = cr.ReadBytes((int)cfs.Length);

                    cr.Close();
                    cfs.Close();

                    fs_mCacheREAD = new byte[mTmp.Length];
                    fs_mCacheREAD = mTmp;
                    fs_mCacheName = one.file;

                }

                //�ӻ������ж�ȡ����

                byte[] tmpBack = new byte[one.len];

                for (int ii = one.str; ii < one.str + one.len; ii++)
                {
                    tmpBack[ii - one.str] = fs_mCacheREAD[ii];
                }

                string backString = fs_nCode.dbsDeCompress(tmpBack);

                back.HtmDat = backString;
                back.url = one.url;

                return back;

            }
            else
            {
                back.url = null;
                back.HtmDat = null;
                //ID ����
                return back;
            }
        }