2023-04-17 14:10:34 +08:00
|
|
|
|
using LightContrl;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Epost.DAL.Cache
|
|
|
|
|
{
|
|
|
|
|
public class LightControlCacheDAL
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static object lockconobj = new object();
|
|
|
|
|
public static List<LightcontrolModel> MainControlList = new List<LightcontrolModel>();//
|
|
|
|
|
|
|
|
|
|
#region 获取计划任务列表
|
|
|
|
|
public List<LightcontrolModel> GetControlList()
|
|
|
|
|
{
|
|
|
|
|
return MainControlList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化任务列表
|
|
|
|
|
public void ClearControlList()
|
|
|
|
|
{
|
|
|
|
|
foreach (var planitem in MainControlList.ToArray())
|
|
|
|
|
{
|
|
|
|
|
MainControlList.Remove(planitem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Job缓存处理方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Job缓存处理方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="JobParam"></param>
|
|
|
|
|
/// <param name="ECommend"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool UpdateControlList(List<LightcontrolModel> JobParam, EcontrolCommend CommendType)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
lock (lockconobj)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (CommendType.Equals(EcontrolCommend.Create))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MainControlList.AddRange(JobParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (CommendType.Equals(EcontrolCommend.Execute))
|
|
|
|
|
{
|
2023-04-21 11:44:47 +08:00
|
|
|
|
foreach (var planitem in MainControlList.ToArray())
|
|
|
|
|
{
|
|
|
|
|
MainControlList.Remove(planitem);
|
|
|
|
|
}
|
2023-04-17 14:10:34 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public enum EcontrolCommend
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("创建")]
|
|
|
|
|
Create,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("删除")]
|
|
|
|
|
Execute
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LightcontrolModel
|
|
|
|
|
{
|
|
|
|
|
private string _controlip = string.Empty;
|
2023-04-21 11:44:47 +08:00
|
|
|
|
private int _port ;
|
2023-04-17 14:10:34 +08:00
|
|
|
|
MainControl _maincontrol = new MainControl();
|
|
|
|
|
|
|
|
|
|
public MainControl maincontrol { get => _maincontrol; set => _maincontrol = value; }
|
|
|
|
|
public string controlip { get => _controlip; set => _controlip = value; }
|
2023-04-21 11:44:47 +08:00
|
|
|
|
public int port { get => _port; set => _port = value; }
|
2023-04-17 14:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|