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

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;


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

                if (line == "[/AFFIXES]")
                {
                    break;
                }
                else if (line == "[AFFIX]")
                {
                    affixData.Affixes.Add(ReadAffix(ref reader, ref lineNumber));
                }
            }

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

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

            if (affixData.Affixes.Count > 0)
            {
                foreach (var affix in affixData.Affixes)
                {
                    builder.AppendAffix(affix);
                }
            }

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

            return builder.ToString();
        }
Пример #3
0
 private void WriteAffixDataFile(AffixData affixData)
 {
     _writer.Write((short)affixData.Affixes.Count);
     foreach (var affix in affixData.Affixes)
     {
         WriteAffix(affix);
     }
 }
Пример #4
0
        private AffixData ReadAffixDataFile()
        {
            AffixData rawFile = new AffixData();

            int affixCount = _reader.ReadInt16();
            for (int i = 0; i < affixCount; i++)
            {
                rawFile.Affixes.Add(ReadAffix());
            }

            return rawFile;
        }