Пример #1
0
        public static SkillData GetData(string data)
        {
            SkillData skillData = new SkillData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

            while ((line = reader.ReadLine()) != null)
            {
                lineNumber++;

                if (line == "[/SKILLS]")
                {
                    break;
                }
                else if (line == "[SKILL]")
                {
                    skillData.Skills.Add(ReadSkill(ref reader, ref lineNumber));
                }
            }

            reader.Close();
            reader.Dispose();

            return skillData;
        }
Пример #2
0
        public static string GetString(SkillData skillData)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendLine("[SKILLS]");

            if (skillData.Skills.Count > 0)
            {
                foreach (var skill in skillData.Skills)
                {
                    builder.AppendSkill(skill);
                }
            }

            builder.Append("[/SKILLS]");

            return builder.ToString();
        }
Пример #3
0
 private void WriteSkillFile(SkillData skillData)
 {
     _writer.Write(skillData.Skills.Count);
     foreach (var skill in skillData.Skills)
     {
         WriteSkill(skill);
     }
 }
Пример #4
0
        private SkillData ReadSkillDataFile()
        {
            SkillData rawFile = new SkillData();

            int skillCount = _reader.ReadInt32();
            for (int i = 0; i < skillCount; i++)
            {
                rawFile.Skills.Add(ReadSkill());
            }

            return rawFile;
        }