// // 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 using System; using System.Collections.Generic; namespace Ariadne.UnitTests { partial class NapScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Amphora.Duration Run____wait1; public global::Amphora.Duration Run____wait2; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Run.__wait1"); lister.Local("Run.__wait2"); } } [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.SchedulerWorld 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 NapScript() { } protected NapScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Name", out string loaded)) { this.Name = loaded; } else if (!reader.HasField("Name")) { throw new global::System.IO.InvalidDataException("NapScript's save has no field 'Name', which has no initializer to fall back on. Give it one."); } } { if (reader.TryField("Nap", out global::System.TimeSpan loaded)) { this.Nap = loaded; } else if (!reader.HasField("Nap")) { throw new global::System.IO.InvalidDataException("NapScript's save has no field 'Nap', which has no initializer to fall back on. Give it one."); } } } protected NapScript(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("Name"); lister.Field("Nap"); lister.Local("Run.__wait1"); lister.Local("Run.__wait2"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 21 "SchedulerScripts.cs" writer.Field("Name", this.Name); #line 23 "SchedulerScripts.cs" writer.Field("Nap", this.Nap); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Run.__wait1": #line 30 "SchedulerScripts.cs" writer.Local("Run.__wait1", this.Run____wait1); #line hidden return; case "Run.__wait2": #line 34 "SchedulerScripts.cs" writer.Local("Run.__wait2", this.Run____wait2); #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("Run.__wait1", out global::Amphora.Duration loaded)) { this.Run____wait1 = loaded; } } { if (reader.TryLocal("Run.__wait2", out global::Amphora.Duration loaded)) { this.Run____wait2 = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "first": goto first__resume; case "second": goto second__resume; } #line 27 "SchedulerScripts.cs" world.Events.Add(Name + " begins"); #line hidden first: #line 30 "SchedulerScripts.cs" __frame.Run____wait1 = __time.DeadlineAfter(Nap); #line hidden first__resume: #line 30 "SchedulerScripts.cs" if (__time.GameTime < __frame.Run____wait1) { __frame.Sleep(__frame.Run____wait1); __frame.Mark("first"); return false; } #line 31 "SchedulerScripts.cs" world.Events.Add(Name + " wakes"); #line hidden second: #line 34 "SchedulerScripts.cs" __frame.Run____wait2 = __time.DeadlineAfter(Nap); #line hidden second__resume: #line 34 "SchedulerScripts.cs" if (__time.GameTime < __frame.Run____wait2) { __frame.Sleep(__frame.Run____wait2); __frame.Mark("second"); return false; } #line 35 "SchedulerScripts.cs" world.Events.Add(Name + " wakes again"); #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": __frame.SaveLocal("Run.__wait1", writer); break; case "second": __frame.SaveLocal("Run.__wait2", writer); break; } } } } namespace Ariadne.UnitTests { partial class PollScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public static void ListParts(global::Ariadne.IArcPartLister lister) { } } [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.SchedulerWorld context, global::Ariadne.TickTime __time) { return Run__Passage((__Frame)__CurrentFrame, __time, context); } public PollScript() { } protected PollScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Name", out string loaded)) { this.Name = loaded; } else if (!reader.HasField("Name")) { throw new global::System.IO.InvalidDataException("PollScript's save has no field 'Name', which has no initializer to fall back on. Give it one."); } } } protected PollScript(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("Name"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 44 "SchedulerScripts.cs" writer.Field("Name", this.Name); #line default } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "poll": goto poll; } #line 48 "SchedulerScripts.cs" world.Events.Add(Name + " begins"); #line hidden poll: #line 51 "SchedulerScripts.cs" while (!world.Open.Contains("go")) #line hidden { #line 53 "SchedulerScripts.cs" world.Events.Add(Name + " polls"); #line 54 "SchedulerScripts.cs" __frame.Mark("poll"); return false; #line hidden } #line 57 "SchedulerScripts.cs" world.Events.Add(Name + " goes"); #line hidden __frame.Exit(); return true; #line default } } } namespace Ariadne.UnitTests { partial class ChainScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Amphora.Duration Run____wait1; public global::Amphora.Duration Run____wait2; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Run.__wait1"); lister.Local("Run.__wait2"); } } [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.SchedulerWorld 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 ChainScript() { } protected ChainScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Name", out string loaded)) { this.Name = loaded; } else if (!reader.HasField("Name")) { throw new global::System.IO.InvalidDataException("ChainScript's save has no field 'Name', which has no initializer to fall back on. Give it one."); } } { if (reader.TryField("Nap", out global::System.TimeSpan loaded)) { this.Nap = loaded; } else if (!reader.HasField("Nap")) { throw new global::System.IO.InvalidDataException("ChainScript's save has no field 'Nap', which has no initializer to fall back on. Give it one."); } } } protected ChainScript(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("Name"); lister.Field("Nap"); lister.Local("Run.__wait1"); lister.Local("Run.__wait2"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 66 "SchedulerScripts.cs" writer.Field("Name", this.Name); #line 68 "SchedulerScripts.cs" writer.Field("Nap", this.Nap); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Run.__wait1": #line 73 "SchedulerScripts.cs" writer.Local("Run.__wait1", this.Run____wait1); #line hidden return; case "Run.__wait2": #line 81 "SchedulerScripts.cs" writer.Local("Run.__wait2", this.Run____wait2); #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("Run.__wait1", out global::Amphora.Duration loaded)) { this.Run____wait1 = loaded; } } { if (reader.TryLocal("Run.__wait2", out global::Amphora.Duration loaded)) { this.Run____wait2 = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "first": goto first__resume; case "second": goto second__resume; case "third": goto third__resume; } #line hidden first: #line 73 "SchedulerScripts.cs" __frame.Run____wait1 = __time.DeadlineAfter(Nap); #line hidden first__resume: #line 73 "SchedulerScripts.cs" if (__time.GameTime < __frame.Run____wait1) { __frame.Sleep(__frame.Run____wait1); __frame.Mark("first"); return false; } #line 74 "SchedulerScripts.cs" world.Events.Add(Name + " wakes"); #line hidden second: #line 77 "SchedulerScripts.cs" __frame.Mark("second"); return false; #line hidden second__resume: #line 78 "SchedulerScripts.cs" world.Events.Add(Name + " yielded"); #line hidden third: #line 81 "SchedulerScripts.cs" __frame.Run____wait2 = __time.DeadlineAfter(Nap); #line hidden third__resume: #line 81 "SchedulerScripts.cs" if (__time.GameTime < __frame.Run____wait2) { __frame.Sleep(__frame.Run____wait2); __frame.Mark("third"); return false; } #line 82 "SchedulerScripts.cs" world.Events.Add(Name + " done"); #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": __frame.SaveLocal("Run.__wait1", writer); break; case "third": __frame.SaveLocal("Run.__wait2", writer); break; } } } } namespace Ariadne.UnitTests { partial class PassageNapScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Amphora.Duration Rest____wait1; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Rest.__wait1"); } } [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.SchedulerWorld 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 PassageNapScript() { } protected PassageNapScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Name", out string loaded)) { this.Name = loaded; } else if (!reader.HasField("Name")) { throw new global::System.IO.InvalidDataException("PassageNapScript's save has no field 'Name', which has no initializer to fall back on. Give it one."); } } { if (reader.TryField("Nap", out global::System.TimeSpan loaded)) { this.Nap = loaded; } else if (!reader.HasField("Nap")) { throw new global::System.IO.InvalidDataException("PassageNapScript's save has no field 'Nap', which has no initializer to fall back on. Give it one."); } } } protected PassageNapScript(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("Name"); lister.Field("Nap"); lister.Local("Rest.__wait1"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 91 "SchedulerScripts.cs" writer.Field("Name", this.Name); #line 93 "SchedulerScripts.cs" writer.Field("Nap", this.Nap); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Rest.__wait1": #line 98 "SchedulerScripts.cs" writer.Local("Rest.__wait1", this.Rest____wait1); #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("Rest.__wait1", out global::Amphora.Duration loaded)) { this.Rest____wait1 = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "one": goto one; case "two": goto two; } #line hidden one: #line 105 "SchedulerScripts.cs" using (__frame.Enter("one")) { if (!Rest__Passage(__frame, __time, world)) { return false; } } #line hidden two: #line 108 "SchedulerScripts.cs" using (__frame.Enter("two")) { if (!Rest__Passage(__frame, __time, world)) { 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 "one": Rest__LocalsToSave(__frame, depth + 1, writer); break; case "two": Rest__LocalsToSave(__frame, depth + 1, writer); break; } } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] private bool Rest__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "rest": goto rest__resume; } #line hidden rest: #line 98 "SchedulerScripts.cs" __frame.Rest____wait1 = __time.DeadlineAfter(Nap); #line hidden rest__resume: #line 98 "SchedulerScripts.cs" if (__time.GameTime < __frame.Rest____wait1) { __frame.Sleep(__frame.Rest____wait1); __frame.Mark("rest"); return false; } #line 99 "SchedulerScripts.cs" world.Events.Add(Name + " rested"); #line hidden __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] private void Rest__LocalsToSave(__Frame __frame, int depth, global::Ariadne.IArcWriter writer) { if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "rest": __frame.SaveLocal("Rest.__wait1", writer); break; } } } } namespace Ariadne.UnitTests { partial class NapWorkerScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Amphora.Duration Pace____wait1; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Pace.__wait1"); } } [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.SchedulerWorld context, global::Ariadne.TickTime __time) { return Run__Passage((__Frame)__CurrentFrame, __time, context); } public NapWorkerScript() { } protected NapWorkerScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { } protected NapWorkerScript(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("Pace.__wait1"); } #pragma warning restore public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Pace.__wait1": #line 120 "SchedulerScripts.cs" writer.Local("Pace.__wait1", this.Pace____wait1); #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("Pace.__wait1", out global::Amphora.Duration loaded)) { this.Pace____wait1 = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { } #line hidden __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public bool Pace__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "rest": goto rest__resume; } #line hidden rest: #line 120 "SchedulerScripts.cs" __frame.Pace____wait1 = __time.DeadlineAfter(TimeSpan.FromSeconds(1)); #line hidden rest__resume: #line 120 "SchedulerScripts.cs" if (__time.GameTime < __frame.Pace____wait1) { __frame.Sleep(__frame.Pace____wait1); __frame.Mark("rest"); return false; } #line 121 "SchedulerScripts.cs" world.Events.Add("worker rested"); #line hidden __frame.Exit(); return true; #line default } [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public void Pace__LocalsToSave(__Frame __frame, int depth, global::Ariadne.IArcWriter writer) { if (depth >= __frame.Cursor.Count) { return; } switch (__frame.Cursor[depth]) { case "rest": __frame.SaveLocal("Pace.__wait1", writer); break; } } } } namespace Ariadne.UnitTests { partial class NapClientScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Ariadne.UnitTests.NapWorkerScript Run____call_pace_receiver; public global::Ariadne.UnitTests.NapWorkerScript.__Frame Run____call_pace_frame; public static void ListParts(global::Ariadne.IArcPartLister lister) { { global::Ariadne.IArcPartLister scope = lister.Scope("Run.pace/", typeof(global::Ariadne.UnitTests.NapWorkerScript.__Frame)); if (scope != null) { scope.Local("receiver"); global::Ariadne.UnitTests.NapWorkerScript.__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.SchedulerWorld 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 NapClientScript() { } protected NapClientScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Worker", out global::Ariadne.UnitTests.NapWorkerScript loaded)) { this.Worker = loaded; } } } protected NapClientScript(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("Worker"); { global::Ariadne.IArcPartLister scope = lister.Scope("Run.pace/", typeof(global::Ariadne.UnitTests.NapWorkerScript.__Frame)); if (scope != null) { scope.Local("receiver"); global::Ariadne.UnitTests.NapWorkerScript.__Frame.ListParts(scope); } } } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 134 "SchedulerScripts.cs" writer.Field("Worker", this.Worker); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Run.pace/receiver": #line 139 "SchedulerScripts.cs" writer.Local("receiver", this.Run____call_pace_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.pace/", out global::Ariadne.IArcReader scope)) { { if (scope.TryLocal("receiver", out global::Ariadne.UnitTests.NapWorkerScript loaded)) { this.Run____call_pace_receiver = loaded; } } if (this.Run____call_pace_receiver != null) { this.Run____call_pace_frame = (global::Ariadne.UnitTests.NapWorkerScript.__Frame)this.Run____call_pace_receiver.NewFrame(); this.Run____call_pace_frame.LoadLocals(scope); } } } } public override void AttachWaits(global::Ariadne.WakeSlot slot) { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); base.AttachWaits(slot); if (this.Run____call_pace_frame != null) { this.Run____call_pace_frame.AttachWaits(slot); } } public override void EndWaits() { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); base.EndWaits(); if (this.Run____call_pace_frame != null) { this.Run____call_pace_frame.EndWaits(); } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "pace": goto pace; } #line hidden pace: #line 139 "SchedulerScripts.cs" using (__frame.Enter("pace")) { global::System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(); if (__frame.ResumeKey == null) { __frame.Run____call_pace_receiver = (Worker); __frame.Run____call_pace_frame = null; } if (__frame.Run____call_pace_frame == null) { __frame.Run____call_pace_frame = (global::Ariadne.UnitTests.NapWorkerScript.__Frame)__frame.Run____call_pace_receiver.NewFrame(); } if (!__frame.Run____call_pace_receiver.Pace__Passage(__frame.Lend(__frame.Run____call_pace_frame), __time, world)) { return false; } } #line 140 "SchedulerScripts.cs" world.Events.Add("client done"); #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 "pace": { global::Ariadne.IArcWriter scope = writer.Scope("Run.pace/"); __frame.SaveLocal("Run.pace/receiver", scope); if (__frame.Run____call_pace_receiver != null) { __frame.Run____call_pace_receiver.Pace__LocalsToSave(__frame.Lend(__frame.Run____call_pace_frame), depth + 1, scope); } } break; } } } } namespace Ariadne.UnitTests { partial class NapThenThrowScript { [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public partial class __Frame : global::Ariadne.Frame { public global::Amphora.Duration Run____wait1; public static void ListParts(global::Ariadne.IArcPartLister lister) { lister.Local("Run.__wait1"); } } [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.SchedulerWorld 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 NapThenThrowScript() { } protected NapThenThrowScript(global::Ariadne.IArcReader reader, global::Ariadne.AutoLoadEveryField load) : base(reader) { { if (reader.TryField("Nap", out global::System.TimeSpan loaded)) { this.Nap = loaded; } else if (!reader.HasField("Nap")) { throw new global::System.IO.InvalidDataException("NapThenThrowScript's save has no field 'Nap', which has no initializer to fall back on. Give it one."); } } { if (reader.TryField("Wakes", out int loaded)) { this.Wakes = loaded; } else if (!reader.HasField("Wakes")) { throw new global::System.IO.InvalidDataException("NapThenThrowScript's save has no field 'Wakes', which has no initializer to fall back on. Give it one."); } } } protected NapThenThrowScript(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("Nap"); lister.Field("Wakes"); lister.Local("Run.__wait1"); } #pragma warning restore protected override void __SaveFields(global::Ariadne.IArcWriter writer) { base.__SaveFields(writer); #line 375 "SchedulerScripts.cs" writer.Field("Nap", this.Nap); #line 377 "SchedulerScripts.cs" writer.Field("Wakes", this.Wakes); #line default } public partial class __Frame { public override void SaveLocal(string key, global::Ariadne.IArcWriter writer) { switch (key) { case "Run.__wait1": #line 382 "SchedulerScripts.cs" writer.Local("Run.__wait1", this.Run____wait1); #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("Run.__wait1", out global::Amphora.Duration loaded)) { this.Run____wait1 = loaded; } } } } #pragma warning disable [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] protected bool Run__Passage(__Frame __frame, global::Ariadne.TickTime __time, SchedulerWorld world) { #line hidden switch (__frame.ResumeKey) { case "nap": goto nap__resume; } #line hidden nap: #line 382 "SchedulerScripts.cs" __frame.Run____wait1 = __time.DeadlineAfter(Nap); #line hidden nap__resume: #line 382 "SchedulerScripts.cs" if (__time.GameTime < __frame.Run____wait1) { __frame.Sleep(__frame.Run____wait1); __frame.Mark("nap"); return false; } #line 383 "SchedulerScripts.cs" Wakes++; #line 384 "SchedulerScripts.cs" if (Wakes == 1) { throw new InvalidOperationException("boom"); } #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 "nap": __frame.SaveLocal("Run.__wait1", writer); break; } } } }