Пример #1
0
        public ServiceResult Generate(string SkillDataDir, string SkillDataFile, IProgress <int> progress)
        {
            string inNpcdataFile = Path.Combine(SkillDataDir, SkillDataFile);
            string outPchFile    = Path.Combine(SkillDataDir, SkillContants.SkillPchFileName);
            string outPch2File   = Path.Combine(SkillDataDir, SkillContants.SkillPch2FileName);
            string outPch3File   = Path.Combine(SkillDataDir, SkillContants.SkillPch3FileName);

            IEnumerable <string> rawNpcData      = FileUtils.Read(inNpcdataFile);
            IEnumerable <string> collectedRecord = _skillDataService.Collect(rawNpcData);
            List <SkillDataDto>  skillData       = _skillDataService.Parse(collectedRecord).ToList();

            StreamWriter sw2 = new StreamWriter(outPch2File, false, Encoding.Unicode);

            using (StreamWriter sw = new StreamWriter(outPchFile, false, Encoding.Unicode))
            {
                for (var index = 0; index < skillData.Count; index++)
                {
                    SkillDataDto npcDataDto = skillData[index];
                    SkillPch     pch        = Map(npcDataDto);
                    SkillPch2    pch2       = MapPch2(npcDataDto);

                    sw.WriteLine(Print(pch));
                    sw2.WriteLine(Print(pch2));

                    progress.Report((int)(index * 100 / skillData.Count));
                }
            }

            sw2.Close();
            sw2.Dispose();
            File.Create(outPch3File).Close();

            return(new ServiceResult {
                HasErrors = false
            });
        }
Пример #2
0
 // [s_power_strike11] = 769
 private static string Print(SkillPch model)
 {
     return($"[{model.Name}] = {model.Id}");
 }