Daily update on 20250618-051714 by Nitload Youmu. Additional Message : Brief support to collection operation in EXPRESS. A collection type added in core lib and compilestack.

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-06-18 05:17:14 +08:00
parent 74c01effe4
commit c624a8ca38
300 changed files with 12227 additions and 4303 deletions
+45 -51
View File
@@ -46,59 +46,45 @@ namespace StgSharp
private static Process? _dialogueProcess;
private static AnonymousPipeServerStream _dialogueClientPipe,_dialogueServerPipe;
private static ConcurrentBag<string> msgCache = new ConcurrentBag<string>(
);
private static ConcurrentBag<string> msgCache = new ConcurrentBag<string>();
private static int _readAndWriteThreadId;
private static ProcessStartInfo _dialogueProcessInfo;
private static StreamReader _dr;
private static StreamWriter _dw;
public static bool NeedShowWhenStartup
public static bool NeedShowWhenStartup { get; set; }
public static void PostError( Exception ex )
{
get;
set;
CreateDialogueProcessIfNotExist();
_dw.WriteLine( $"posterror {ex.Message}" );
_dialogueProcess!.Exited -= DialogueProcessExitCallback;
}
public static void SetReadAndWriteThread(Thread thread)
public static void SetReadAndWriteThread( Thread thread )
{
_readAndWriteThreadId = thread.ManagedThreadId;
}
private static void AssertThread()
{
if (_readAndWriteThreadId != Environment.CurrentManagedThreadId)
{
throw new InvalidOperationException("Communication with dialogue can only call from certain thread.");
}
}
internal static void CreateDialogueProcessIfNotExist()
{
if( _dialogueProcess != null ) {
return;
}
if (!File.Exists(_dialogueProcessInfo.FileName))
{
}
if( !File.Exists( _dialogueProcessInfo.FileName ) ) { }
_dialogueProcess = Process.Start( _dialogueProcessInfo );
_dr = new StreamReader(_dialogueClientPipe);
_dw = new StreamWriter(_dialogueServerPipe);
_dr = new StreamReader( _dialogueClientPipe );
_dw = new StreamWriter( _dialogueServerPipe );
_dialogueProcess!.Exited += DialogueProcessExitCallback;
_dialogueProcess!.Exited += DialogueProcessExitCallback;
_dialogueServerPipe.DisposeLocalCopyOfClientHandle();
_dialogueClientPipe.DisposeLocalCopyOfClientHandle();
}
private static void DialogueProcessExitCallback(object? sender, EventArgs e)
{
_dialogueProcess = null;
_dr.Close();
_dw.Close();
}
internal static void LoadDialogue()
{
_dialogueServerPipe = new AnonymousPipeServerStream(
@@ -106,21 +92,25 @@ namespace StgSharp
_dialogueClientPipe = new AnonymousPipeServerStream(
PipeDirection.In, HandleInheritability.Inheritable );
string route = Assembly.GetAssembly( typeof( StgSharp ) ).Location;
string route = Assembly.GetAssembly( typeof( World ) ).Location;
string path = Path.GetDirectoryName( route );
string exeName;
if( RuntimeInformation.IsOSPlatform( OSPlatform.Windows ) ) {
if( RuntimeInformation.IsOSPlatform( OSPlatform.Windows ) )
{
exeName = ".exe";
} else if( RuntimeInformation.IsOSPlatform( OSPlatform.Linux ) || RuntimeInformation.IsOSPlatform(
OSPlatform.OSX ) ) {
} else if( RuntimeInformation.IsOSPlatform( OSPlatform.Linux ) ||
RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) )
{
exeName = string.Empty;
} else {
} else
{
throw new PlatformNotSupportedException( "Unknown OS platform" );
}
string consoleRoute = Path.Combine(path, @"StgSharpTerminalDialogue", $@"StgSharpTerminalDialogue{exeName}");
string consoleRoute = Path.Combine(
path, @"StgSharpTerminalDialogue", $@"StgSharpTerminalDialogue{exeName}" );
_dialogueProcessInfo = new ProcessStartInfo
{
@@ -129,26 +119,13 @@ namespace StgSharp
UseShellExecute = true,
RedirectStandardOutput = false,
};
}
internal static void PostMessage(
string instruction,
params string[] operands)
internal static void PostMessage( string instruction, params string[] operands )
{
CreateDialogueProcessIfNotExist();
_dw.WriteLine($"{instruction} {operands}");
}
public static void PostError(Exception ex)
{
CreateDialogueProcessIfNotExist();
_dw.WriteLine($"posterror {ex.Message}");
_dialogueProcess!.Exited -= DialogueProcessExitCallback;
_dw.WriteLine( $"{instruction} {operands}" );
}
internal static void UnloadDialogue()
@@ -169,10 +146,12 @@ namespace StgSharp
}
string temp = string .Empty;
do {
do
{
temp = _dr.ReadLine();
temp = temp ?? string.Empty;
if( !temp!.StartsWith( target ) ) {
if( !temp!.StartsWith( target ) )
{
break;
}
} while (true);
@@ -181,5 +160,20 @@ namespace StgSharp
return index != -1 ? temp.Substring( index + 1 ) : string.Empty;
}
private static void AssertThread()
{
if( _readAndWriteThreadId != Environment.CurrentManagedThreadId ) {
throw new InvalidOperationException(
"Communication with dialogue can only call from certain thread." );
}
}
private static void DialogueProcessExitCallback( object? sender, EventArgs e )
{
_dialogueProcess = null;
_dr.Close();
_dw.Close();
}
}
}