Skip to content

Commit

Permalink
implemented ConsoleRead and fixed SoundPlay (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Mar 22, 2021
1 parent e6ce438 commit e31736d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
16 changes: 8 additions & 8 deletions new/AutoItInterpreter/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

//////////////////////////////////////////////////////////////////////////
// Auto-generated 2021-03-22 21:57:49.484 //
// Auto-generated 2021-03-22 22:54:08.537 //
// ANY CHANGES TO THIS DOCUMENT WILL BE LOST UPON RE-GENERATION //
//////////////////////////////////////////////////////////////////////////

using System.Reflection;
using System;

[assembly: AssemblyVersion("0.8.1875.7557")]
[assembly: AssemblyFileVersion("0.8.1875.7557")]
[assembly: AssemblyInformationalVersion("v.0.8.1875.7557, commit: 0e0fea616d6b8fd25c4843431f552d6c04661d68")]
[assembly: AssemblyVersion("0.8.1882.7557")]
[assembly: AssemblyFileVersion("0.8.1882.7557")]
[assembly: AssemblyInformationalVersion("v.0.8.1882.7557, commit: e6ce438d6474307aa98cb81ebfa7288c0394ac1a")]
[assembly: AssemblyCompany("Unknown6656")]
[assembly: AssemblyCopyright("Copyright © 2018 - 2021, Unknown6656")]
[assembly: AssemblyProduct("AutoIt-Interpreter by Unknown6656")]
Expand All @@ -35,11 +35,11 @@ public static class __module__
/// <summary>
/// The interpreter's current version.
/// </summary>
public static Version? InterpreterVersion { get; } = Version.Parse("0.8.1875.7557");
public static Version? InterpreterVersion { get; } = Version.Parse("0.8.1882.7557");
/// <summary>
/// The Git hash associated with the current build.
/// </summary>
public const string GitHash = "0e0fea616d6b8fd25c4843431f552d6c04661d68";
public const string GitHash = "e6ce438d6474307aa98cb81ebfa7288c0394ac1a";
/// <summary>
/// The name of the GitHub repository associated with <see cref="RepositoryURL"/>.
/// </summary>
Expand All @@ -49,7 +49,7 @@ public static class __module__
/// </summary>
public const string RepositoryURL = "https://github.com/Unknown6656/AutoIt-Interpreter";
/// <summary>
/// The date and time of the current build (2021-03-22 21:57:49.484).
/// The date and time of the current build (2021-03-22 22:54:08.537).
/// </summary>
public static DateTime DateBuilt { get; } = DateTime.FromFileTimeUtc(0x01d71f5e0492eee9L);
public static DateTime DateBuilt { get; } = DateTime.FromFileTimeUtc(0x01d71f65e2a58a60L);
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public FrameworkFunctions(Interpreter interpreter)
RegisterFunction(nameof(ShellExecute), 1, 5, ShellExecute, Variant.EmptyString, Variant.EmptyString, Variant.Default, Variant.Default);
RegisterFunction(nameof(ShellExecuteWait), 1, 5, ShellExecuteWait, Variant.EmptyString, Variant.EmptyString, Variant.Default, Variant.Default);
RegisterFunction(nameof(SoundPlay), 1, 2, SoundPlay, Variant.Zero);
RegisterFunction(nameof(SoundSetWaveVolume), 1, SoundSetWaveVolume);
// RegisterFunction(nameof(SoundSetWaveVolume), 1, SoundSetWaveVolume);
RegisterFunction(nameof(StringAddCR), 1, StringAddCR);
RegisterFunction(nameof(StringCompare), 2, 3, StringCompare, Variant.Zero);
RegisterFunction(nameof(StringFormat), 1, 33, StringFormat);
Expand Down Expand Up @@ -529,10 +529,14 @@ internal static FunctionReturnValue ConsoleRead(CallFrame frame, Variant[] args)
{
bool peek = args[0].ToBoolean();
bool binary = args[1].ToBoolean();
int input = peek ? Console.In.Peek() : Console.In.Read();

// TODO

throw new NotImplementedException();
if (input < 0)
return FunctionReturnValue.Error(1);
else if (binary)
return Variant.FromBinary(new[] { (byte)(input & 0xff) });
else
return Variant.FromString(new string(new[] { (char)input }));
});

internal static FunctionReturnValue Cos(CallFrame frame, Variant[] args) => (Variant)Math.Cos((double)args[0].ToNumber());
Expand Down Expand Up @@ -2774,7 +2778,7 @@ internal FunctionReturnValue SoundPlay(CallFrame frame, Variant[] args)
bool wait = args[1].ToBoolean();
ProcessStartInfo pfi = new(path)
{
Arguments = Path.GetFileName(path) + " --play-and-exit",
Arguments = $"-I null --play-and-exit --qt-start-minimized \"{path}\"",
UseShellExecute = true,
WorkingDirectory = Path.GetDirectoryName(path)!,
FileName = NativeInterop.DoPlatformDependent("vlc.exe", "cvlc"),
Expand Down
4 changes: 2 additions & 2 deletions new/AutoItInterpreter/version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
0.8.1875.7557
0e0fea616d6b8fd25c4843431f552d6c04661d68
0.8.1882.7557
e6ce438d6474307aa98cb81ebfa7288c0394ac1a
11 changes: 11 additions & 0 deletions new/test/test.au3
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
$sOutput = ""
While True
$sOutput &= ConsoleRead()
If @error or StringLen($soutput) > 20 Then ExitLoop
Sleep(25)
WEnd
ConsoleWrite(@CRLF&@crlf&$sOutput)
exit



func my_func()
ConsoleWriteLine("A")
endfunc
Expand Down

0 comments on commit e31736d

Please sign in to comment.