public void SendEvent(StdEnum stateMachineEnum, XComponent.Order.UserObject.OrderCreation evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Order.UserObject.OrderCreation(), IncomingEventType.Transition, HeaderFactory.Create(10, (int)stateMachineEnum, -729436854, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void Send(Context context, XComponent.Trade.UserObject.Trade evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Trade.UserObject.Trade(), IncomingEventType.Transition, HeaderFactory.Create(context, 13, privateTopic)); Agent.Post(_engineAgentsById[context.AgentId], incomingEvent); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.Referential.UserObject.Instrument evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Referential.UserObject.Instrument(), IncomingEventType.Transition, HeaderFactory.Create(9, (int)stateMachineEnum, 1667656897, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.Common.Event.DefaultEvent evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Common.Event.DefaultEvent(), IncomingEventType.Transition, HeaderFactory.Create(6, (int)stateMachineEnum, -729436854, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void FormatParse() { var headerParser = HeaderFactory.Create(Configuration); enumParser = new EnumParser() { Configuration = Configuration }; foreach (var excel in excelList) { foreach (var sheet in excel.sheetList) { if (Configuration.IsDescription(sheet.name)) { continue; } if (Configuration.IsEnum(sheet.name)) { enumParser.Parse(sheet); } else { Row[] headerRow; if (Configuration.Header == 1) { headerRow = new[] { sheet.worksheet.Rows[Configuration.StartRow] } } ; else { headerRow = new[] { sheet.worksheet.Rows[Configuration.StartRow], sheet.worksheet.Rows[Configuration.StartRow + 1] } }; var headerTypeList = headerParser.Parse(headerRow); int maxHeaderReference = headerTypeList.Max(x => x.ReferenceIndex); List <Row> dataRow = new List <Row>(); for (int i = Configuration.StartRow + headerRow.Length; i < sheet.worksheet.Rows.Length; i++) { Row row = sheet.worksheet.Rows[i]; List <Cell> cellList = new List <Cell>(); foreach (var c in row.FilledCells) { if (c.ReferenceIndex < Configuration.StartCol) { continue; } if (c.ReferenceIndex > maxHeaderReference) { break; } cellList.Add(c); } dataRow.Add(new Row() { r = row.r, FilledCells = cellList.ToArray() }); } string[] names = sheet.name.Split('_'); string tmpName = ""; if (names.Length > 1) { tmpName = names[0]; } else { tmpName = sheet.name; } FormatSheet formatSheet = formatSheetList.Find(x => x.SheetName == tmpName); if (formatSheet == null) { formatSheet = new FormatSheet(); formatSheet.SheetName = tmpName; formatSheet.HeaderTypeList = headerTypeList; formatSheetList.Add(formatSheet); } formatSheet.rowList.AddRange(dataRow); } } } }
public void SendEvent(StdEnum stateMachineEnum, XComponent.HelloWorld.UserObject.SayHello evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.HelloWorld.UserObject.SayHello(), IncomingEventType.Transition, HeaderFactory.Create(9, (int)stateMachineEnum, -69981087, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void Send(Context context, XComponent.Authentication.UserObject.InitializationSuccess evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Authentication.UserObject.InitializationSuccess(), IncomingEventType.Transition, HeaderFactory.Create(context, 7, privateTopic)); Agent.Post(_engineAgentsById[context.AgentId], incomingEvent); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.Authentication.UserObject.InitializationSuccess evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Authentication.UserObject.InitializationSuccess(), IncomingEventType.Transition, HeaderFactory.Create(7, (int)stateMachineEnum, 769565298, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.Order.UserObject.ExecutionInput evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Order.UserObject.ExecutionInput(), IncomingEventType.Transition, HeaderFactory.Create(8, (int)stateMachineEnum, 823593371, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void Create_CreatesNewHeader() { var result = _subject.Create("hello", "world"); Assert.IsType <Header>(result); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.TradeCapture.UserObject.Error evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.TradeCapture.UserObject.Error(), IncomingEventType.Transition, HeaderFactory.Create(12, (int)stateMachineEnum, 183271270, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
public void SendEvent(StdEnum stateMachineEnum, XComponent.SlackProxy.UserObject.SendMessage evt, string privateTopic = null) { var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.SlackProxy.UserObject.SendMessage(), IncomingEventType.Transition, HeaderFactory.Create(10, (int)stateMachineEnum, 777714140, privateTopic)); PostOnStateMachine(incomingEvent, stateMachineEnum); }
/// <summary> /// A regex would be nice :) /// </summary> /// <param name="stream"></param> /// <param name="resultThisFar"></param> public override void HandleRequestPart(byte[] stream, HttpRequest resultThisFar) { UnparsedData = stream; string headerName = null; var bytesLeft = stream.Length; int headerValueStartIndex = 0; int headerValueEndIndex = 0; for (var i = 0; i < stream.Length; i++, bytesLeft--) { byte currentByte = stream[i]; if (headerName == null && currentByte == Constants.ColonByte) { headerName = GetHeaderString(stream, headerValueEndIndex, i); headerValueStartIndex = i + 1; } else if (stream[i] == Constants.CRByte) { // Special case when /r/n is received or /r/ncontentdata if (i == 0 && bytesLeft >= 2 && stream[1] == Constants.LFByte) { IsFinished = true; IsSucceeded = true; headerValueEndIndex = 2; break; } if (headerName != null && bytesLeft >= 2 && stream[i + 1] == Constants.LFByte) { // Handle end of one header scenario var headerValue = GetHeaderString(stream, headerValueStartIndex, i); headerValue = headerValue.TrimWhitespaces(); try { resultThisFar.AddHeader(_headerFactory.Create(headerName, headerValue)); } catch (Exception) { IsFinished = true; IsSucceeded = false; break; } finally { headerName = null; headerValueStartIndex = 0; headerValueEndIndex = i + 2; } } if (bytesLeft >= 4 && stream[i + 1] == Constants.LFByte && stream[i + 2] == Constants.CRByte && stream[i + 3] == Constants.LFByte) { // Handle end of headers scenario headerValueEndIndex = i + 4; IsFinished = true; IsSucceeded = true; break; } } } UnparsedData = stream.Skip(headerValueEndIndex).ToArray(); }