diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e471228
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb
\ No newline at end of file
diff --git a/FyreChannels/COPYRIGHT b/FyreChannels/COPYRIGHT
new file mode 100644
index 0000000..93f5022
--- /dev/null
+++ b/FyreChannels/COPYRIGHT
@@ -0,0 +1,11 @@
+These files are public domain.
+
+MainForm.cs
+MainForm.Designer.cs
+MainForm.resx
+Program.cs
+AssemblyInfo.cs
+Resources.resx
+Resources.Designer.cs
+Settings.settings
+Settings.Designer.cs.
diff --git a/FyreChannels/FyreChannels.csproj b/FyreChannels/FyreChannels.csproj
new file mode 100644
index 0000000..e27381c
--- /dev/null
+++ b/FyreChannels/FyreChannels.csproj
@@ -0,0 +1,133 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}
+ WinExe
+ Properties
+ FyreChannels
+ FyreChannels
+ v4.5
+ 512
+
+
+
+
+ 3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainForm.cs
+
+
+
+
+ MainForm.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+
+
+ {e38aa41f-2ccd-4609-8820-95161669e18a}
+ FyreVM
+
+
+
+
+
\ No newline at end of file
diff --git a/FyreChannels/FyreChannels.csproj.user b/FyreChannels/FyreChannels.csproj.user
new file mode 100644
index 0000000..85322e4
--- /dev/null
+++ b/FyreChannels/FyreChannels.csproj.user
@@ -0,0 +1,14 @@
+
+
+
+ ProjectFiles
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/FyreChannels/FyreChannels.sln b/FyreChannels/FyreChannels.sln
new file mode 100644
index 0000000..e11887e
--- /dev/null
+++ b/FyreChannels/FyreChannels.sln
@@ -0,0 +1,40 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.30723.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FyreChannels", "FyreChannels.csproj", "{982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{0493DBED-7DE0-4BE9-95AD-83C2D50A9C70}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FyreVM", "..\FyreVM.csproj", "{E38AA41F-2CCD-4609-8820-95161669E18A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Demo|Any CPU = Demo|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Demo|Any CPU.ActiveCfg = Debug|Any CPU
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Demo|Any CPU.Build.0 = Debug|Any CPU
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {982EAD2F-FF0B-4793-BBE8-F3DACCF98A90}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Demo|Any CPU.ActiveCfg = Debug|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Demo|Any CPU.Build.0 = Debug|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/FyreChannels/FyreChannels.v12.suo b/FyreChannels/FyreChannels.v12.suo
new file mode 100644
index 0000000..242437d
Binary files /dev/null and b/FyreChannels/FyreChannels.v12.suo differ
diff --git a/FyreChannels/MainForm.Designer.cs b/FyreChannels/MainForm.Designer.cs
new file mode 100644
index 0000000..edc5671
--- /dev/null
+++ b/FyreChannels/MainForm.Designer.cs
@@ -0,0 +1,272 @@
+namespace SimpleFyre
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openGameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
+ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.aboutSimpleFyreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.txtTime = new System.Windows.Forms.TextBox();
+ this.txtScore = new System.Windows.Forms.TextBox();
+ this.inputPanel = new System.Windows.Forms.Panel();
+ this.lblPrompt = new System.Windows.Forms.Label();
+ this.txtInput = new System.Windows.Forms.TextBox();
+ this.txtLocation = new System.Windows.Forms.TextBox();
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.dataGridView1 = new System.Windows.Forms.DataGridView();
+ this.ChannelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ChannelData = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.menuStrip1.SuspendLayout();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.inputPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem,
+ this.helpToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1043, 28);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.openGameToolStripMenuItem,
+ this.toolStripMenuItem1,
+ this.exitToolStripMenuItem});
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
+ this.fileToolStripMenuItem.Text = "&File";
+ //
+ // openGameToolStripMenuItem
+ //
+ this.openGameToolStripMenuItem.Name = "openGameToolStripMenuItem";
+ this.openGameToolStripMenuItem.Size = new System.Drawing.Size(166, 24);
+ this.openGameToolStripMenuItem.Text = "&Open Game...";
+ this.openGameToolStripMenuItem.Click += new System.EventHandler(this.openGameToolStripMenuItem_Click);
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(163, 6);
+ //
+ // exitToolStripMenuItem
+ //
+ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(166, 24);
+ this.exitToolStripMenuItem.Text = "E&xit";
+ this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
+ //
+ // helpToolStripMenuItem
+ //
+ this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.aboutSimpleFyreToolStripMenuItem});
+ this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
+ this.helpToolStripMenuItem.Size = new System.Drawing.Size(53, 24);
+ this.helpToolStripMenuItem.Text = "&Help";
+ //
+ // aboutSimpleFyreToolStripMenuItem
+ //
+ this.aboutSimpleFyreToolStripMenuItem.Name = "aboutSimpleFyreToolStripMenuItem";
+ this.aboutSimpleFyreToolStripMenuItem.Size = new System.Drawing.Size(205, 24);
+ this.aboutSimpleFyreToolStripMenuItem.Text = "&About SimpleFyre...";
+ this.aboutSimpleFyreToolStripMenuItem.Click += new System.EventHandler(this.aboutSimpleFyreToolStripMenuItem_Click);
+ //
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.ColumnCount = 3;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 55F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 56F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel1.Controls.Add(this.txtTime, 1, 0);
+ this.tableLayoutPanel1.Controls.Add(this.txtScore, 2, 0);
+ this.tableLayoutPanel1.Controls.Add(this.inputPanel, 0, 2);
+ this.tableLayoutPanel1.Controls.Add(this.txtLocation, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1);
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(162, 24);
+ this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(155, 3, 3, 3);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 3;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(881, 500);
+ this.tableLayoutPanel1.TabIndex = 1;
+ //
+ // txtTime
+ //
+ this.txtTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtTime.Enabled = false;
+ this.txtTime.Location = new System.Drawing.Point(774, 3);
+ this.txtTime.Name = "txtTime";
+ this.txtTime.ReadOnly = true;
+ this.txtTime.Size = new System.Drawing.Size(48, 20);
+ this.txtTime.TabIndex = 3;
+ this.toolTip1.SetToolTip(this.txtTime, "Time");
+ //
+ // txtScore
+ //
+ this.txtScore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtScore.Enabled = false;
+ this.txtScore.Location = new System.Drawing.Point(830, 3);
+ this.txtScore.Name = "txtScore";
+ this.txtScore.ReadOnly = true;
+ this.txtScore.Size = new System.Drawing.Size(48, 20);
+ this.txtScore.TabIndex = 4;
+ this.toolTip1.SetToolTip(this.txtScore, "Score");
+ //
+ // inputPanel
+ //
+ this.inputPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tableLayoutPanel1.SetColumnSpan(this.inputPanel, 3);
+ this.inputPanel.Controls.Add(this.lblPrompt);
+ this.inputPanel.Controls.Add(this.txtInput);
+ this.inputPanel.Location = new System.Drawing.Point(3, 474);
+ this.inputPanel.Name = "inputPanel";
+ this.inputPanel.Size = new System.Drawing.Size(875, 23);
+ this.inputPanel.TabIndex = 5;
+ this.inputPanel.Resize += new System.EventHandler(this.ArrangeInput);
+ //
+ // lblPrompt
+ //
+ this.lblPrompt.AutoSize = true;
+ this.lblPrompt.Location = new System.Drawing.Point(3, 4);
+ this.lblPrompt.Name = "lblPrompt";
+ this.lblPrompt.Size = new System.Drawing.Size(46, 15);
+ this.lblPrompt.TabIndex = 2;
+ this.lblPrompt.Text = "prompt";
+ this.lblPrompt.Resize += new System.EventHandler(this.ArrangeInput);
+ //
+ // txtInput
+ //
+ this.txtInput.Enabled = false;
+ this.txtInput.Location = new System.Drawing.Point(80, 1);
+ this.txtInput.Name = "txtInput";
+ this.txtInput.Size = new System.Drawing.Size(527, 20);
+ this.txtInput.TabIndex = 1;
+ this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown);
+ this.txtInput.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtInput_KeyPress);
+ //
+ // txtLocation
+ //
+ this.txtLocation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtLocation.Enabled = false;
+ this.txtLocation.Location = new System.Drawing.Point(3, 3);
+ this.txtLocation.Name = "txtLocation";
+ this.txtLocation.ReadOnly = true;
+ this.txtLocation.Size = new System.Drawing.Size(764, 20);
+ this.txtLocation.TabIndex = 2;
+ this.toolTip1.SetToolTip(this.txtLocation, "Location");
+ //
+ // dataGridView1
+ //
+ this.dataGridView1.AllowUserToAddRows = false;
+ this.dataGridView1.AllowUserToDeleteRows = false;
+ this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ChannelName,
+ this.ChannelData});
+ this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView1.Location = new System.Drawing.Point(3, 28);
+ this.dataGridView1.Name = "dataGridView1";
+ this.dataGridView1.ReadOnly = true;
+ this.dataGridView1.Size = new System.Drawing.Size(764, 440);
+ this.dataGridView1.TabIndex = 6;
+ //
+ // ChannelName
+ //
+ this.ChannelName.HeaderText = "Channel";
+ this.ChannelName.Name = "ChannelName";
+ this.ChannelName.ReadOnly = true;
+ //
+ // ChannelData
+ //
+ this.ChannelData.HeaderText = "Channel Data";
+ this.ChannelData.Name = "ChannelData";
+ this.ChannelData.ReadOnly = true;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1043, 524);
+ this.Controls.Add(this.tableLayoutPanel1);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "MainForm";
+ this.Text = "Fyre Channels";
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
+ this.inputPanel.ResumeLayout(false);
+ this.inputPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem openGameToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem aboutSimpleFyreToolStripMenuItem;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.TextBox txtLocation;
+ private System.Windows.Forms.TextBox txtTime;
+ private System.Windows.Forms.TextBox txtScore;
+ private System.Windows.Forms.ToolTip toolTip1;
+ private System.Windows.Forms.Panel inputPanel;
+ private System.Windows.Forms.Label lblPrompt;
+ private System.Windows.Forms.TextBox txtInput;
+ private System.Windows.Forms.DataGridView dataGridView1;
+ private System.Windows.Forms.DataGridViewTextBoxColumn ChannelName;
+ private System.Windows.Forms.DataGridViewTextBoxColumn ChannelData;
+ }
+}
+
diff --git a/FyreChannels/MainForm.cs b/FyreChannels/MainForm.cs
new file mode 100644
index 0000000..0d1eecf
--- /dev/null
+++ b/FyreChannels/MainForm.cs
@@ -0,0 +1,260 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+using FyreVM;
+
+namespace SimpleFyre
+{
+ public partial class MainForm : Form
+ {
+ private Engine vm;
+ private Thread vmThread;
+ private Stream gameFile;
+
+ private AutoResetEvent inputReadyEvent = new AutoResetEvent(false);
+ private bool lineWanted = false;
+ private bool keyWanted = false;
+ private string inputLine = null;
+ private string[] channelText = new string[18];
+
+ public MainForm()
+ {
+ InitializeComponent();
+
+ lblPrompt.Text = "";
+ txtInput.Bounds = inputPanel.ClientRectangle;
+ }
+
+ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void aboutSimpleFyreToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show("SimpleFyre\nA FyreVM sample application.");
+ }
+
+ private void openGameToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string filename;
+
+ using (OpenFileDialog dlg = new OpenFileDialog())
+ {
+ dlg.Title = "Select Game File";
+ dlg.Filter = "Glulx files (*.ulx)|*.ulx";
+
+ if (dlg.ShowDialog() == DialogResult.Cancel)
+ return;
+
+ filename = dlg.FileName;
+ }
+
+ if (vmThread != null)
+ {
+ vmThread.Abort();
+ vmThread.Join();
+ }
+
+ if (gameFile != null)
+ gameFile.Close();
+
+ txtInput.Clear();
+ txtLocation.Clear();
+ txtTime.Clear();
+ txtScore.Clear();
+
+ gameFile = new FileStream(filename, FileMode.Open, FileAccess.Read);
+
+ vm = new Engine(gameFile);
+ //vm.OutputFilterEnabled = false;
+
+ vm.LineWanted += new LineWantedEventHandler(vm_LineWanted);
+ vm.KeyWanted += new KeyWantedEventHandler(vm_KeyWanted);
+ vm.OutputReady += new OutputReadyEventHandler(vm_OutputReady);
+ vm.SaveRequested += new SaveRestoreEventHandler(vm_SaveRequested);
+ vm.LoadRequested += new SaveRestoreEventHandler(vm_LoadRequested);
+
+ vmThread = new Thread(VMThreadProc);
+ vmThread.IsBackground = true;
+ vmThread.Start();
+ }
+
+ private void RequestLine()
+ {
+ lineWanted = true;
+ keyWanted = false;
+
+ txtInput.Enabled = true;
+ txtInput.Focus();
+ }
+
+ private void RequestKey()
+ {
+ lineWanted = false;
+ keyWanted = true;
+
+ txtInput.Enabled = true;
+ txtInput.Focus();
+ }
+
+ private void txtInput_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ if (keyWanted)
+ {
+ GotInput(new string(e.KeyChar, 1));
+ e.Handled = true;
+ }
+ else if (e.KeyChar == '\r' || e.KeyChar == '\n')
+ {
+ // already handled in KeyDown
+ e.Handled = true;
+ }
+ }
+
+ private void txtInput_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
+ {
+ e.Handled = true;
+
+ if (keyWanted)
+ {
+ GotInput("\n");
+ }
+ else if (lineWanted)
+ {
+ GotInput(txtInput.Text);
+ //txtOutput.Text += lblPrompt.Text + txtInput.Text + "\r\n";
+ txtInput.Clear();
+ }
+ }
+ }
+
+ private void GotInput(string line)
+ {
+ txtInput.Enabled = false;
+ inputLine = line;
+ inputReadyEvent.Set();
+ }
+
+ public class Channel
+ {
+ public Channel(string name, string data)
+ {
+ this.ChannelName = name;
+ this.ChannelData = data;
+ }
+
+ public string ChannelName { get; set; }
+ public string ChannelData { get; set; }
+ }
+
+ private void HandleOutput(Dictionary package)
+ {
+ List channels = new List();
+
+ foreach (string key in package.Keys)
+ {
+ channels.Add(new Channel(key, package[key]));
+ }
+
+ dataGridView1.DataSource = channels;
+ }
+
+ private void ArrangeInput(object sender, EventArgs e)
+ {
+ txtInput.Left = lblPrompt.Right + 2;
+ txtInput.Width = inputPanel.ClientSize.Width - txtInput.Left;
+ }
+
+ private Stream RequestSaveStream()
+ {
+ using (SaveFileDialog dlg = new SaveFileDialog())
+ {
+ dlg.Title = "Select Save File";
+ dlg.Filter = "Quetzal save files (*.sav)|*.sav";
+
+ if (dlg.ShowDialog() == DialogResult.Cancel)
+ return null;
+ else
+ return new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write);
+ }
+ }
+
+ private Stream RequestLoadStream()
+ {
+ using (OpenFileDialog dlg = new OpenFileDialog())
+ {
+ dlg.Title = "Load a Saved Game";
+ dlg.Filter = "Quetzal save files (*.sav)|*.sav";
+
+ if (dlg.ShowDialog() == DialogResult.Cancel)
+ return null;
+ else
+ return new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
+ }
+ }
+
+ #region VM Thread
+
+ private void VMThreadProc(object dummy)
+ {
+ try
+ {
+ vm.Run();
+ this.Invoke(new Action(GameFinished));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+ }
+ }
+
+ private void vm_LineWanted(object sender, LineWantedEventArgs e)
+ {
+ this.Invoke(new Action(RequestLine));
+ inputReadyEvent.WaitOne();
+ e.Line = inputLine;
+ }
+
+ private void vm_KeyWanted(object sender, KeyWantedEventArgs e)
+ {
+ this.Invoke(new Action(RequestKey));
+ inputReadyEvent.WaitOne();
+ e.Char = inputLine[0];
+ }
+
+ private void vm_OutputReady(object sender, OutputReadyEventArgs e)
+ {
+ this.Invoke(
+ new Action>(HandleOutput),
+ e.Package);
+ }
+
+ private void vm_SaveRequested(object sender, SaveRestoreEventArgs e)
+ {
+ e.Stream = (Stream)this.Invoke(new Func(RequestSaveStream));
+ }
+
+ private void vm_LoadRequested(object sender, SaveRestoreEventArgs e)
+ {
+ e.Stream = (Stream)this.Invoke(new Func(RequestLoadStream));
+ }
+
+ #endregion
+
+ private void GameFinished()
+ {
+ this.Close();
+ }
+
+ }
+}
diff --git a/FyreChannels/MainForm.resx b/FyreChannels/MainForm.resx
new file mode 100644
index 0000000..adcef5f
--- /dev/null
+++ b/FyreChannels/MainForm.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 126, 17
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/FyreChannels/Program.cs b/FyreChannels/Program.cs
new file mode 100644
index 0000000..afe3495
--- /dev/null
+++ b/FyreChannels/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace SimpleFyre
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
diff --git a/FyreChannels/Properties/AssemblyInfo.cs b/FyreChannels/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2f4b9cc
--- /dev/null
+++ b/FyreChannels/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FyreChannels")]
+[assembly: AssemblyDescription("Channel testing tool for FyreVM and Channel IO.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Textfyre, Inc.")]
+[assembly: AssemblyProduct("FyreChannels")]
+[assembly: AssemblyCopyright("Public Domain")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("8cece35a-15cb-496d-a1f4-d4d18ae3a5c7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/FyreChannels/Properties/Resources.Designer.cs b/FyreChannels/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..df06696
--- /dev/null
+++ b/FyreChannels/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.34014
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace FyreChannels.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FyreChannels.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/FyreChannels/Properties/Resources.resx b/FyreChannels/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/FyreChannels/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/FyreChannels/Properties/Settings.Designer.cs b/FyreChannels/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..88b8b07
--- /dev/null
+++ b/FyreChannels/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.34014
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace FyreChannels.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/FyreChannels/Properties/Settings.settings b/FyreChannels/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/FyreChannels/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/FyreChannels/StoryFiles/FyreTester.ulx b/FyreChannels/StoryFiles/FyreTester.ulx
new file mode 100644
index 0000000..8af58b0
Binary files /dev/null and b/FyreChannels/StoryFiles/FyreTester.ulx differ
diff --git a/FyreChannels/app.config b/FyreChannels/app.config
new file mode 100644
index 0000000..51278a4
--- /dev/null
+++ b/FyreChannels/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/FyreVM.csproj b/FyreVM.csproj
new file mode 100644
index 0000000..089b9dc
--- /dev/null
+++ b/FyreVM.csproj
@@ -0,0 +1,81 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {E38AA41F-2CCD-4609-8820-95161669E18A}
+ Library
+ Properties
+ FyreVM
+ FyreVM
+ v4.5
+ 512
+ ..\
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\..\Downloads\FyreChannels\FyreChannels\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..cb8c946
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FyreVM")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FyreVM")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("081f3fc1-afff-4cf1-88ac-0366fe62562a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/packages.config b/packages.config
new file mode 100644
index 0000000..747efc5
--- /dev/null
+++ b/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file