using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace XImaging.Automation.Service.Message
|
{
|
public class ReqMessage : BiosenDriverMessage
|
{
|
protected string m_strDescription;
|
|
protected int m_iEstimateTime;
|
|
protected int m_iTimeout;
|
|
protected long m_lExpiredTime;
|
|
public JObject OriginJSON
|
{
|
get
|
{
|
return this.m_jsonOriginMessage;
|
}
|
}
|
|
public JObject Parameters
|
{
|
get
|
{
|
return this.m_jsonParameters;
|
}
|
}
|
|
public int Troubleshoot
|
{
|
get
|
{
|
return this.m_iTroubleshoot;
|
}
|
}
|
|
public string Description
|
{
|
get
|
{
|
return this.m_strDescription;
|
}
|
}
|
|
public int EstimateTime
|
{
|
get
|
{
|
return this.m_iEstimateTime;
|
}
|
}
|
|
public int Timeout
|
{
|
get
|
{
|
return this.m_iTimeout;
|
}
|
}
|
|
public long ExpiredTime
|
{
|
get
|
{
|
return this.m_lExpiredTime;
|
}
|
}
|
|
public ReqMessage(string message)
|
{
|
JObject jObject = (JObject)JsonConvert.DeserializeObject(message);
|
this.m_jsonOriginMessage = jObject;
|
this.m_strGUID = jObject["guid"].ToString();
|
this.m_strEndpoint = jObject.Value<int>("endpoint");
|
this.m_strMessageID = jObject["message_id"].ToString();
|
this.m_iMessageType = jObject.Value<int>("message_type");
|
this.m_strEquipmentID = jObject["equipment_id"].ToString();
|
bool flag = base.MessageType != BiosenDriverMessage.MESSAGE_TYPE_HEARTBEAT;
|
if (flag)
|
{
|
this.m_strWorkflowID = jObject["workflow_id"].ToString();
|
this.m_strExperimentID = jObject["experiment_id"].ToString();
|
this.m_strMethod = jObject["method"].ToString();
|
this.m_strDescription = jObject["description"].ToString();
|
}
|
bool flag2 = base.MessageType == BiosenDriverMessage.MESSAGE_TYPE_TASK || base.MessageType == BiosenDriverMessage.MESSAGE_TYPE_QUERY;
|
if (flag2)
|
{
|
this.m_jsonParameters = (JObject)jObject["parameters"];
|
this.m_iEstimateTime = jObject.Value<int>("estimate_time");
|
this.m_iTimeout = jObject.Value<int>("timeout");
|
}
|
else
|
{
|
this.m_jsonParameters = null;
|
this.m_iEstimateTime = 0;
|
this.m_iTimeout = 0;
|
}
|
bool flag3 = base.MessageType == BiosenDriverMessage.MESSAGE_TYPE_TROUBLESHOOT;
|
if (flag3)
|
{
|
this.m_iTroubleshoot = jObject.Value<int>("troubleshoot");
|
}
|
else
|
{
|
this.m_iTroubleshoot = 0;
|
}
|
this.m_lExpiredTime = jObject.Value<long>("expired");
|
this.m_strTimestamp = jObject["timestamp"].ToString();
|
}
|
}
|
}
|