Пример #1
0
        //找到所有的聊天记录文件
        public static List <string> GetXmlFileName(string MyNickName)
        {
            List <string> fileList   = new List <string>();
            string        RecordFile = string.Format("{0}\\{1}", Xml.GetWorkDirectory(), "聊天记录");

            if (!Directory.Exists(RecordFile))
            {
                return(new List <string>()); //不存在,返回
            }

            string UserFile = RecordFile + @"\" + MyNickName;

            if (!Directory.Exists(UserFile))
            {
                return(new List <string>()); //不存在没,返回
            }
            var files = Directory.GetFiles(UserFile, "*.xml", SearchOption.AllDirectories);

            foreach (string i in files)
            {
                fileList.Add(System.IO.Path.GetFileNameWithoutExtension(i));
            }
            return(fileList);
        }