|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AI.AgentIntegration
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表示一个应用程序操作
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class AppAction
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置操作类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public AppActionType Action { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置操作参数字典
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Dictionary<string, object> Parameters { get; set; } = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建 AppAction,使用它可以让调用代码变得简短
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="type">类型</param>
|
|
|
|
|
|
/// <param name="parameters">参数</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateAction(AppActionType type, Dictionary<string, object>? parameters = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new AppAction()
|
|
|
|
|
|
{
|
|
|
|
|
|
Action = type,
|
|
|
|
|
|
Parameters = parameters ?? new Dictionary<string, object>(),
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建一个支持单个参数的 Action
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="type">类型</param>
|
|
|
|
|
|
/// <param name="name">参数名</param>
|
|
|
|
|
|
/// <param name="value">参数值</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateAction(AppActionType type, string name, object value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new AppAction()
|
|
|
|
|
|
{
|
|
|
|
|
|
Action = type,
|
|
|
|
|
|
Parameters = new Dictionary<string, object>() { [name] = value },
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建加载散点文件的 action
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="path">文件路径</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateLoadXyz(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateAction(AppActionType.GriddingModuleLoadXyz, nameof(path), path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建从文件导入井点数据的 action
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="path">井点数据文件路径</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateImportWellPoints(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateAction(AppActionType.WellModuleImportWellPoints, nameof(path), path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建从文件导入井曲线数据的 action
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="path">井曲线数据文件路径</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateImportWellCurves(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateAction(AppActionType.WellModuleImportCurves, nameof(path), path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建打开文件的 action
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="path">文件路径</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateOpenFile(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateAction(AppActionType.OpenFile, nameof(path), path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建参数设置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parameters">参数</param>
|
|
|
|
|
|
/// <returns>AppAction 对象</returns>
|
|
|
|
|
|
public static AppAction CreateSetParameters(string parameters)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateAction(AppActionType.GriddingModuleSetParameters, nameof(parameters), parameters);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|