本文整理匯總了C#中QuickFix.Message.GetInt方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.GetInt方法的具體用法?C# Message.GetInt怎麽用?C# Message.GetInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QuickFix.Message
的用法示例。
在下文中一共展示了Message.GetInt方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: NextResendRequest
protected void NextResendRequest(Message resendReq)
{
try
{
int msgSeqNum = 0;
if (!(this.IgnorePossDupResendRequests && resendReq.Header.IsSetField(Tags.PossDupFlag)))
{
int begSeqNo = resendReq.GetInt(Fields.Tags.BeginSeqNo);
int endSeqNo = resendReq.GetInt(Fields.Tags.EndSeqNo);
this.Log.OnEvent("Got resend request from " + begSeqNo + " to " + endSeqNo);
if ((endSeqNo == 999999) || (endSeqNo == 0))
{
endSeqNo = state_.GetNextSenderMsgSeqNum() - 1;
}
if (!PersistMessages)
{
endSeqNo++;
int next = state_.GetNextSenderMsgSeqNum();
if (endSeqNo > next)
endSeqNo = next;
GenerateSequenceReset(resendReq, begSeqNo, endSeqNo);
return;
}
List<string> messages = new List<string>();
state_.Get(begSeqNo, endSeqNo, messages);
int current = begSeqNo;
int begin = 0;
foreach (string msgStr in messages)
{
Message msg = new Message(msgStr);
msgSeqNum = msg.Header.GetInt(Tags.MsgSeqNum);
if ((current != msgSeqNum) && begin == 0)
{
begin = current;
}
if (IsAdminMessage(msg))
{
if (begin == 0)
{
begin = msgSeqNum;
}
}
else
{
initializeResendFields(msg);
if (begin != 0)
{
GenerateSequenceReset(resendReq, begin, msgSeqNum);
}
Send(msg.ToString());
begin = 0;
}
current = msgSeqNum + 1;
}
if (begin != 0)
{
GenerateSequenceReset(resendReq, begin, msgSeqNum + 1);
}
if (endSeqNo > msgSeqNum)
{
endSeqNo = endSeqNo + 1;
int next = state_.GetNextSenderMsgSeqNum();
if (endSeqNo > next)
{
endSeqNo = next;
}
GenerateSequenceReset(resendReq, begSeqNo, endSeqNo);
}
}
msgSeqNum = resendReq.Header.GetInt(Tags.MsgSeqNum);
if (!IsTargetTooHigh(msgSeqNum) && !IsTargetTooLow(msgSeqNum))
{
state_.IncrNextTargetMsgSeqNum();
}
}
catch (System.Exception e)
{
this.Log.OnEvent("ERROR during resend request " + e.Message);
}
}
示例2: NextSequenceReset
protected void NextSequenceReset(Message sequenceReset)
{
bool isGapFill = false;
if (sequenceReset.IsSetField(Fields.Tags.GapFillFlag))
isGapFill = sequenceReset.GetBoolean(Fields.Tags.GapFillFlag);
if (!Verify(sequenceReset, isGapFill, isGapFill))
return;
if (sequenceReset.IsSetField(Fields.Tags.NewSeqNo))
{
int newSeqNo = sequenceReset.GetInt(Fields.Tags.NewSeqNo);
this.Log.OnEvent("Received SequenceReset FROM: " + state_.GetNextTargetMsgSeqNum() + " TO: " + newSeqNo);
if (newSeqNo > state_.GetNextTargetMsgSeqNum())
{
state_.SetNextTargetMsgSeqNum(newSeqNo);
}
else
{
if (newSeqNo < state_.GetNextTargetMsgSeqNum())
GenerateReject(sequenceReset, FixValues.SessionRejectReason.VALUE_IS_INCORRECT);
}
}
}
示例3: NextLogon
protected void NextLogon(Message logon)
{
Fields.ResetSeqNumFlag resetSeqNumFlag = new Fields.ResetSeqNumFlag(false);
if (logon.IsSetField(resetSeqNumFlag))
logon.GetField(resetSeqNumFlag);
state_.ReceivedReset = resetSeqNumFlag.Obj;
if (!state_.IsInitiator && this.ResetOnLogon)
state_.Reset();
if (!Verify(logon, false, true))
return;
if (!IsGoodTime(logon))
{
this.Log.OnEvent("Logon had bad sending time");
Disconnect("bad sending time");
return;
}
state_.ReceivedLogon = true;
this.Log.OnEvent("Received logon");
if (!state_.IsInitiator)
{
int heartBtInt = logon.GetInt(Fields.Tags.HeartBtInt);
state_.HeartBtInt = heartBtInt;
GenerateLogon(logon);
this.Log.OnEvent("Responding to logon request");
}
state_.SentReset = false;
state_.ReceivedReset = false;
int msgSeqNum = logon.Header.GetInt(Fields.Tags.MsgSeqNum);
if (IsTargetTooHigh(msgSeqNum) && !resetSeqNumFlag.Obj)
{
DoTargetTooHigh(logon, msgSeqNum);
}
else
{
state_.IncrNextTargetMsgSeqNum();
NextQueued();
}
if (this.IsLoggedOn)
this.Application.OnLogon(this.SessionID);
}
示例4: GenerateLogon
/// <summary>
/// FIXME don't do so much operator new here
/// </summary>
/// <param name="heartBtInt"></param>
/// <returns></returns>
protected bool GenerateLogon(Message otherLogon)
{
Message logon = msgFactory_.Create(this.SessionID.BeginString, Fields.MsgType.LOGON);
logon.SetField(new Fields.EncryptMethod(0));
if (this.SessionID.IsFIXT)
logon.SetField(new Fields.DefaultApplVerID(this.SenderDefaultApplVerID));
if (state_.ReceivedReset)
logon.SetField(new Fields.ResetSeqNumFlag(true));
logon.SetField(new Fields.HeartBtInt(otherLogon.GetInt(Tags.HeartBtInt)));
if (this.EnableLastMsgSeqNumProcessed)
logon.Header.SetField(new Fields.LastMsgSeqNumProcessed(otherLogon.Header.GetInt(Tags.MsgSeqNum)));
InitializeHeader(logon);
state_.SentLogon = SendRaw(logon, 0);
return state_.SentLogon;
}
示例5: NextResendRequest
protected void NextResendRequest(Message resendReq)
{
if (!Verify(resendReq, false, false))
return;
try
{
int msgSeqNum = 0;
if (!(this.IgnorePossDupResendRequests && resendReq.Header.IsSetField(Tags.PossDupFlag)))
{
int begSeqNo = resendReq.GetInt(Fields.Tags.BeginSeqNo);
int endSeqNo = resendReq.GetInt(Fields.Tags.EndSeqNo);
this.Log.OnEvent("Got resend request from " + begSeqNo + " to " + endSeqNo);
if ((endSeqNo == 999999) || (endSeqNo == 0))
{
endSeqNo = state_.GetNextSenderMsgSeqNum() - 1;
}
if (!PersistMessages)
{
endSeqNo++;
int next = state_.GetNextSenderMsgSeqNum();
if (endSeqNo > next)
endSeqNo = next;
GenerateSequenceReset(resendReq, begSeqNo, endSeqNo);
return;
}
List<string> messages = new List<string>();
state_.Get(begSeqNo, endSeqNo, messages);
int current = begSeqNo;
int begin = 0;
foreach (string msgStr in messages)
{
Message msg = new Message();
msg.FromString(msgStr, true, this.SessionDataDictionary, this.ApplicationDataDictionary, msgFactory_);
msgSeqNum = msg.Header.GetInt(Tags.MsgSeqNum);
if ((current != msgSeqNum) && begin == 0)
{
begin = current;
}
if (IsAdminMessage(msg) && !(this.ResendSessionLevelRejects && msg.Header.GetString(Tags.MsgType) == MsgType.REJECT))
{
if (begin == 0)
{
begin = msgSeqNum;
}
}
else
{
initializeResendFields(msg);
if(!ResendApproved(msg, SessionID))
{
continue;
}
if (begin != 0)
{
GenerateSequenceReset(resendReq, begin, msgSeqNum);
}
Send(msg.ToString());
begin = 0;
}
current = msgSeqNum + 1;
}
int nextSeqNum = state_.GetNextSenderMsgSeqNum();
if (++endSeqNo > nextSeqNum)
{
endSeqNo = nextSeqNum;
}
if (begin == 0)
{
begin = current;
}
if (endSeqNo > begin)
{
GenerateSequenceReset(resendReq, begin, endSeqNo);
}
}
msgSeqNum = resendReq.Header.GetInt(Tags.MsgSeqNum);
if (!IsTargetTooHigh(msgSeqNum) && !IsTargetTooLow(msgSeqNum))
{
state_.IncrNextTargetMsgSeqNum();
}
}
catch (System.Exception e)
{
this.Log.OnEvent("ERROR during resend request " + e.Message);
}
}
示例6: SetFieldsTest
public void SetFieldsTest()
{
var message = new Message();
var allocId = new AllocID("123456");
var allocAccount = new AllocAccount("QuickFixAccount");
var allocAccountType = new AllocAccountType(AllocAccountType.HOUSE_TRADER);
message.SetFields(new IField[] { allocAccount, allocAccountType, allocId });
Assert.AreEqual(true, message.IsSetField(Tags.AllocID));
Assert.AreEqual("123456", message.GetField(Tags.AllocID));
Assert.AreEqual(true, message.IsSetField(Tags.AllocAccount));
Assert.AreEqual("QuickFixAccount", message.GetField(Tags.AllocAccount));
Assert.AreEqual(true, message.IsSetField(Tags.AllocAccountType));
Assert.AreEqual(AllocAccountType.HOUSE_TRADER, message.GetInt(Tags.AllocAccountType));
}
示例7: NextLogon
protected void NextLogon(Message logon)
{
Fields.ResetSeqNumFlag resetSeqNumFlag = new Fields.ResetSeqNumFlag(false);
if (logon.IsSetField(resetSeqNumFlag))
logon.GetField(resetSeqNumFlag);
state_.ReceivedReset = resetSeqNumFlag.Obj;
if (state_.ReceivedReset)
{
this.Log.OnEvent("Sequence numbers reset due to ResetSeqNumFlag=Y");
if (!state_.SentReset)
{
state_.Reset("Reset requested by counterparty");
}
}
if (!state_.IsInitiator && this.ResetOnLogon)
state_.Reset("ResetOnLogon");
if (this.RefreshOnLogon)
Refresh();
if (!Verify(logon, false, true))
return;
if (!IsGoodTime(logon))
{
this.Log.OnEvent("Logon has bad sending time");
Disconnect("bad sending time");
return;
}
state_.ReceivedLogon = true;
this.Log.OnEvent("Received logon");
if (!state_.IsInitiator)
{
int heartBtInt = logon.GetInt(Fields.Tags.HeartBtInt);
state_.HeartBtInt = (int)Math.Floor(heartBtInt / (double)2);
GenerateLogon(logon);
this.Log.OnEvent("Responding to logon request");
}
state_.SentReset = false;
state_.ReceivedReset = false;
int msgSeqNum = logon.Header.GetInt(Fields.Tags.MsgSeqNum);
if (IsTargetTooHigh(msgSeqNum) && !resetSeqNumFlag.Obj)
{
DoTargetTooHigh(logon, msgSeqNum);
}
else
{
state_.IncrNextTargetMsgSeqNum();
}
if (this.IsLoggedOn)
this.Application.OnLogon(this.SessionID);
}