// // Ariadne.Generator's copy of the scripts in this file: the code that actually runs. Edits here are overwritten. // In the copy beside the script, #line paths are relative to it; the compiled code uses full paths. #pragma warning disable namespace Ariadne.Vellum.UnitTests { partial class Door { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public int Swing__hinges; public object Swing__active; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Swing.hinges"); } } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected override global::Ariadne.Frame __CreateFrame() { return new __Frame(); } [global::System.CodeDom.Compiler.GeneratedCode("Ariadne.Generator", "1.0")] protected override bool __Resume(global::Ariadne.UnitTests.ArcTests.Gates context, global::Ariadne.TickTime __time) { return Run__Passage((__Frame)__CurrentFrame, __time, context); } protected override void __SaveLocals(global::Ariadne.IArcWriter writer) { Run__LocalsToSave((__Frame)__CurrentFrame, 0, writer); } public Door() { } protected Door(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Note", out string loaded)) { this.Note = loaded; } } } protected Door(global::Ariadne.IArcReader reader) : this(reader, default(global::Ariadne.AutoLoadEveryField)) { } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] private static void __ListParts(global::Ariadne.IArcPartLister lister) { lister.Field("Note"); lister.Local("Swing.hinges"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 9 "VirtualPassageScripts.cs" writer.Field("Note", this.Note); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Swing.hinges": #line 13 "VirtualPassageScripts.cs" writer.Local("Swing.hinges", this.Swing__hinges); #line hidden return; } #line default base.SaveLocal(key, writer); } } #pragma warning disable public partial class __Frame { public override void LoadLocals(global::Ariadne.IArcReader reader) { base.LoadLocals(reader); { if (reader.TryLocal("Swing.hinges", out int loaded)) { this.Swing__hinges = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, Gates gates) { #line hidden switch (__frame.ResumeKey) { case "first": goto first; } #line hidden first: #line 27 "VirtualPassageScripts.cs" using (__frame.Enter("first")) { if (!Swing__Passage(__frame, __time, gates)) { return false; } } #line hidden __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected void Run__LocalsToSave(__Frame __frame, int depth, global::Ariadne.IArcWriter writer) { if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "first": Swing__LocalsToSave(__frame, depth + 1, writer); break; } } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual bool Swing__Passage(__Frame __frame, global::Ariadne.TickTime __time, Gates gates) { #line hidden if (__frame.ResumeKey == null && object.ReferenceEquals(__frame.Swing__active, __frame.Cursor)) { throw new global::System.InvalidOperationException("The virtual passage Swing started again before it finished. A virtual passage can't be called from itself, even through an override."); } __frame.Swing__active = __frame.Cursor; ref int hinges = ref __frame.Swing__hinges; switch (__frame.ResumeKey) { case "swing": goto swing; } #line 13 "VirtualPassageScripts.cs" hinges = 2; #line hidden swing: #line 16 "VirtualPassageScripts.cs" while (!gates.Open.Contains("swing")) #line hidden { #line 18 "VirtualPassageScripts.cs" __frame.Mark("swing"); return false; #line hidden } #line 21 "VirtualPassageScripts.cs" Note = "swung " + hinges; #line hidden __frame.Swing__active = null; __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public virtual void Swing__LocalsToSave(__Frame __frame, int depth, global::Ariadne.IArcWriter writer) { if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "swing": __frame.SaveLocal("Swing.hinges", writer); break; } } } } namespace Ariadne.Vellum.UnitTests { partial class CreakyDoor { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Vellum.UnitTests.Door.__Frame { public string Swing__sound; public static void ListParts(global::Ariadne.IArcPartLister lister) { global::Ariadne.Vellum.UnitTests.Door.__Frame.ListParts(lister); lister.Local("CreakyDoor.Swing.sound"); } } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected override global::Ariadne.Frame __CreateFrame() { return new __Frame(); } public CreakyDoor() { } protected CreakyDoor(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { } protected CreakyDoor(global::Ariadne.IArcReader reader) : this(reader, default(global::Ariadne.AutoLoadEveryField)) { } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] private static void __ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("CreakyDoor.Swing.sound"); } #pragma warning restore public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "CreakyDoor.Swing.sound": #line 38 "VirtualPassageScripts.cs" writer.Local("CreakyDoor.Swing.sound", this.Swing__sound); #line hidden return; } #line default base.SaveLocal(key, writer); } } #pragma warning disable public partial class __Frame { public override void LoadLocals(global::Ariadne.IArcReader reader) { base.LoadLocals(reader); { if (reader.TryLocal("CreakyDoor.Swing.sound", out string loaded)) { this.Swing__sound = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public override bool Swing__Passage(global::Ariadne.Vellum.UnitTests.Door.__Frame __rootFrame, global::Ariadne.TickTime __time, Gates gates) { #line hidden var __frame = (__Frame)__rootFrame; if (__frame.ResumeKey == null && object.ReferenceEquals(__rootFrame.Swing__active, __frame.Cursor)) { throw new global::System.InvalidOperationException("The virtual passage Swing started again before it finished. A virtual passage can't be called from itself, even through an override."); } __rootFrame.Swing__active = __frame.Cursor; ref string sound = ref __frame.Swing__sound; switch (__frame.ResumeKey) { case "creak": goto creak; } #line 38 "VirtualPassageScripts.cs" sound = "creak"; #line hidden creak: #line 41 "VirtualPassageScripts.cs" while (!gates.Open.Contains("swing")) #line hidden { #line 43 "VirtualPassageScripts.cs" __frame.Mark("creak"); return false; #line hidden } #line 46 "VirtualPassageScripts.cs" Note = sound; #line hidden __rootFrame.Swing__active = null; __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public override void Swing__LocalsToSave(global::Ariadne.Vellum.UnitTests.Door.__Frame __rootFrame, int depth, global::Ariadne.IArcWriter writer) { var __frame = (__Frame)__rootFrame; if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "creak": __frame.SaveLocal("CreakyDoor.Swing.sound", writer); break; } } } } namespace Ariadne.Vellum.UnitTests { partial class Visitor { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Ariadne.Vellum.UnitTests.Door Run____call_enter_receiver; public global::Ariadne.Vellum.UnitTests.Door.__Frame Run____call_enter_frame; public static void ListParts(global::Ariadne.IArcPartLister lister) { { global::Ariadne.IArcPartLister scope = lister.Scope("Run.enter/", typeof(global::Ariadne.Vellum.UnitTests.Door.__Frame)); if (scope != null) { scope.Local("receiver"); global::Ariadne.Vellum.UnitTests.Door.__Frame.ListParts(scope); } } } } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected override global::Ariadne.Frame __CreateFrame() { return new __Frame(); } [global::System.CodeDom.Compiler.GeneratedCode("Ariadne.Generator", "1.0")] protected override bool __Resume(global::Ariadne.UnitTests.ArcTests.Gates context, global::Ariadne.TickTime __time) { return Run__Passage((__Frame)__CurrentFrame, __time, context); } protected override void __SaveLocals(global::Ariadne.IArcWriter writer) { Run__LocalsToSave((__Frame)__CurrentFrame, 0, writer); } public Visitor() { } protected Visitor(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Entrance", out global::Ariadne.Vellum.UnitTests.Door loaded)) { this.Entrance = loaded; } else if (!reader.HasField("Entrance")) { throw new global::System.IO.InvalidDataException("Visitor's save has no field 'Entrance', which has no initializer to fall back on. Give it one."); } } { if (reader.TryField("Result", out string loaded)) { this.Result = loaded; } } } protected Visitor(global::Ariadne.IArcReader reader) : this(reader, default(global::Ariadne.AutoLoadEveryField)) { } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] private static void __ListParts(global::Ariadne.IArcPartLister lister) { lister.Field("Entrance"); lister.Field("Result"); { global::Ariadne.IArcPartLister scope = lister.Scope("Run.enter/", typeof(global::Ariadne.Vellum.UnitTests.Door.__Frame)); if (scope != null) { scope.Local("receiver"); global::Ariadne.Vellum.UnitTests.Door.__Frame.ListParts(scope); } } } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 55 "VirtualPassageScripts.cs" writer.Field("Entrance", this.Entrance); #line 57 "VirtualPassageScripts.cs" writer.Field("Result", this.Result); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Run.enter/receiver": #line 62 "VirtualPassageScripts.cs" writer.Local("receiver", this.Run____call_enter_receiver); #line hidden return; } #line default base.SaveLocal(key, writer); } } #pragma warning disable public partial class __Frame { public override void LoadLocals(global::Ariadne.IArcReader reader) { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); base.LoadLocals(reader); { if (reader.TryScope("Run.enter/", out global::Ariadne.IArcReader scope)) { { if (scope.TryLocal("receiver", out global::Ariadne.Vellum.UnitTests.Door loaded)) { this.Run____call_enter_receiver = loaded; } } if (this.Run____call_enter_receiver != null) { this.Run____call_enter_frame = (global::Ariadne.Vellum.UnitTests.Door.__Frame)this.Run____call_enter_receiver.NewFrame(); this.Run____call_enter_frame.LoadLocals(scope); } } } } public override void AttachWaits(global::Ariadne.WakeSlot slot) { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); base.AttachWaits(slot); if (this.Run____call_enter_frame != null) { this.Run____call_enter_frame.AttachWaits(slot); } } public override void EndWaits() { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); base.EndWaits(); if (this.Run____call_enter_frame != null) { this.Run____call_enter_frame.EndWaits(); } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, Gates gates) { #line hidden switch (__frame.ResumeKey) { case "enter": goto enter; } #line hidden enter: #line 62 "VirtualPassageScripts.cs" using (__frame.Enter("enter")) { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); if (__frame.ResumeKey == null) { __frame.Run____call_enter_receiver = (Entrance); __frame.Run____call_enter_frame = null; } if (__frame.Run____call_enter_frame == null) { __frame.Run____call_enter_frame = (global::Ariadne.Vellum.UnitTests.Door.__Frame)__frame.Run____call_enter_receiver.NewFrame(); } if (!__frame.Run____call_enter_receiver.Swing__Passage(__frame.Lend(__frame.Run____call_enter_frame), __time, gates)) { return false; } } #line 63 "VirtualPassageScripts.cs" Result = Entrance.Note; #line hidden __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected void Run__LocalsToSave(__Frame __frame, int depth, global::Ariadne.IArcWriter writer) { if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "enter": { global::Ariadne.IArcWriter scope = writer.Scope("Run.enter/"); __frame.SaveLocal("Run.enter/receiver", scope); if (__frame.Run____call_enter_receiver != null) { __frame.Run____call_enter_receiver.Swing__LocalsToSave(__frame.Lend(__frame.Run____call_enter_frame), depth + 1, scope); } } break; } } } }