private static void AppendTriggerable(this StringBuilder builder, Triggerable triggerable) { builder.AppendLine(" [TRIGGERABLE]"); builder.AppendFormat(" <STRING>Name:{0}\r\n", triggerable.Name); builder.AppendFormat(" <STRING>File:{0}\r\n", triggerable.File); builder.AppendLine(" [/TRIGGERABLE]"); }
private static Triggerable ReadTriggerable(ref StringReader reader, ref int lineNumber) { Triggerable triggerable = new Triggerable(); string line; int startLine = lineNumber; bool[] hasSet = new bool[2]; while ((line = reader.ReadLine()) != null) { lineNumber++; if (line == "[/TRIGGERABLE]") { break; } else if (line.StartsWith("<STRING>Name:")) { line = line.Replace("<STRING>Name:", "").Trim(); triggerable.Name = line; hasSet[0] = true; } else if (line.StartsWith("<STRING>File:")) { line = line.Replace("<STRING>File:", "").Trim(); triggerable.File = line; hasSet[1] = true; } else if(line.StartsWith("//") || line.StartsWith("#")) { continue; } else { throw new TxtConverterException(String.Format("Unknown unit property. (Line: {0})", lineNumber)); } } Validate(hasSet, startLine); return triggerable; }
private void WriteTriggerable(Triggerable triggerable) { WriteString(triggerable.File); WriteString(triggerable.Name); }
private Triggerable ReadTriggerable() { Triggerable triggerable = new Triggerable(); triggerable.File = ReadString(); triggerable.Name = ReadString(); return triggerable; }