重新设计了FlowLIbrary相关类;为工作台默认添加了基础依赖、默认画布。

This commit is contained in:
fengjiayi
2025-07-28 12:16:29 +08:00
parent 6354c4c7fd
commit ccb8e49abc
39 changed files with 497 additions and 453 deletions

View File

@@ -1,14 +1,10 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library;
using Serein.Workbench.Api;
using Serein.Workbench.Node.ViewModel;
using Serein.Workbench.Themes;
using Serein.Workbench.Views;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
namespace Serein.Workbench.Node.View

View File

@@ -1,14 +1,6 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Serein.Library;
using Serein.NodeFlow;
using Serein.NodeFlow.Model;
using Serein.NodeFlow.Model;
using Serein.NodeFlow.Model.Library;
using Serein.Workbench.Themes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Input;
namespace Serein.Workbench.Node.ViewModel
@@ -71,9 +63,9 @@ public class FlowLibrary
});
}
private static void OnCompileComplete(FlowLibrary flowLibrary)
private static void OnCompileComplete(FlowLibraryCache flowLibrary)
{
var loadResult = flowLibrary.LoadAssembly(); // 动态编译完成后加载程序集
var loadResult = flowLibrary.LoadFlowMethod(); // 动态编译完成后加载程序集
if (!loadResult)
{
return ;

View File

@@ -181,7 +181,7 @@ namespace Serein.Workbench.Services
SereinEnv.WriteLine(InfoType.INFO, "项目文件保存路径:" + savePath);
for (int index = 0; index < project.Librarys.Length; index++)
{
NodeLibraryInfo? library = project.Librarys[index];
FlowLibraryInfo? library = project.Librarys[index];
string sourceFilePath = new Uri(library.FilePath).LocalPath; // 源文件夹
string targetDir = System.IO.Path.Combine(librarySavePath, library.AssemblyName); // 目标文件夹
if (!Path.Exists(targetDir))

View File

@@ -1,5 +1,5 @@
using Microsoft.Win32;
using Serein.NodeFlow;
using Serein.NodeFlow.Model.Library;
using Serein.NodeFlow.Tool;
using System;
using System.Collections.Generic;
@@ -34,7 +34,7 @@ namespace Serein.Workbench.Themes
/// <summary>
/// 编译成功回调
/// </summary>
public Action<FlowLibrary> OnCompileComplete { get; set; }
public Action<FlowLibraryCache> OnCompileComplete { get; set; }
public DynamicCompilerView()
{
InitializeComponent();
@@ -132,7 +132,7 @@ namespace Serein.Workbench.Themes
var path = textboxAssemblyName.Text;
Assembly assembly = _compiler.Compile(code, path);
FlowLibrary flowLibrary = new FlowLibrary(assembly, path);
FlowLibraryCache flowLibrary = new FlowLibraryCache(assembly, path);
if (assembly != null)
{

View File

@@ -19,13 +19,13 @@ namespace Serein.Workbench.ViewModels
private readonly IFlowEEForwardingService flowEEForwardingService;
private readonly IFlowEnvironment flowEnvironment;
[ObservableProperty]
private ObservableCollection<FlowLibraryInfo> flowLibraryInfos;
private ObservableCollection<Models.FlowLibraryInfo> flowLibraryInfos;
public FlowLibrarysViewModel(IFlowEEForwardingService flowEEForwardingService,IFlowEnvironment flowEnvironment)
{
this.flowEEForwardingService = flowEEForwardingService;
this.flowEnvironment = flowEnvironment;
FlowLibraryInfos = new ObservableCollection<FlowLibraryInfo>();
FlowLibraryInfos = new ObservableCollection<Models.FlowLibraryInfo>();
flowEEForwardingService.DllLoad += FlowEEForwardingService_OnDllLoad;
}
/// <summary>
@@ -48,15 +48,15 @@ namespace Serein.Workbench.ViewModels
private void FlowEEForwardingService_OnDllLoad(Library.Api.LoadDllEventArgs eventArgs)
{
if (!eventArgs.IsSucceed) return;
List<MethodDetailsInfo> mds = eventArgs.MethodDetailss;
NodeLibraryInfo libraryInfo = eventArgs.NodeLibraryInfo;
List<MethodDetailsInfo> mds = eventArgs.NodeLibraryInfo.MethodInfos.ToList() ;
Library.FlowLibraryInfo libraryInfo = eventArgs.NodeLibraryInfo;
var methodInfo = new ObservableCollection<MethodDetailsInfo>();
foreach (var md in mds)
{
methodInfo.Add(md);
}
var flInfo = new FlowLibraryInfo
var flInfo = new Models.FlowLibraryInfo
{
LibraryName = libraryInfo.AssemblyName,
FilePath = libraryInfo.FilePath,