public string read(string strFile, int Count)
        {
            if (strFile.StartsWith("@"))
            {
                strFile = strFile.Replace("@", pFrmApp.pSYS.path_js());
            }

            if (S_File.Exists(strFile))
            {
                string       strReturn = "";
                StreamReader pFile     = S_File_Text.Read_Begin(strFile);
                for (int i = 0; i < Count; i++)
                {
                    string strLine = S_File_Text.Read_Line(pFile);
                    if (strLine == null)
                    {
                        break;
                    }
                    strReturn += strLine + "\n";
                }
                S_File_Text.Read_End(pFile);
                strReturn = strReturn.Substring(0, strReturn.Length - 1);
                return(strReturn);
            }
            else
            {
                return("");
            }
        }
Exemple #2
0
        public void Init_Seg_Sub()
        {
            pSeg = new C_Segmentation();

            pSeg.pTreapWord = new C_Treap_Funny <Treap <C_Word_Seg> >();


            //网络的词汇
            ArrayList pList = S_Dir.ListFile(Seg_Path + "\\");

            for (int i = 0; i < pList.Count; i++)
            {
                string strFile = Seg_Path + "\\" + pList[i];
                if (strFile.EndsWith(".txt"))
                {
                    StreamReader pReader = S_File_Text.Read_Begin(strFile);

                    string strLine = "";
                    while (pReader.Peek() != -1)
                    {
                        strLine = S_File_Text.Read_Line(pReader);
                        pSeg.readLine_fromDic(strLine);
                    }
                }
            }

            pFrmApp.Call_Event(this.callback_init, "");
        }
        public string read_line(string key)
        {
            StreamReader pReader = (StreamReader)FrmApp.pMap.find(key);
            string       strLine = S_File_Text.Read_Line(pReader);

            return(strLine);
        }