mirror of
https://github.com/livingcomputermuseum/ContrAlto.git
synced 2026-03-02 09:46:53 +00:00
Initial commit of changes for 1.2.3. This includes:
- Scripting support: Allows for recording and playback of mouse/keyboard input and various system control actions. Simple (i.e. basic) scripting format. - Fix for stale packets left in ethernet input queue; packets received by pcap while Alto's receiver is off are discarded. - Mouse input made more accurate, and tweaked to avoid Alto microcode bug that causes erroneous mouse inputs under very rare circumstances on real hardware, but much more frequently under emulation. - Small code cleanup here and there. Moved many UI strings to resources, many more to go.
This commit is contained in:
42
Contralto/Scripting/ScriptWriter.cs
Normal file
42
Contralto/Scripting/ScriptWriter.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contralto.Scripting
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ScriptWriter
|
||||
{
|
||||
public ScriptWriter(string scriptPath)
|
||||
{
|
||||
_scriptWriter = new StreamWriter(scriptPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new ScriptAction to the queue
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
public void AppendAction(ScriptAction action)
|
||||
{
|
||||
if (_scriptWriter == null)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot write to closed ScriptWriter.");
|
||||
}
|
||||
|
||||
_scriptWriter.WriteLine(action.ToString());
|
||||
}
|
||||
|
||||
public void End()
|
||||
{
|
||||
_scriptWriter.Close();
|
||||
_scriptWriter = null;
|
||||
}
|
||||
|
||||
private StreamWriter _scriptWriter;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user