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; }
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(); }
private void WriteTriggerableDataFile(TriggerableData triggerableData) { _writer.Write((short)triggerableData.Triggerables.Count); foreach (var triggerable in triggerableData.Triggerables) { WriteTriggerable(triggerable); } }
private TriggerableData ReadTriggerableDataFile() { TriggerableData rawFile = new TriggerableData(); int triggerableCount = _reader.ReadInt16(); for (int i = 0; i < triggerableCount; i++) { rawFile.Triggerables.Add(ReadTriggerable()); } return rawFile; }