diff --git a/src/AutumnBox.ADBProvider/Win32AdbManager.cs b/src/AutumnBox.ADBProvider/Win32AdbManager.cs
index a3bb3ca4a..62ca1bd1a 100644
--- a/src/AutumnBox.ADBProvider/Win32AdbManager.cs
+++ b/src/AutumnBox.ADBProvider/Win32AdbManager.cs
@@ -11,11 +11,13 @@ public class Win32AdbManager : StandardAdbManager, IAdbManager
private static readonly string[] files = { "adb.exe", "AdbWinApi.dll", "AdbWinUsbApi.dll", "fastboot.exe", "libwinpthread-1.dll" };
private const string FILES_NAMESPACE = "AutumnBox.ADBProvider.adb_tools";
+ public static DirectoryInfo AdbToolsDirectory { get; set; } = null;
+
protected override DirectoryInfo InitializeClientFiles()
{
string temp = Environment.GetEnvironmentVariable("TEMP");
var toolsPath = Path.Combine(temp, "autumnbox_adb_tools/");
- var toolsDir = new DirectoryInfo(toolsPath);
+ var toolsDir = AdbToolsDirectory ?? new DirectoryInfo(toolsPath);
if (!toolsDir.Exists) toolsDir.Create();
ExtractFilesTo(toolsDir);
return toolsDir;
diff --git a/src/AutumnBox.Basic.Shared/ModuleInfo.cs b/src/AutumnBox.Basic.Shared/ModuleInfo.cs
index 8843740bb..81b38674e 100644
--- a/src/AutumnBox.Basic.Shared/ModuleInfo.cs
+++ b/src/AutumnBox.Basic.Shared/ModuleInfo.cs
@@ -28,6 +28,6 @@ public static class ModuleInfo
/// 指示版本
///
public static Version Version => Version.Parse(VERSION_STR);
- const string VERSION_STR = "2020.5.18";
+ const string VERSION_STR = "2020.5.19";
}
}
diff --git a/src/AutumnBox.Essentials/Extensions/ETest.cs b/src/AutumnBox.Essentials/Extensions/ETest.cs
new file mode 100644
index 000000000..bf9644cd7
--- /dev/null
+++ b/src/AutumnBox.Essentials/Extensions/ETest.cs
@@ -0,0 +1,37 @@
+/*
+
+* ==============================================================================
+*
+* Filename: ETest
+* Description:
+*
+* Version: 1.0
+* Created: 2020/5/19 20:33:29
+* Compiler: Visual Studio 2019
+*
+* Author: zsh2401
+*
+* ==============================================================================
+*/
+using AutumnBox.OpenFramework.Extension;
+using AutumnBox.OpenFramework.Extension.Leaf;
+using AutumnBox.OpenFramework.Open.LKit;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace AutumnBox.Essentials.Extensions
+{
+ [ExtName("test")]
+ [ExtDeveloperMode]
+ class ETest : LeafExtensionBase
+ {
+ [LMain]
+ public void EntryPoint(ILeafUI _ui)
+ {
+ using var ui = _ui;
+ ui.Show();
+ throw new Exception("test_error");
+ }
+ }
+}
diff --git a/src/AutumnBox.GUI/App.xaml b/src/AutumnBox.GUI/App.xaml
index b50e5636a..bc7364b35 100644
--- a/src/AutumnBox.GUI/App.xaml
+++ b/src/AutumnBox.GUI/App.xaml
@@ -19,6 +19,8 @@
+
+
diff --git a/src/AutumnBox.GUI/Resources/AppCommonResource.xaml b/src/AutumnBox.GUI/Resources/AppCommonResource.xaml
new file mode 100644
index 000000000..8b6e6cd7e
--- /dev/null
+++ b/src/AutumnBox.GUI/Resources/AppCommonResource.xaml
@@ -0,0 +1,6 @@
+
+
+ Microsoft YaHei UI Light
+
\ No newline at end of file
diff --git a/src/AutumnBox.GUI/Resources/Languages/zh-CN.xaml b/src/AutumnBox.GUI/Resources/Languages/zh-CN.xaml
index 9c0c386e9..c56b893bf 100644
--- a/src/AutumnBox.GUI/Resources/Languages/zh-CN.xaml
+++ b/src/AutumnBox.GUI/Resources/Languages/zh-CN.xaml
@@ -75,14 +75,12 @@
开机时间
秋之盒版本
- 图形界面
- 核心模块
+ ADB交互模块
+ SDK
ADB
- Basic封装库
- 开放框架
- 调试器
+
操作系统
- .NET环境
+ .NET Core
QQ群
电子邮件
@@ -239,6 +237,8 @@
请耐心等待 :)
+ 复制
+
运行中
这个模块无法中途停止
diff --git a/src/AutumnBox.GUI/Services/IStorageManager.cs b/src/AutumnBox.GUI/Services/IStorageManager.cs
new file mode 100644
index 000000000..cbd1765a4
--- /dev/null
+++ b/src/AutumnBox.GUI/Services/IStorageManager.cs
@@ -0,0 +1,28 @@
+/*
+
+* ==============================================================================
+*
+* Filename: IStorageManager
+* Description:
+*
+* Version: 1.0
+* Created: 2020/5/19 19:56:32
+* Compiler: Visual Studio 2019
+*
+* Author: zsh2401
+*
+* ==============================================================================
+*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace AutumnBox.GUI.Services
+{
+ interface IStorageManager
+ {
+ DirectoryInfo CacheDirectory { get; }
+ DirectoryInfo StorageDirectory { get; }
+ }
+}
diff --git a/src/AutumnBox.GUI/Services/Impl/AutumnBoxGuiBaseApiImpl.cs b/src/AutumnBox.GUI/Services/Impl/AutumnBoxGuiBaseApiImpl.cs
index bf5aba831..ce166d8a6 100644
--- a/src/AutumnBox.GUI/Services/Impl/AutumnBoxGuiBaseApiImpl.cs
+++ b/src/AutumnBox.GUI/Services/Impl/AutumnBoxGuiBaseApiImpl.cs
@@ -18,6 +18,7 @@
using AutumnBox.Logging;
using AutumnBox.Leafx.Container.Support;
using System.Threading.Tasks;
+using System.IO;
namespace AutumnBox.GUI.Services.Impl
{
@@ -47,8 +48,6 @@ public Version Version
public bool ShouldDisplayCmdWindow => Settings.Default.DisplayCmdWindow;
- public Version NewtonsoftJsonVersion => VersionInfos.JsonLib;
-
public Version AutumnBoxLoggingVersion => VersionInfos.Logging;
public Version AutumnBoxGUIVersion => VersionInfos.GUI;
@@ -57,6 +56,10 @@ public Version Version
public IRegisterableLake GlobalLake => (IRegisterableLake)App.Current.Lake;
+ public DirectoryInfo StorageDirectory => this.GetComponent().StorageDirectory;
+
+ public DirectoryInfo TempDirectory => this.GetComponent().CacheDirectory;
+
public void ShowDebugUI()
{
new LogWindow().Show();
@@ -128,7 +131,8 @@ public AutumnBoxGuiBaseApiImpl()
{
LanguageChanged?.Invoke(this, new EventArgs());
};
- }
+ }
+
private static LoadingWindow loadingWindow;
public event EventHandler LanguageChanged;
diff --git a/src/AutumnBox.GUI/Services/Impl/StorageManagerImpl.cs b/src/AutumnBox.GUI/Services/Impl/StorageManagerImpl.cs
new file mode 100644
index 000000000..f27b148e0
--- /dev/null
+++ b/src/AutumnBox.GUI/Services/Impl/StorageManagerImpl.cs
@@ -0,0 +1,41 @@
+/*
+
+* ==============================================================================
+*
+* Filename: StorageManagerImpl
+* Description:
+*
+* Version: 1.0
+* Created: 2020/5/19 19:57:18
+* Compiler: Visual Studio 2019
+*
+* Author: zsh2401
+*
+* ==============================================================================
+*/
+using AutumnBox.Leafx.Container.Support;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace AutumnBox.GUI.Services.Impl
+{
+ [Component(Type = typeof(IStorageManager))]
+ class StorageManagerImpl : IStorageManager
+ {
+ public StorageManagerImpl()
+ {
+ string temp = Environment.GetEnvironmentVariable("TEMP");
+ CacheDirectory = new DirectoryInfo(Path.Combine(temp, "autumnbox_temp"));
+ if (!CacheDirectory.Exists) CacheDirectory.Create();
+
+ string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ StorageDirectory = new DirectoryInfo(Path.Combine(appData, "autumnbox"));
+ if (!StorageDirectory.Exists) StorageDirectory.Create();
+ }
+ public DirectoryInfo CacheDirectory { get; }
+
+ public DirectoryInfo StorageDirectory { get; }
+ }
+}
diff --git a/src/AutumnBox.GUI/Util/Loader/GeneralAppLoader.cs b/src/AutumnBox.GUI/Util/Loader/GeneralAppLoader.cs
index 29a29a215..b77e5690a 100644
--- a/src/AutumnBox.GUI/Util/Loader/GeneralAppLoader.cs
+++ b/src/AutumnBox.GUI/Util/Loader/GeneralAppLoader.cs
@@ -9,6 +9,7 @@
using HandyControl.Data;
using HandyControl.Tools;
using System;
+using System.IO;
using System.Linq;
using System.Management;
@@ -79,13 +80,14 @@ private void PrintInformations()
}
[Step(3)]
- private void InitAutumnBoxBasic(IOperatingSystemService operatingSystemService)
+ private void InitAutumnBoxBasic(IOperatingSystemService operatingSystemService, IStorageManager storageManager)
{
try
{
Logger.Info("killing other adb processes");
operatingSystemService.KillProcess("adb.exe");
Logger.Info("autumnbox-adb-server is starting");
+ Win32AdbManager.AdbToolsDirectory = new DirectoryInfo(Path.Combine(storageManager.CacheDirectory.FullName, "adb_tools"));
BasicBooter.Use();
Logger.Info($"autumnbox-adb-server is started at {BasicBooter.ServerEndPoint}");
}
diff --git a/src/AutumnBox.GUI/Util/VersionInfos.cs b/src/AutumnBox.GUI/Util/VersionInfos.cs
index c6faba0a5..134b67da0 100644
--- a/src/AutumnBox.GUI/Util/VersionInfos.cs
+++ b/src/AutumnBox.GUI/Util/VersionInfos.cs
@@ -36,9 +36,6 @@ static class VersionInfos
public static Version OS { get; }
public static string OSString => OS.ToString();
- public static Version JsonLib { get; }
- public static string JsonLibString => JsonLib.ToString();
-
public static Version HandyControl { get; }
public static string HandyControlString => HandyControl.ToString();
@@ -59,33 +56,20 @@ private static string GetAdbVersion()
return "unknown";
}
}
- private static Version GetCoreLibVersion()
- {
- var libsManager = AutumnBox.OpenFramework.Management.OpenFx.Lake.Get();
- var coreLibFilterResult = from lib in libsManager.Librarians
- where lib.Name == "AutumnBox Core Modules"
- select lib;
- if (coreLibFilterResult.Count() == 0) return new Version(0, 0, 1);
- var assemblyLib = coreLibFilterResult.First() as AssemblyLibrarian;
- Assembly assembly = assemblyLib.ManagedAssembly;
- return assembly.GetName().Version;
- }
static VersionInfos()
{
- Basic = typeof(BasicBooter).Assembly.GetName().Version;
+ Basic = AutumnBox.Basic.ModuleInfo.Version;
GUI = Self.Version;
- OpenFx = typeof(OpenFramework.BuildInfo).Assembly.GetName().Version;
+ OpenFx = AutumnBox.OpenFramework.BuildInfo.SDK_VERSION;
Logging = typeof(Logging.SLogger).Assembly.GetName().Version;
- JsonLib = new Version(1, 0, 0);
HandyControl = typeof(HandyControl.Controls.AnimationPath).Assembly.GetName().Version;
SharpZipLib = typeof(ICSharpCode.SharpZipLib.SharpZipBaseException).Assembly.GetName().Version;
DotNetFramework = Environment.Version;
OS = Environment.OSVersion.Version;
Adb = GetAdbVersion();
- CoreLib = GetCoreLibVersion();
}
}
}
\ No newline at end of file
diff --git a/src/AutumnBox.GUI/View/Panel/PanelAbout.xaml b/src/AutumnBox.GUI/View/Panel/PanelAbout.xaml
index e5cc4658b..87d39b852 100644
--- a/src/AutumnBox.GUI/View/Panel/PanelAbout.xaml
+++ b/src/AutumnBox.GUI/View/Panel/PanelAbout.xaml
@@ -9,6 +9,7 @@
mc:Ignorable="d"
xmlns:util="clr-namespace:AutumnBox.GUI.Util"
Foreground="{DynamicResource PrimaryTextBrush}"
+ FontFamily="{DynamicResource AutumnBox.Font}"
xmlns:viewmodel="clr-namespace:AutumnBox.GUI.ViewModel"
d:DesignHeight="450" d:DesignWidth="400">
@@ -47,27 +48,19 @@
-
+
+
-
-
-
-
-
-
-
-
-
@@ -91,11 +84,6 @@
-
-
-
-
-
diff --git a/src/AutumnBox.GUI/View/Panel/PanelUpdateLogs.xaml b/src/AutumnBox.GUI/View/Panel/PanelUpdateLogs.xaml
index 4c959a693..3651a3fa6 100644
--- a/src/AutumnBox.GUI/View/Panel/PanelUpdateLogs.xaml
+++ b/src/AutumnBox.GUI/View/Panel/PanelUpdateLogs.xaml
@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:AutumnBox.GUI.View.Panel"
xmlns:viewmodel="clr-namespace:AutumnBox.GUI.ViewModel"
mc:Ignorable="d"
+ FontFamily="{DynamicResource AutumnBox.Font}"
d:DesignHeight="450" d:DesignWidth="800">
diff --git a/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml b/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml
index 96bdbb14d..15e35809d 100644
--- a/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml
+++ b/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml
@@ -10,16 +10,17 @@
mc:Ignorable="d"
FontFamily="{DynamicResource AutumnBox.Font}"
WindowStartupLocation="CenterOwner"
- MinHeight="300" MinWidth="500"
+ MinHeight="280" MinWidth="300"
+ ShowInTaskbar="False"
MouseDown="Window_MouseDown"
- Title="{Binding MessageTitle}" Height="300" Width="500">
+ Title="{Binding MessageTitle}" Height="270" Width="350">
-
+
diff --git a/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml.cs b/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml.cs
index 168b6ee1d..dceafc7af 100644
--- a/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml.cs
+++ b/src/AutumnBox.GUI/View/Windows/ExceptionWindow.xaml.cs
@@ -76,7 +76,11 @@ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
private void Button_Click(object sender, RoutedEventArgs e)
{
- Clipboard.SetText(ExceptionMessage);
+ try
+ {
+ Clipboard.SetText(ExceptionMessage);
+ }
+ catch { }
}
}
}
diff --git a/src/AutumnBox.GUI/ViewModel/VMMainMenu.cs b/src/AutumnBox.GUI/ViewModel/VMMainMenu.cs
index 807f07775..5da95a4fe 100644
--- a/src/AutumnBox.GUI/ViewModel/VMMainMenu.cs
+++ b/src/AutumnBox.GUI/ViewModel/VMMainMenu.cs
@@ -67,8 +67,7 @@ public VMMainMenu()
InstallExtension = new MVVMCommand(p => openFxManager.RunExtension("EExtensionInstaller"));
OpenExtFloder = new MVVMCommand(p =>
{
- string path = Path.Combine(AppContext.BaseDirectory, BuildInfo.DEFAULT_EXTENSION_PATH);
- Process.Start(new ProcessStartInfo(path)
+ Process.Start(new ProcessStartInfo(BuildInfo.ExtensionStore.FullName)
{
UseShellExecute = true,
Verb = "open"
diff --git a/src/AutumnBox.OpenFramework.Shared/BuildInfo.cs b/src/AutumnBox.OpenFramework.Shared/BuildInfo.cs
index db8c7f017..306455df3 100644
--- a/src/AutumnBox.OpenFramework.Shared/BuildInfo.cs
+++ b/src/AutumnBox.OpenFramework.Shared/BuildInfo.cs
@@ -5,6 +5,7 @@
*************************************************/
using System;
using System.Diagnostics;
+using System.IO;
using System.Reflection;
namespace AutumnBox.OpenFramework
@@ -15,9 +16,9 @@ namespace AutumnBox.OpenFramework
public static class BuildInfo
{
///
- /// 拓展模块路径
+ /// 拓展模块存放点
///
- public const string DEFAULT_EXTENSION_PATH = "extensions";
+ public static DirectoryInfo ExtensionStore { get; }
///
/// SDK版本,不设计为Const是为了防止编译器优化
@@ -49,8 +50,10 @@ public static class BuildInfo
///
internal const string AUTUMNBOX_LOGGING_ASSEMBLY_NAME = "AutumnBox.Logging";
+ const string DEFAULT_EXTENSION_PATH = "extensions";
static BuildInfo()
{
+ ExtensionStore = new DirectoryInfo(Path.Combine(AppContext.BaseDirectory, DEFAULT_EXTENSION_PATH));
SDK_VERSION = Assembly.GetExecutingAssembly().GetName().Version;
API_LEVEL = SDK_VERSION.Major;
}
diff --git a/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafExtensionBase.cs b/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafExtensionBase.cs
index d9ec001f3..20848e8be 100644
--- a/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafExtensionBase.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafExtensionBase.cs
@@ -41,7 +41,14 @@ public abstract class LeafExtensionBase : EmptyExtension, IClassExtension
}
catch (TargetInvocationException e)
{
- throw e.InnerException;
+ if (e.InnerException?.GetType() == typeof(LeafUIExtension.LeafExtensionTerminatedException))
+ {
+ return default;
+ }
+ else
+ {
+ throw e.InnerException ?? e;
+ }
}
}
diff --git a/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafUIExtension.cs b/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafUIExtension.cs
index 04bb99814..4c6db63f1 100644
--- a/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafUIExtension.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Extension/Leaf/LeafUIExtension.cs
@@ -6,6 +6,7 @@
using System.Threading;
using AutumnBox.Leafx.Container;
using AutumnBox.Leafx.Enhancement.ClassTextKit;
+using System;
namespace AutumnBox.OpenFramework.Extension.Leaf
{
@@ -18,6 +19,12 @@ namespace AutumnBox.OpenFramework.Extension.Leaf
[ClassText("cancel", "Cancel", "zh-cn:取消")]
public static class LeafUIExtension
{
+
+ ///
+ /// Leaf拓展被终结的信号
+ ///
+ internal class LeafExtensionTerminatedException : Exception { }
+
///
///
///
@@ -26,7 +33,7 @@ public static class LeafUIExtension
public static void EFinish(this ILeafUI ui, int exitCode = 0)
{
ui.Finish(exitCode.ToString());
- Thread.CurrentThread.Abort();
+ throw new LeafExtensionTerminatedException();
}
///
@@ -37,7 +44,7 @@ public static void EFinish(this ILeafUI ui, int exitCode = 0)
public static void EFinish(this ILeafUI ui, string tip)
{
ui.Finish(tip);
- Thread.CurrentThread.Abort();
+ throw new LeafExtensionTerminatedException();
}
///
@@ -47,7 +54,7 @@ public static void EFinish(this ILeafUI ui, string tip)
public static void EShutdown(this ILeafUI ui)
{
ui.Shutdown();
- Thread.CurrentThread.Abort();
+ throw new LeafExtensionTerminatedException();
}
///
diff --git a/src/AutumnBox.OpenFramework.Shared/Implementation/AppManagerImpl.cs b/src/AutumnBox.OpenFramework.Shared/Implementation/AppManagerImpl.cs
index fb26ef0f3..ce86ec7ee 100644
--- a/src/AutumnBox.OpenFramework.Shared/Implementation/AppManagerImpl.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Implementation/AppManagerImpl.cs
@@ -10,7 +10,7 @@
namespace AutumnBox.OpenFramework.Implementation
{
- [Component(Type =typeof(IAppManager))]
+ [Component(Type = typeof(IAppManager))]
internal partial class AppManagerImpl : IAppManager
{
private readonly IBaseApi sourceApi;
@@ -143,8 +143,10 @@ public void ShowException(string title, string sketch, Exception e)
{
throw new ArgumentNullException(nameof(e));
}
-
- sourceApi.ShowException(title, sketch, e.ToString());
+ sourceApi.RunOnUIThread(() =>
+ {
+ sourceApi.ShowException(title, sketch, e.ToString());
+ });
}
public void ShutdownApp()
diff --git a/src/AutumnBox.OpenFramework.Shared/Implementation/StorageImpl.cs b/src/AutumnBox.OpenFramework.Shared/Implementation/StorageImpl.cs
index 0ec114d06..0055eed28 100644
--- a/src/AutumnBox.OpenFramework.Shared/Implementation/StorageImpl.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Implementation/StorageImpl.cs
@@ -1,7 +1,12 @@
using AutumnBox.Core;
+using AutumnBox.Leafx.Container;
using AutumnBox.Leafx.Container.Support;
+using AutumnBox.OpenFramework.Management;
using AutumnBox.OpenFramework.Open;
+using System;
using System.IO;
+using System.Linq;
+
namespace AutumnBox.OpenFramework.Implementation
{
[Component(SingletonMode = true, Type = typeof(IStorage))]
@@ -15,46 +20,36 @@ public IStorage Open(string id)
internal class Storage : IStorage
{
- private string storageId;
private const string CACHE_DIR = "cache";
private const string FILES_DIR = "files";
private const string JSON_EXT = ".ajson";
private const string FILE_EXT = ".aextf";
public DirectoryInfo CacheDirectory { get; private set; }
- private DirectoryInfo ChiefDirectory { get; set; }
private DirectoryInfo FilesDirectory { get; set; }
public Storage(string id)
{
- storageId = id.GetHashCode().ToString();
+ var baseApi = LakeProvider.Lake.Get();
- /*初始化Chief Directory*/
- string chiefDirName = storageId.GetHashCode().ToString();
- string chiefPath = Path.Combine(BuildInfo.DEFAULT_EXTENSION_PATH, chiefDirName);
- ChiefDirectory = new DirectoryInfo(chiefPath);
- if (!ChiefDirectory.Exists) ChiefDirectory.Create();
+ string cacheDirPath = Path.Combine(baseApi.TempDirectory.FullName, $"extcache_{id}");
+ string filesDirPath = Path.Combine(baseApi.StorageDirectory.FullName, $"extfiles_{id}");
- /*初始化子文件夹*/
- CacheDirectory = InitChildDirectory(CACHE_DIR);
- FilesDirectory = InitChildDirectory(FILES_DIR);
- }
- private DirectoryInfo InitChildDirectory(string dirName)
- {
- string path = Path.Combine(ChiefDirectory.FullName, dirName);
- DirectoryInfo dir = new DirectoryInfo(path);
- if (!dir.Exists) dir.Create();
- return dir;
+ CacheDirectory = new DirectoryInfo(cacheDirPath);
+ FilesDirectory = new DirectoryInfo(filesDirPath);
+
+ if (!CacheDirectory.Exists) CacheDirectory.Create();
+ if (!FilesDirectory.Exists) FilesDirectory.Create();
}
public void ClearCache()
{
CacheDirectory.Delete(true);
- InitChildDirectory(CACHE_DIR);
+ CacheDirectory.Create();
}
public void ClearFiles()
{
- FileInfo[] files = FilesDirectory.GetFiles($"*{FILE_EXT}");
+ FileInfo[] files = FilesDirectory.GetFiles();
foreach (var file in files)
{
file.Delete();
@@ -63,8 +58,11 @@ public void ClearFiles()
public void ClearJsonObjects()
{
- FileInfo[] files = FilesDirectory.GetFiles($"*{JSON_EXT}");
- foreach (var file in files)
+ var jsonFiles = from file in FilesDirectory.GetFiles($"*{JSON_EXT}")
+ where file.Extension == JSON_EXT
+ select file;
+
+ foreach (var file in jsonFiles)
{
file.Delete();
}
@@ -72,7 +70,7 @@ public void ClearJsonObjects()
private string GenerateFileName(string fileId)
{
- return fileId.GetHashCode().ToString();
+ return fileId.ToString();
}
public void DeleteFile(string fileId)
@@ -110,6 +108,7 @@ public void SaveJsonObject(string jsonId, object jsonObject)
using var sw = new StreamWriter(fs);
var json = JsonHelper.SerializeObject(jsonObject);
sw.Write(json);
+ sw.Flush();
}
public void Restore()
@@ -119,7 +118,7 @@ public void Restore()
ClearJsonObjects();
}
- public FileInfo WriteToFile(Stream srcSource, string fileId = null)
+ public FileInfo WriteToFile(Stream srcSource, string fileId)
{
string path = Path.Combine(FilesDirectory.FullName, GenerateFileName(fileId) + FILE_EXT);
using (var writer = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
diff --git a/src/AutumnBox.OpenFramework.Shared/Management/ExtLibrary/Impl/DreamLibManager.cs b/src/AutumnBox.OpenFramework.Shared/Management/ExtLibrary/Impl/DreamLibManager.cs
index 39bb38223..02897daa9 100644
--- a/src/AutumnBox.OpenFramework.Shared/Management/ExtLibrary/Impl/DreamLibManager.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Management/ExtLibrary/Impl/DreamLibManager.cs
@@ -85,14 +85,10 @@ private bool SafeReady(ILibrarian lib)
private IEnumerable GetFiles()
{
- var extDir = new DirectoryInfo(BuildInfo.DEFAULT_EXTENSION_PATH);
+ var extDir = BuildInfo.ExtensionStore;
if (!extDir.Exists) extDir.Create();
List files = new List();
- extDir.GetFiles();
- extDir.GetFiles();
- extDir.GetFiles();
-
foreach (var file in extDir.GetFiles())
{
SLogger.Info($"{file.Name}{file.Extension}");
@@ -102,12 +98,10 @@ private IEnumerable GetFiles()
where file.Extension == ".dll" || file.Extension == ".aext"
select file;
-
-
- files.Concat(extensionFiles);
+ files.AddRange(extensionFiles);
#if DEBUG
- files.Add(new FileInfo("../../../../AutumnBox.Essentials/bin/Debug/netcoreapp3.1/AutumnBox.Core.dll"));
+ files.Add(new FileInfo("../../../../AutumnBox.Essentials/bin/Debug/netcoreapp3.1/AutumnBox.Essentials.dll"));
files.Add(new FileInfo("../../../../AutumnBox.CoreModules/bin/Debug/netcoreapp3.1/AutumnBox.CoreModules.dll"));
#endif
SLogger.Debug($"There are {files.Count()} extension file");
diff --git a/src/AutumnBox.OpenFramework.Shared/Management/ExtTask/ExtensionTaskFactory.cs b/src/AutumnBox.OpenFramework.Shared/Management/ExtTask/ExtensionTaskFactory.cs
index 27e35ddcc..78197372d 100644
--- a/src/AutumnBox.OpenFramework.Shared/Management/ExtTask/ExtensionTaskFactory.cs
+++ b/src/AutumnBox.OpenFramework.Shared/Management/ExtTask/ExtensionTaskFactory.cs
@@ -1,7 +1,9 @@
#nullable enable
using AutumnBox.Leafx.Container;
+using AutumnBox.Leafx.Enhancement.ClassTextKit;
using AutumnBox.Logging;
using AutumnBox.OpenFramework.Management.ExtInfo;
+using AutumnBox.OpenFramework.Open;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -9,8 +11,11 @@
namespace AutumnBox.OpenFramework.Management.ExtTask
{
+
internal static class ExtensionTaskFactory
{
+ [ClassText("error_title_fmt", "An error occurred in {0}", "zh-CN:{0}发生错误")]
+ private class T { }
internal static Task
event EventHandler Destorying;
///
- /// 获取NewtonsoftJson的版本号
- ///
- Version NewtonsoftJsonVersion { get; }
- ///
/// 获取日志器版本号
///
Version AutumnBoxLoggingVersion { get; }
@@ -125,7 +130,7 @@ interface IBaseApi
///
///
///
- void ShowException(string title, string sketch, string exceptionMessage);
+ void ShowException(string title,string sketch, string exceptionMessage);
///
/// 播放成功音效
///