本文整理匯總了C#中QuickFix.Message.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.ToString方法的具體用法?C# Message.ToString怎麽用?C# Message.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QuickFix.Message
的用法示例。
在下文中一共展示了Message.ToString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FromApp
public void FromApp(Message message, SessionID sessionID)
{
Console.WriteLine("IN: " + message.ToString());
try
{
Crack(message, sessionID);
}
catch (Exception ex)
{
Console.WriteLine("==Cracker exception==");
Console.WriteLine(ex.ToString());
Console.WriteLine(ex.StackTrace);
}
}
示例2: FromApp
public void FromApp(Message message, SessionID sessionID)
{
try
{
string msgType = message.Header.GetField(QuickFix.Fields.Tags.MsgType);
log_.OnEvent("Got message " + msgType);
Crack(message, sessionID);
}
catch (QuickFix.UnsupportedMessageType)
{
throw;
}
catch (System.Exception e)
{
log_.OnEvent("FromApp: " + e.ToString() + " while processing msg (" + message.ToString() + ")");
}
}
示例3: ToApp
public void ToApp(Message message, SessionID sessionID)
{
try
{
bool possDupFlag = false;
if (message.Header.IsSetField(QuickFix.Fields.Tags.PossDupFlag))
{
possDupFlag = QuickFix.Fields.Converters.BoolConverter.Convert(
message.Header.GetField(QuickFix.Fields.Tags.PossDupFlag)); /// FIXME
}
if (possDupFlag)
throw new DoNotSend();
}
catch (FieldNotFoundException)
{ }
Console.WriteLine();
Console.WriteLine("OUT: " + message.ToString());
}
示例4: issue95
public void issue95()
{
// Parser screws up on triple-nested groups. Contributes to ResendRequest failures.
string msgStr = String.Join(Message.SOH, new string[]{
"8=FIX.4.4","9=999","35=R","34=6","49=sendercompid","52=20130225-10:44:59.149","56=targetcompid", //headers
"131=quotereqid",
"146=1", // NoRelatedSym
"55=ABC","65=CD","48=securityid","22=1", // group
"711=1", // NoUnderlyings
"311=underlyingsymbol","312=WI","309=underlyingsecurityid","305=1",
"10=999",""
});
var dd = new QuickFix.DataDictionary.DataDictionary();
dd.Load("../../../spec/fix/FIX44.xml");
Message msg = new Message();
msg.FromString(msgStr, false, dd, dd, _defaultMsgFactory);
// make sure no fields were dropped in parsing
Assert.AreEqual(msgStr.Length, msg.ToString().Length);
// make sure repeating groups are not rearranged
// 1 level deep
StringAssert.Contains(String.Join(Message.SOH, new string[] { "55=ABC", "65=CD", "48=securityid", "22=1" }), msg.ToString());
// 2 levels deep
StringAssert.Contains(String.Join(Message.SOH, new string[] { "311=underlyingsymbol", "312=WI", "309=underlyingsecurityid", "305=1" }), msg.ToString());
}
示例5: ToStringFieldOrder
public void ToStringFieldOrder()
{
Message msg = new Message();
msg.Header.SetField(new QuickFix.Fields.MsgType("A"));
msg.Header.SetField(new QuickFix.Fields.BeginString("FIX.4.2"));
msg.Header.SetField(new QuickFix.Fields.SenderCompID("SENDER"));
msg.Header.SetField(new QuickFix.Fields.TargetCompID("TARGET"));
msg.Header.SetField(new QuickFix.Fields.MsgSeqNum(42));
string expect = "8=FIX.4.2\x01" + "9=31\x01" + "35=A\x01" + "34=42\x01" + "49=SENDER\x01" + "56=TARGET\x01" + "10=200\x01";
Assert.That(msg.ToString(), Is.EqualTo(expect));
}
示例6: ToStringTest
public void ToStringTest()
{
string str1 = "8=FIX.4.2\x01" + "9=55\x01" + "35=0\x01" + "34=3\x01" + "49=TW\x01" +
"52=20000426-12:05:06\x01" + "56=ISLD\x01" + "1=acct123\x01" + "10=123\x01";
Message msg = new Message();
try
{
msg.FromString(str1, true, null, null, _defaultMsgFactory);
}
catch (InvalidMessage e)
{
Assert.Fail("Unexpected exception (InvalidMessage): " + e.Message);
}
StringField f1 = new StringField(8);
StringField f2 = new StringField(9);
StringField f3 = new StringField(35);
StringField f4 = new StringField(34);
StringField f5 = new StringField(49);
StringField f6 = new StringField(52);
StringField f7 = new StringField(56);
StringField f8 = new StringField(10);
StringField f9 = new StringField(1);
msg.Header.GetField(f1);
msg.Header.GetField(f2);
msg.Header.GetField(f3);
msg.Header.GetField(f4);
msg.Header.GetField(f5);
msg.Header.GetField(f6);
msg.Header.GetField(f7);
msg.GetField(f9);
msg.Trailer.GetField(f8);
Assert.That(f1.Obj, Is.EqualTo("FIX.4.2"));
Assert.That(f2.Obj, Is.EqualTo("55"));
Assert.That(f3.Obj, Is.EqualTo("0"));
Assert.That(f4.Obj, Is.EqualTo("3"));
Assert.That(f5.Obj, Is.EqualTo("TW"));
Assert.That(f6.Obj, Is.EqualTo("20000426-12:05:06"));
Assert.That(f7.Obj, Is.EqualTo("ISLD"));
Assert.That(f8.Obj, Is.EqualTo("123"));
Assert.That(f9.Obj, Is.EqualTo("acct123"));
string raw = msg.ToString();
Assert.That(raw, Is.EqualTo(str1));
}
示例7: SendRaw
protected bool SendRaw(Message message, int seqNum)
{
lock (sync_)
{
string msgType = message.Header.GetField(Fields.Tags.MsgType);
if (msgType == Fields.MsgType.HEARTBEAT)
{
_log.Info("Sending heartbeat inside sendraw");
}
InitializeHeader(message, seqNum);
if (Message.IsAdminMsgType(msgType))
{
this.Application.ToAdmin(message, this.SessionID);
if (MsgType.LOGON.Equals(msgType) && !state_.ReceivedReset)
{
Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(false);
if (message.IsSetField(resetSeqNumFlag))
message.GetField(resetSeqNumFlag);
if (resetSeqNumFlag.getValue())
{
state_.Reset("ResetSeqNumFlag");
message.Header.SetField(new Fields.MsgSeqNum(state_.GetNextSenderMsgSeqNum()));
}
state_.SentReset = resetSeqNumFlag.Obj;
}
}
else
{
try
{
this.Application.ToApp(message, this.SessionID);
}
catch (DoNotSend)
{
return false;
}
}
string messageString = message.ToString();
if (0 == seqNum)
Persist(message, messageString);
if (msgType == Fields.MsgType.HEARTBEAT)
{
_log.Info("about to send that heartbeat for real");
}
return Send(messageString, msgType == Fields.MsgType.HEARTBEAT);
}
}
示例8: ToApp
public void ToApp(Message msg, SessionID sessionID)
{
Console.WriteLine(sessionID + "------client toApp-------業務邏輯----"
+ msg.ToString());
}
示例9: ToApp
public void ToApp(Message message, SessionID sessionID)
{
Trace.TraceInformation(message.ToString());
}
示例10: 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);
}
}
示例11: FromAdmin
/// <summary>
/// every inbound admin level message will pass through this method,
/// such as heartbeats, logons, and logouts.
/// </summary>
/// <param name="message"></param>
/// <param name="sessionId"></param>
public void FromAdmin(Message message, SessionID sessionId)
{
Log(message.ToString());
}
示例12: MsgReject
//網關拒絕處理消息
protected virtual void MsgReject(Message msg, SessionID sid)
{
FixReport(msgTypeReject, msg, 0, msg.ToString());
}
示例13: MsgBusinessReject
protected virtual void MsgBusinessReject(Message msg, SessionID sid)
{
FixReport(msgTypeBsnsRej, msg, 0, msg.ToString());
}
示例14: ClientMessageEvent
private void ClientMessageEvent(Message arg1, bool arg2)
{
if (InvokeRequired)
{
Invoke(new Action<Message, bool>(ClientMessageEvent), arg1, arg2);
return;
}
AddItem(arg1.ToString());
}
示例15: 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);
}
}