Ejemplo n.º 1
0
        public ServiceResult Generate(string NpcDataDir, string NpcDataFile, IProgress <int> progress)
        {
            string inNpcdataFile = Path.Combine(NpcDataDir, NpcDataFile);
            string outPchFile    = Path.Combine(NpcDataDir, NpcContants.NpcPchFileName);
            string outPch2File   = Path.Combine(NpcDataDir, NpcContants.NpcPch2FileName);

            IEnumerable <string> rawNpcData    = FileUtils.Read(inNpcdataFile);
            IEnumerable <string> collectedData = _npcDataService.Collect(rawNpcData);
            List <NpcDataDto>    npcData       = _npcDataService.Parse(collectedData).ToList();

            using (StreamWriter sw = new StreamWriter(outPchFile, false, Encoding.Unicode))
            {
                for (var index = 0; index < npcData.Count; index++)
                {
                    NpcDataDto npcDataDto = npcData[index];
                    sw.WriteLine(Print(_mapper.Map(npcDataDto)));
                    progress.Report((int)(index * 100 / npcData.Count));
                }
            }

            File.Create(outPch2File).Close();

            return(new ServiceResult {
                HasErrors = false
            });
        }
Ejemplo n.º 2
0
 private static NpcCache Map(NpcDataDto data)
 {
     return(new NpcCache
     {
         Name = data.Name,
         Id = data.Id
     });
 }
Ejemplo n.º 3
0
        public NpcDataDto Parse(string record)
        {
            ParsedData data       = ParseService.Parse(record);
            NpcDataDto npcDataDto = _mapper.Map(data);

            return(npcDataDto);
            // return InlineParser.Parse(data);
        }