예제 #1
0
        public static TriggerableData GetData(string data)
        {
            TriggerableData triggerableData = new TriggerableData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

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

                if (line == "[/TRIGGERABLES]")
                {
                    break;
                }
                else if (line == "[TRIGGERABLE]")
                {
                    triggerableData.Triggerables.Add(ReadTriggerable(ref reader, ref lineNumber));
                }
            }

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

            return triggerableData;
        }
예제 #2
0
        public static string GetString(TriggerableData triggerableData)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendLine("[TRIGGERABLES]");

            if (triggerableData.Triggerables.Count > 0)
            {
                foreach (var triggerable in triggerableData.Triggerables)
                {
                    builder.AppendTriggerable(triggerable);
                }
            }

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

            return builder.ToString();
        }
예제 #3
0
 private void WriteTriggerableDataFile(TriggerableData triggerableData)
 {
     _writer.Write((short)triggerableData.Triggerables.Count);
     foreach (var triggerable in triggerableData.Triggerables)
     {
         WriteTriggerable(triggerable);
     }
 }
예제 #4
0
        private TriggerableData ReadTriggerableDataFile()
        {
            TriggerableData rawFile = new TriggerableData();

            int triggerableCount = _reader.ReadInt16();
            for (int i = 0; i < triggerableCount; i++)
            {
                rawFile.Triggerables.Add(ReadTriggerable());
            }

            return rawFile;
        }