diff --git a/src/Serein.Core/Services/Servers/ServerManager.cs b/src/Serein.Core/Services/Servers/ServerManager.cs
index 40ce215f..b934b2d2 100644
--- a/src/Serein.Core/Services/Servers/ServerManager.cs
+++ b/src/Serein.Core/Services/Servers/ServerManager.cs
@@ -187,6 +187,7 @@ private void LoadAll()
if (!Directory.Exists(PathConstants.ServerConfigDirectory))
{
Directory.CreateDirectory(PathConstants.ServerConfigDirectory);
+ Add("myserver", new());
return;
}
diff --git a/src/Serein.Lite/Serein.Lite.csproj b/src/Serein.Lite/Serein.Lite.csproj
index be759ab1..1d5734d2 100644
--- a/src/Serein.Lite/Serein.Lite.csproj
+++ b/src/Serein.Lite/Serein.Lite.csproj
@@ -7,11 +7,13 @@
../Sources/logo.ico
true
win-x64
+ LITE;
+
diff --git a/src/Serein.Lite/Ui/MainForm.Designer.cs b/src/Serein.Lite/Ui/MainForm.Designer.cs
index 231bb898..59712031 100644
--- a/src/Serein.Lite/Ui/MainForm.Designer.cs
+++ b/src/Serein.Lite/Ui/MainForm.Designer.cs
@@ -101,14 +101,14 @@ private void InitializeComponent()
//
ServerAddToolStripMenuItem.Name = "ServerAddToolStripMenuItem";
ServerAddToolStripMenuItem.Size = new Size(219, 44);
- ServerAddToolStripMenuItem.Text = "添加";
+ ServerAddToolStripMenuItem.Text = "添加...";
ServerAddToolStripMenuItem.Click += ServerAddToolStripMenuItem_Click;
//
// ServerEditToolStripMenuItem
//
ServerEditToolStripMenuItem.Name = "ServerEditToolStripMenuItem";
ServerEditToolStripMenuItem.Size = new Size(219, 44);
- ServerEditToolStripMenuItem.Text = "编辑";
+ ServerEditToolStripMenuItem.Text = "编辑...";
ServerEditToolStripMenuItem.Click += ServerEditToolStripMenuItem_Click;
//
// ServerRemoveToolStripMenuItem
diff --git a/src/Serein.Plus/App.xaml.cs b/src/Serein.Plus/App.xaml.cs
index 8bd4eea6..2d315505 100644
--- a/src/Serein.Plus/App.xaml.cs
+++ b/src/Serein.Plus/App.xaml.cs
@@ -5,17 +5,14 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
-using Ookii.Dialogs.Wpf;
-
using Serein.Core;
using Serein.Core.Models.Output;
using Serein.Core.Services;
-using Serein.Core.Utils;
-using Serein.Core.Utils.Extensions;
using Serein.Plus.Pages;
using Serein.Plus.Pages.Settings;
using Serein.Plus.Services;
using Serein.Plus.Services.Loggers;
+using Serein.Plus.Utils;
using Serein.Plus.ViewModels;
namespace Serein.Plus;
@@ -27,9 +24,9 @@ public partial class App : Application
public App()
{
ShutdownMode = ShutdownMode.OnMainWindowClose;
- DispatcherUnhandledException += static (_, e) => ShowErrorDialog(e.Exception);
+ DispatcherUnhandledException += static (_, e) => DialogFactory.ShowErrorDialog(e.Exception);
AppDomain.CurrentDomain.UnhandledException += static (_, e) =>
- ShowErrorDialog((Exception)e.ExceptionObject);
+ DialogFactory.ShowErrorDialog((Exception)e.ExceptionObject);
}
private static IHost Build()
@@ -82,50 +79,4 @@ private void Application_Exit(object sender, ExitEventArgs e)
{
_app.StopAsync();
}
-
- private static void ShowErrorDialog(Exception e)
- {
- try
- {
- var fileName = CrashHelper.CreateLog(e);
- var button1 = new TaskDialogButton("GitHub Issue")
- {
- CommandLinkNote = "【推荐】在GitHub上反馈,方便作者定位和跟踪问题",
- };
- var button2 = new TaskDialogButton("交流群")
- {
- CommandLinkNote = "通过共同讨论分析和确定问题,但效率可能较低",
- };
-
- var dialog = new TaskDialog
- {
- Buttons = { new(ButtonType.Ok), button1, button2 },
- CenterParent = true,
- Content =
- $"{e.GetType().FullName}: {e.Message} \r\n\r\n"
- + $"完整崩溃日志已保存在 {fileName},请先善用搜索引擎寻找解决方案。\r\n"
- + "在确定不是自身问题(如文件语法不正确、文件缺失等)后,你可以通过以下方式反馈此问题,帮助我们更好的改进 Serein!",
- EnableHyperlinks = true,
- Footer = "反馈问题时你应该上传崩溃日志文件,而不是此窗口的截图",
- FooterIcon = TaskDialogIcon.Warning,
- ExpandedInformation = e.StackTrace,
- MainIcon = TaskDialogIcon.Error,
- MainInstruction = "唔……崩溃了(っ °Д °;)っ",
- WindowTitle = "Serein.Plus",
- ButtonStyle = TaskDialogButtonStyle.CommandLinks,
- };
-
- var btn = dialog.ShowDialog();
-
- if (btn == button1)
- {
- UrlConstants.Issues.OpenInBrowser();
- }
- else if (btn == button2)
- {
- UrlConstants.Group.OpenInBrowser();
- }
- }
- catch { }
- }
}
diff --git a/src/Serein.Plus/Dialogs/WelcomeDialog.xaml b/src/Serein.Plus/Dialogs/WelcomeDialog.xaml
index 8762362f..3cdb7570 100644
--- a/src/Serein.Plus/Dialogs/WelcomeDialog.xaml
+++ b/src/Serein.Plus/Dialogs/WelcomeDialog.xaml
@@ -28,7 +28,7 @@
官网文档:
- serein.cc
+ sereindev.github.io
diff --git a/src/Serein.Plus/MainWindow.xaml.cs b/src/Serein.Plus/MainWindow.xaml.cs
index d92225fd..4364a9cc 100644
--- a/src/Serein.Plus/MainWindow.xaml.cs
+++ b/src/Serein.Plus/MainWindow.xaml.cs
@@ -26,10 +26,10 @@
using Serein.Core.Services.Servers;
using Serein.Core.Utils;
using Serein.Plus.Commands;
-using Serein.Plus.Dialogs;
using Serein.Plus.Models;
using Serein.Plus.Pages;
using Serein.Plus.Services;
+using Serein.Plus.Utils;
namespace Serein.Plus;
@@ -90,7 +90,14 @@ TitleUpdater titleUpdater
{
if (_updateChecker.Newest is not null)
{
- Dispatcher.Invoke(() => ShowBalloonTip("发现新版本", _updateChecker.Newest.TagName, BalloonIcon.Info));
+ Dispatcher.Invoke(
+ () =>
+ ShowBalloonTip(
+ "发现新版本",
+ _updateChecker.Newest.TagName,
+ BalloonIcon.Info
+ )
+ );
}
};
}
@@ -156,7 +163,7 @@ private void Window_ContentRendered(object sender, EventArgs e)
{
if (SereinAppBuilder.StartForTheFirstTime)
{
- new WelcomeDialog().ShowAsync();
+ DialogFactory.ShowWelcomeDialog();
}
if (FileLoggerProvider.IsEnabled)
@@ -167,9 +174,9 @@ private void Window_ContentRendered(object sender, EventArgs e)
Content = new TextBlock
{
Text =
- $"在此模式下,应用程序会将完整的调试日志保存在\"{PathConstants.LogDirectory}/app\"目录下(可能很大很大很大,并对硬盘的读写速度产生一定影响)\r\n"
- + "除非你知道你在干什么 / 是开发者要求的,请不要在此模式下运行Serein!!\r\n\r\n"
- + "当然你也不需要太担心,若要退出此模式只需要重新启动就行啦 :D",
+ $"在此模式下,应用程序会将完整的调试日志保存在\"{PathConstants.LogDirectory}/app\"目录下(可能很大很大很大,并对硬盘的读写速度产生一定影响)\r\n"
+ + "除非你知道你在干什么 / 是开发者要求的,请不要在此模式下运行Serein!!\r\n\r\n"
+ + "当然你也不需要太担心,若要退出此模式只需要重新启动就行啦 :D",
},
CloseButtonText = "我知道了",
DefaultButton = ContentDialogButton.Close,
@@ -232,7 +239,9 @@ public void ShowInfoBar(InfoBarTask infoBarTask)
{
GlobalInfoBar.Title = infoBarTask.Title;
GlobalInfoBar.Content = infoBarTask.Content;
- GlobalInfoBar.Message = string.IsNullOrEmpty(infoBarTask.Message) ? " " : infoBarTask.Message;
+ GlobalInfoBar.Message = string.IsNullOrEmpty(infoBarTask.Message)
+ ? " "
+ : infoBarTask.Message;
GlobalInfoBar.Severity = infoBarTask.Severity;
var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
diff --git a/src/Serein.Plus/Serein.Plus.csproj b/src/Serein.Plus/Serein.Plus.csproj
index 7a24dc80..2caa0cb0 100644
--- a/src/Serein.Plus/Serein.Plus.csproj
+++ b/src/Serein.Plus/Serein.Plus.csproj
@@ -6,11 +6,13 @@
true
../Sources/logo.ico
win-x64
+ PLUS;
+
diff --git a/src/Serein.Tests/Services/NetPlugin/EventTests.cs b/src/Serein.Tests/Services/NetPlugin/EventTests.cs
index 283b419d..e1f080d4 100644
--- a/src/Serein.Tests/Services/NetPlugin/EventTests.cs
+++ b/src/Serein.Tests/Services/NetPlugin/EventTests.cs
@@ -31,6 +31,7 @@ public EventTests()
_netPluginLoader = _host.Services.GetRequiredService();
Directory.CreateDirectory(PathConstants.PluginsDirectory);
+ Directory.CreateDirectory(Path.Join(PathConstants.PluginsDirectory, "test"));
}
public void Dispose()
@@ -42,7 +43,7 @@ public void Dispose()
[Fact]
public async Task ShouldInvokePluginLoadedEvent()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
using System;
using System.Threading.Tasks;
@@ -92,7 +93,7 @@ protected override Task OnPluginsLoaded()
[Fact]
public async Task ShouldInvokeServerEvent()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
using System;
using System.Collections.Generic;
diff --git a/src/Serein.Tests/Services/NetPlugin/LoadTests.cs b/src/Serein.Tests/Services/NetPlugin/LoadTests.cs
index 2afd2c73..2e0a556e 100644
--- a/src/Serein.Tests/Services/NetPlugin/LoadTests.cs
+++ b/src/Serein.Tests/Services/NetPlugin/LoadTests.cs
@@ -28,7 +28,6 @@ public LoadTests()
_host = HostFactory.BuildNew();
_netPluginLoader = _host.Services.GetRequiredService();
- Directory.CreateDirectory(PathConstants.PluginsDirectory);
Directory.CreateDirectory(Path.Join(PathConstants.PluginsDirectory, "test"));
}
@@ -41,7 +40,7 @@ public void Dispose()
[Fact]
public async Task ShouldNotLoadNetPluginWithoutValidPluginClass()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
namespace EmptyPlugin;
public class EmptyClass{}
@@ -73,7 +72,7 @@ public class EmptyClass{}
[Fact]
public async Task ShouldNotLoadNetPluginWithTwoPluginClasses()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
using Serein.Core.Models.Plugins.Net;
@@ -120,7 +119,7 @@ public override void Dispose() { }
[Fact]
public async Task ShouldLoadNetPluginWithValidAssembly()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
using Serein.Core.Models.Plugins.Net;
@@ -158,7 +157,7 @@ public override void Dispose() { }
[Fact]
public async Task ShouldLoadNetPluginWithoutSpecifyingEntryFile()
{
- CSharpCompilationOptionsHelper.Compile(
+ CSharpCompilationHelper.Compile(
"""
using System;
using Serein.Core.Models.Plugins.Net;
diff --git a/src/Serein.Tests/Utils/CSharpCompilationOptionsHelper.cs b/src/Serein.Tests/Utils/CSharpCompilationHelper.cs
similarity index 97%
rename from src/Serein.Tests/Utils/CSharpCompilationOptionsHelper.cs
rename to src/Serein.Tests/Utils/CSharpCompilationHelper.cs
index c79c748f..299ac27e 100644
--- a/src/Serein.Tests/Utils/CSharpCompilationOptionsHelper.cs
+++ b/src/Serein.Tests/Utils/CSharpCompilationHelper.cs
@@ -10,7 +10,7 @@ namespace Serein.Tests.Utils;
#pragma warning disable IL3000
-public static class CSharpCompilationOptionsHelper
+public static class CSharpCompilationHelper
{
private static readonly CSharpCompilationOptions Default = new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary
diff --git a/src/Serein.Lite/Utils/DialogFactory.cs b/src/Shared/Utils/DialogFactory.cs
similarity index 97%
rename from src/Serein.Lite/Utils/DialogFactory.cs
rename to src/Shared/Utils/DialogFactory.cs
index 5aaf18b3..f5bec389 100644
--- a/src/Serein.Lite/Utils/DialogFactory.cs
+++ b/src/Shared/Utils/DialogFactory.cs
@@ -1,11 +1,16 @@
using System;
-using Ookii.Dialogs.WinForms;
-
using Serein.Core.Utils;
using Serein.Core.Utils.Extensions;
+#if LITE
+using Ookii.Dialogs.WinForms;
namespace Serein.Lite.Utils;
+#elif PLUS
+using Ookii.Dialogs.Wpf;
+namespace Serein.Plus.Utils;
+#endif
+
public static class DialogFactory
{
public static void ShowWelcomeDialog()
@@ -98,6 +103,7 @@ public static void ShowErrorDialog(Exception e)
catch { }
}
+#if LITE
public static void ShowWarningDialogOfLogMode()
{
var dialog = new TaskDialog
@@ -115,4 +121,5 @@ public static void ShowWarningDialogOfLogMode()
dialog.ShowDialog();
}
+#endif
}
diff --git a/src/Sources/console/custom.css b/src/Sources/console/custom.css
index bfec5861..30a64eb4 100644
--- a/src/Sources/console/custom.css
+++ b/src/Sources/console/custom.css
@@ -1,41 +1,6 @@
-/*
- 用于自定义特殊高亮样式
- - 需以 ".custom> " 开头
- - 用".[NAME]"指定高亮对象
-*/
-.custom > .file {
- color: #688292;
-}
-
-.custom > .server {
- color: #8bd645;
-}
-
-.custom > .debug {
- color: #865fc5;
-}
-
-.custom > .error {
- color: #d16969;
-}
-
-.custom > .warn {
- color: #aa5612;
-}
-
-.custom > .info {
- color: #20b2aa;
-}
-
-.custom > .LiteLoader,
-.custom > .LiteXLoader,
-.custom > .LLMoney {
- color: #5a93c2;
-}
-
-/*
- 颜色参考来源:https://en.wikipedia.org/wiki/ANSI_escape_code
-*/
+/**
+ * 颜色参考来源:https://en.wikipedia.org/wiki/ANSI_escape_code
+ */
.ansi30 {
color: #0c0c0c;
}