Ejemplo n.º 1
0
        public static List <TinctTaskInfo> GetSlaveTaskInfoByLog(int lastDayStep)
        {
            var logger = TinctLogManager.Current.GetSLogger();
            List <TinctTaskInfo> lists = new List <TinctTaskInfo>();
            string path     = logger.GetLoggerPath(sLoggerName);
            string fileName = path + "\\" + "task";

            for (int i = lastDayStep; i >= 0; i--)
            {
                string desfileName = fileName + (DateTime.Now.Year * 10000 + DateTime.Now.Month * 100 + (DateTime.Now.Day - i)) + ".json";
                if (File.Exists(desfileName))
                {
                    using (StreamReader reader = new StreamReader(File.OpenRead(desfileName)))
                    {
                        while (true)
                        {
                            var infostr = reader.ReadLine();
                            if (string.IsNullOrEmpty(infostr))
                            {
                                break;
                            }
                            var entity   = LogEntity.GetObjectBySerializeString(infostr);
                            var taskinfo = TinctTaskInfo.GetObjectBySerializeString(entity.Message.ToString());
                            lists.Add(taskinfo);
                        }
                    }
                }
            }
            return(lists);
        }