123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using Uestc.Auto6.Dso.Core;
- using Uestc.Auto6.Dso.ComModel;
- using UESTC.Auto.SCPIManager;
- namespace Uestc.Auto6.Dso.Scpi
- {
- partial class StubFunc
- {
- public static bool scpiQuy_TriggerCommon(SCPICommandProcessFuncParam analyResult, ref SCPISendMessage sendMessage)
- {
- if (analyResult.Tag == null || analyResult.Tag is not ScpiTagObj scpiTagObj)
- return false;
- TriggerPrsnt triggerPrsnt = Presenter.CurrentTrigger;
- string outputString;
- if (scpiTagObj.PrsntObj is Type prsntType && prsntType == typeof(TriggerPrsnt))
- {
- PropertyInfo proInfo = prsntType.GetProperty(scpiTagObj.PropertyName);
- if (proInfo == null)
- {
- return false;
- }
- TryGetPropertyValue(triggerPrsnt, proInfo, out outputString, scpiTagObj.ParamList, scpiTagObj.IntOrDoubleMultiplier);
- sendMessage.SendData = decodeStr(outputString);
- return true;
- }
- else if ((Type)scpiTagObj.PrsntObj == triggerPrsnt.GetType() && TryGetPropertyValue(triggerPrsnt, scpiTagObj.PropertyName, out outputString, scpiTagObj.ParamList, scpiTagObj.IntOrDoubleMultiplier))
- {
- sendMessage.SendData = decodeStr(outputString);
- return true;
- }
- return false;
- }
- public static bool scpiSet_TriggerCommon(SCPICommandProcessFuncParam analyResult)
- {
- if (!scpiSet_ParamCheck(analyResult))
- {
- return false;
- }
- List<string> param = ParamListToStrList(analyResult.Params);
- if (analyResult.Tag == null || analyResult.Tag is not ScpiTagObj scpiTagObj)
- return false;
- TriggerPrsnt triggerPrsnt = Presenter.CurrentTrigger;
- PropertyInfo propertyInfo;
- bool isTriggerPrsnt = scpiTagObj.PrsntObj is Type prsntType && prsntType == typeof(TriggerPrsnt);
- if (isTriggerPrsnt)
- {
- propertyInfo = ((Type)scpiTagObj.PrsntObj).GetProperty(scpiTagObj.PropertyName);
- if (propertyInfo == null)
- {
- return false;
- }
- if (TrySetPropertyValue(triggerPrsnt, propertyInfo, param[0], scpiTagObj.ParamList, scpiTagObj.IntOrDoubleMultiplier))
- return true;
- }
- if ((Type)scpiTagObj.PrsntObj == triggerPrsnt.GetType() && TryGetPropertyInfo(triggerPrsnt, scpiTagObj.PropertyName, out propertyInfo))
- {
- if (TrySetPropertyValue(triggerPrsnt, propertyInfo, param[0], scpiTagObj.ParamList, scpiTagObj.IntOrDoubleMultiplier))
- return true;
- }
- return false;
- }
- }
- }
|