Jsm.Control.If.ElseSegment.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using OpenVIII.Fields.Scripts.Instructions;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace OpenVIII.Fields.Scripts
  6. {
  7. public static partial class Jsm
  8. {
  9. public static partial class Control
  10. {
  11. public sealed partial class If
  12. {
  13. private sealed class ElseSegment : Segment
  14. {
  15. public ElseSegment(Int32 from, Int32 to)
  16. : base(from, to)
  17. {
  18. }
  19. public override void ToString(StringBuilder sb)
  20. {
  21. sb.AppendLine("else");
  22. FormatBranch(sb, GetBodyInstructions());
  23. }
  24. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
  25. {
  26. sw.AppendLine("else");
  27. FormatBranch(sw, formatterContext, services, GetBodyInstructions());
  28. }
  29. public IEnumerable<IJsmInstruction> GetBodyInstructions()
  30. {
  31. return _list;
  32. }
  33. }
  34. }
  35. }
  36. }
  37. }