Beispiel #1
0
        private void TryHandle(HandleInfoTextFileResult result)
        {
            string content = File.ReadAllText("C:/info2.txt");

            if (string.IsNullOrEmpty(content))
            {
                result.Success = false;
                result.Msg     = "没有内容";
            }

            string[] records = content.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            result.TotalRecords = records.Count();

            foreach (var record in records)
            {
                HandRecord(record);
            }
        }
Beispiel #2
0
        private HandleInfoTextFileResult HandleInfo2TextFile()
        {
            HandleInfoTextFileResult result = new HandleInfoTextFileResult();

            result.Success = true;

            try
            {
                TryHandle(result);
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Msg     = ex.Message + ex.StackTrace;
            }

            return(result);
        }