Exemplo n.º 1
0
        public string LoadFile(string FileName)
        {
            filename = FileName;

            try
            {
                string cs = CharacterSet.GetCharSet(FileName);
                if (cs == null)
                {
                    cs = "gb2312";
                }

                ArrayList lastList = LoadFileByCharSet(FileName, cs);

                if (cs != "gb2312" && (lastList == null || lastList.Count > 20))
                {
                    lastList = LoadFileByCharSet(FileName, "gb2312");
                }

                if (lastList == null || lastList.Count > 20)
                {
                    lastList = LoadFileByCharSet(FileName, "Unicode");
                }

                if (lastList == null)
                {
                    return("¿¨×é¶ÁÈëʧ°Ü£¡");
                }

                int lastNumber = lastList.Count;
                if (lastNumber > 0)
                {
                    string s = lastNumber.ToString() + "ÕÅ¿¨Æ¬¶ÁÈëʧ°Ü£¡\n\r";
                    for (int i = 0; i < lastList.Count; i++)
                    {
                        string ss = (string)lastList[i];
                        s += "\n\r[" + ss + "]";
                    }
                    return(s);
                }

                return(null);
            }
            catch
            {
                Clear();
                return("¿¨×é¶ÁÈëʧ°Ü£¡");
            }
        }