+
@foreach (var notification in NotificationService.Notifications)
{
-
- @notification.Key (@notification.Value)
+
+ @notification.Key @(notification.Value > 1 ? $"({notification.Value})" : "")
}
+
@code {
@@ -20,5 +22,8 @@
///
protected override void OnInitialized()
- => NotificationService.SetOnNotificationsChanged(StateHasChanged);
+ {
+ NotificationService.SetInvokeAsync(InvokeAsync);
+ NotificationService.SetOnNotificationsChanged(StateHasChanged);
+ }
}
diff --git a/Launcher/wwwroot/css/app.css b/Launcher/wwwroot/css/app.css
index 330049c..aad5a54 100644
--- a/Launcher/wwwroot/css/app.css
+++ b/Launcher/wwwroot/css/app.css
@@ -96,4 +96,9 @@ p, h1, h4, a, td, tr, div, .prevent-select {
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
+}
+
+.page {
+ height: 100%;
+ display: flow-root;
}
\ No newline at end of file
diff --git a/SharpEngine.Shared/EnvironmentVariables.cs b/SharpEngine.Shared/EnvironmentVariables.cs
new file mode 100644
index 0000000..3d18fd1
--- /dev/null
+++ b/SharpEngine.Shared/EnvironmentVariables.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SharpEngine.Shared;
+public static class EnvironmentVariables
+{
+ public const string EDITOR_PATH_ENVIRONMENT_VARIABLE = "SHARPENGINE_EDITOR_PATH";
+
+}
diff --git a/SharpEngine.Shared/ProcessExtensions.cs b/SharpEngine.Shared/ProcessExtensions.cs
index 03a72d9..4df59f7 100644
--- a/SharpEngine.Shared/ProcessExtensions.cs
+++ b/SharpEngine.Shared/ProcessExtensions.cs
@@ -22,11 +22,49 @@ public static Process GetProcess(string arguments, bool createWindow = false)
StartInfo = new ProcessStartInfo
{
FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd.exe" : "/bin/sh",
- Arguments = arguments,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- UseShellExecute = false,
- CreateNoWindow = createWindow
+ Arguments = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"/k {arguments}" : $"-k \"{arguments}\"",
+ UseShellExecute = true,
+ RedirectStandardOutput = false,
+ CreateNoWindow = false,
+ WindowStyle = ProcessWindowStyle.Normal
}
};
+
+ public static void RunProcess(string arguments, bool createWindow = true, Action
? onMessage = null)
+ {
+ void SendMessage(string msg)
+ {
+ if (!string.IsNullOrWhiteSpace(msg))
+ onMessage?.Invoke(msg);
+ }
+
+ var process = GetProcess(arguments, createWindow);
+ process.ErrorDataReceived += (sender, e) => SendMessage(e.Data);
+ process.OutputDataReceived += (sender, e) => SendMessage(e.Data);
+ process.Exited += (sender, e) => SendMessage("Process exited.");
+
+ var start = new ThreadStart(() =>
+ {
+ try
+ {
+ process.Start();
+
+ // Start reading output and error streams
+ // process.BeginOutputReadLine();
+ // process.BeginErrorReadLine();
+
+ // Wait for the process to exit
+ process.WaitForExit();
+ }
+ catch (Exception ex)
+ {
+ SendMessage($"Exception occurred: {ex.Message}");
+ }
+ });
+
+ Thread thread = new Thread(start);
+ thread.Start();
+
+ SendMessage("Editor launched.");
+ }
}
diff --git a/SharpEngine.Shared/Project.cs b/SharpEngine.Shared/Project.cs
index aad3658..5cac973 100644
--- a/SharpEngine.Shared/Project.cs
+++ b/SharpEngine.Shared/Project.cs
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
+using System.Text.Json;
using System.Text.Json.Serialization;
namespace Launcher.UI;
@@ -30,4 +31,15 @@ public class Project
///
[JsonIgnore]
public DateTime LastModified { get; set; } = DateTime.Now;
+
+ ///
+ /// Loads the given project file.
+ ///
+ /// The file containing the project to load.
+ /// The loaded project. If unable to load, .
+ public static Project? LoadProject(string projectFile)
+ {
+ var json = File.ReadAllText(projectFile);
+ return JsonSerializer.Deserialize(json);
+ }
}