/// <summary> /// Initializes a new instance of the <see cref="SterlingMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public SterlingMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.AddMarketDataSupport(); this.AddTransactionalSupport(); this.RemoveSupportedMessage(MessageTypes.SecurityLookup); }
/// <summary> /// Initializes a new instance of the <see cref="RithmicMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public RithmicMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.AddMarketDataSupport(); this.AddTransactionalSupport(); this.AddSupportedMessage(MessageTypes.ChangePassword); }
/// <summary> /// Создать <see cref="RssMarketDataMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public RssMarketDataMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { HeartbeatInterval = TimeSpan.FromMinutes(5); this.AddSupportedMessage(MessageTypes.MarketData); }
/// <summary> /// Создать <see cref="SmartComMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public SmartComMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Version = SmartComVersions.V3; SecurityClassInfo.Add("OPT", RefTuple.Create(SecurityTypes.Option, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("OPTM", RefTuple.Create(SecurityTypes.Option, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("FUT", RefTuple.Create(SecurityTypes.Future, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("FXMFD", RefTuple.Create(SecurityTypes.Currency, ExchangeBoard.Mfd.Code)); SecurityClassInfo.Add("WFMFD", RefTuple.Create(SecurityTypes.Index, ExchangeBoard.Mfd.Code)); SecurityClassInfo.Add("WIMFD", RefTuple.Create(SecurityTypes.Index, ExchangeBoard.Mfd.Code)); SecurityClassInfo.Add("EQBR", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.MicexEqbr.Code)); SecurityClassInfo.Add("TQBR", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.MicexTqbr.Code)); SecurityClassInfo.Add("TQNE", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.MicexTqne.Code)); SecurityClassInfo.Add("EQNE", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.MicexEqne.Code)); SecurityClassInfo.Add("EQOB", RefTuple.Create(SecurityTypes.Bond, ExchangeBoard.MicexEqob.Code)); SecurityClassInfo.Add("EQNB", RefTuple.Create(SecurityTypes.Bond, ExchangeBoard.MicexEqnb.Code)); SecurityClassInfo.Add("EQDB", RefTuple.Create(SecurityTypes.Bond, ExchangeBoard.MicexEqdb.Code)); SecurityClassInfo.Add("EQOS", RefTuple.Create(SecurityTypes.Bond, ExchangeBoard.MicexEqos.Code)); SecurityClassInfo.Add("TQOB", RefTuple.Create(SecurityTypes.Bond, ExchangeBoard.MicexTqob.Code)); SecurityClassInfo.Add("TQLV", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.MicexTqlv.Code)); PortfolioBoardCodes = new Dictionary<string, string> { { "EQ", ExchangeBoard.MicexEqbr.Code }, { "FOB", ExchangeBoard.MicexFbcb.Code }, { "RTS_FUT", ExchangeBoard.Forts.Code }, }; UpdatePlatform(); this.AddMarketDataSupport(); this.AddTransactionalSupport(); this.RemoveSupportedMessage(MessageTypes.OrderStatus); }
public GameScene() { objects = new MyContainer<PivotObject>(100, 10); VisibleObjects = new MyContainer<PivotObject>(100, 2); ShadowObjects = new MyContainer<PivotObject>(100, 2); sceneGraph = new SceneGraph.SceneGraph(this); idgenertor = new IdGenerator(0); }
public CacheFixture() { IdGenerator = new IdGenerator(); ObjectGraph = new ObjectGraph(); MaterializationHooks = Enumerable.Empty<IMaterializationHook>(); Cache = new Cache(IdGenerator, ObjectGraph, MaterializationHooks); }
/// <summary> /// Создать <see cref="OandaMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public OandaMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { HeartbeatInterval = TimeSpan.FromSeconds(60); this.AddMarketDataSupport(); this.AddTransactionalSupport(); }
/// <summary> /// Initializes a new instance of the <see cref="ETradeMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public ETradeMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.AddMarketDataSupport(); this.AddTransactionalSupport(); this.RemoveSupportedMessage(MessageTypes.PortfolioLookup); }
public GameScene(GameScene s, uint generatorId = 0) { ShadowObjects = s.ShadowObjects; VisibleObjects = s.VisibleObjects; objects = s.objects; sceneGraph = s.sceneGraph; idgenertor = new IdGenerator(generatorId); }
/// <summary> /// Initializes a new instance of the <see cref="InteractiveBrokersMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public InteractiveBrokersMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Address = DefaultAddress; ServerLogLevel = ServerLogLevels.Detail; this.AddMarketDataSupport(); this.AddTransactionalSupport(); }
public void Constructor_Throws_OnTimestampWraparound() { var mc = MaskConfig.Default; var ts = new MockTimeSource(mc.WraparoundDate(TESTEPOCH).AddMilliseconds(-1)); //Set clock to 1 ms before epoch var g = new IdGenerator(0, TESTEPOCH, MaskConfig.Default, ts); Assert.IsTrue(g.CreateId() > 0); //Should succeed; ts.NextTick(); g.CreateId(); //Should fail }
/// <summary> /// Создать <see cref="BitStampMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public BitStampMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { // https://www.bitstamp.net/api/ // Do not make more than 600 request per 10 minutes or we will ban your IP address. HeartbeatInterval = TimeSpan.FromSeconds(1); this.AddMarketDataSupport(); this.AddTransactionalSupport(); }
/// <summary> /// Initialize <see cref="MessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> protected MessageAdapter(IdGenerator transactionIdGenerator) { if (transactionIdGenerator == null) throw new ArgumentNullException("transactionIdGenerator"); Platform = Platforms.AnyCPU; TransactionIdGenerator = transactionIdGenerator; SecurityClassInfo = new Dictionary<string, RefPair<SecurityTypes, string>>(); }
public void UpdatesState() { toTest = new IdGenerator(); StoreNewObject(); toTest = new IdGenerator(); StoreNewObject(); toTest = new IdGenerator(); using (var container = NewInstance()) { Assert.AreEqual( 3,Increment(container)); } }
/// <summary> /// Создать <see cref="LuaFixTransactionMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public LuaFixTransactionMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.RemoveMarketDataSupport(); Login = "******"; Password = "******".To<SecureString>(); Address = QuikTrader.DefaultLuaAddress; TargetCompId = "StockSharpTS"; SenderCompId = "quik"; //ExchangeBoard = ExchangeBoard.Forts; RequestAllPortfolios = true; }
public void StoresState() { using (var container1 = NewInstance()) { toTest.NextId(typeof(WithAutoIDs), container1); toTest.StoreState(container1); } toTest = new IdGenerator(); using (var container2 = NewInstance()) { Assert.AreEqual(Increment(container2), 2); } }
/// <summary> /// Создать <see cref="AlfaDirectMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public AlfaDirectMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Platform = Platforms.x86; this.AddMarketDataSupport(); this.AddTransactionalSupport(); SecurityClassInfo.Add("FORTS", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("INDEX", RefTuple.Create(SecurityTypes.Index, ExchangeBoard.Micex.Code)); SecurityClassInfo.Add("INDEX2", RefTuple.Create(SecurityTypes.Index, "INDEX")); SecurityClassInfo.Add("MICEX_SHR_T", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.Micex.Code)); SecurityClassInfo.Add("RTS_STANDARD", RefTuple.Create(SecurityTypes.Stock, ExchangeBoard.Forts.Code)); }
/// <summary> /// Создать <see cref="EmulationMessageAdapter"/>. /// </summary> /// <param name="emulator">Эмулятор торгов.</param> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public EmulationMessageAdapter(IMarketEmulator emulator, IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Emulator = emulator; this.AddTransactionalSupport(); this.AddSupportedMessage(MessageTypes.Security); this.AddSupportedMessage(MessageTypes.Board); this.AddSupportedMessage(MessageTypes.Level1Change); this.AddSupportedMessage(MessageTypes.PortfolioChange); this.AddSupportedMessage(MessageTypes.PositionChange); this.AddSupportedMessage(ExtendedMessageTypes.CommissionRule); this.AddSupportedMessage(ExtendedMessageTypes.Clearing); this.AddSupportedMessage(ExtendedMessageTypes.Generator); }
/// <summary> /// Создать <see cref="LuaFixMarketDataMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public LuaFixMarketDataMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.RemoveTransactionalSupport(); Login = "******"; Password = "******".To<SecureString>(); Address = QuikTrader.DefaultLuaAddress; TargetCompId = "StockSharpMD"; SenderCompId = "quik"; //ExchangeBoard = ExchangeBoard.Forts; //Version = FixVersions.Fix44_Lua; RequestAllSecurities = true; //MarketData = FixMarketData.MarketData; //TimeZone = TimeHelper.Moscow; }
private void DisplayTree() { Console.Clear(); var idGenerator = new IdGenerator(_bindController.MainMultiTree.ToList()); _currentDoubleNode = _treeConstructor.GetFilledTree(_bindController, idGenerator); Console.WriteLine(_consoleTreeWriter.ConvertToString(_bindController.MainMultiTree, _bindController.MinorSingleTree)); Console.WriteLine(_consoleTreeWriter.ConvertToString(_currentDoubleNode)); _treeConverter.ConvertMultiTreeAsMulti(new MultiTree<StringId>(_currentDoubleNode.ToMultiNode())).ForEach(Console.WriteLine); Console.WriteLine(); if (_messages.Any()) { Console.WriteLine(_messages.Last()); } Console.WriteLine(); }
/// <summary> /// Создать <see cref="SmartComMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public SmartComMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Version = SmartComVersions.V3; SecurityClassInfo.Add("OPT", RefTuple.Create(SecurityTypes.Option, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("OPTM", RefTuple.Create(SecurityTypes.Option, ExchangeBoard.Forts.Code)); SecurityClassInfo.Add("FUT", RefTuple.Create(SecurityTypes.Future, ExchangeBoard.Forts.Code)); PortfolioBoardCodes = new Dictionary<string, string> { { "EQ", ExchangeBoard.MicexEqbr.Code }, { "FOB", ExchangeBoard.MicexFbcb.Code }, { "RTS_FUT", ExchangeBoard.Forts.Code }, }; UpdatePlatform(); this.AddMarketDataSupport(); this.AddTransactionalSupport(); this.RemoveSupportedMessage(MessageTypes.OrderStatus); }
/// <summary> /// Создать <see cref="IQFeedMarketDataMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public IQFeedMarketDataMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { Level1ColumnRegistry = new IQFeedLevel1ColumnRegistry(); _level1Columns = new[] { Level1ColumnRegistry.OpenInterest, Level1ColumnRegistry.Open, Level1ColumnRegistry.High, Level1ColumnRegistry.Low, Level1ColumnRegistry.Close, Level1ColumnRegistry.BidPrice, Level1ColumnRegistry.BidTime, Level1ColumnRegistry.BidVolume, //Level1ColumnRegistry.BidMarket, Level1ColumnRegistry.AskPrice, Level1ColumnRegistry.AskTime, Level1ColumnRegistry.AskVolume, //Level1ColumnRegistry.AskMarket, Level1ColumnRegistry.LastTradeId, Level1ColumnRegistry.LastDate, Level1ColumnRegistry.LastTradeTime, Level1ColumnRegistry.LastTradePrice, Level1ColumnRegistry.LastTradeVolume, //Level1ColumnRegistry.LastTradeMarket, Level1ColumnRegistry.TotalVolume, Level1ColumnRegistry.TradeCount, Level1ColumnRegistry.VWAP, Level1ColumnRegistry.DecimalPrecision, Level1ColumnRegistry.MarketOpen, Level1ColumnRegistry.MessageContents }; this.AddMarketDataSupport(); }
public BasketEmulationAdapter(IdGenerator transactionIdGenerator, EmulationSettings settings) : base(transactionIdGenerator) { _settings = settings; }
internal string GenerateStorageObjectName() => IdGenerator.FromGuid(prefix: "file-");
private void InlayAggregateGraph(DLCPackageData info, DLCPackageType dlcType) { var dlcName = info.Inlay.DLCSixName; // Xblock var xbl = new GraphItem(); xbl.Name = String.Format("guitar_{0}", dlcName); xbl.Canonical = String.Format(CANONICAL_XBLOCK[dlcType], dlcName); xbl.RelPathDirectory = xbl.Canonical; xbl.Tag = new List <string>(); xbl.Tag.Add(TagValue.EmergentWorld.GetDescription()); xbl.Tag.Add(TagValue.XWorld.GetDescription()); xbl.UUID = IdGenerator.Guid(); xbl.RelPathFile = String.Format("guitar_{0}.xblock", dlcName); GameXblock = xbl; // JsonDB JsonDB = new List <GraphItem>(); var json = new GraphItem(); json.Name = String.Format("dlc_guitar_{0}", dlcName); json.Canonical = currentPlatform.IsConsole ? CANONICAL_MANIFEST_CONSOLE : String.Format(CANONICAL_MANIFEST_PC, dlcName); json.RelPathDirectory = json.Canonical; json.Tag = new List <string>(); json.Tag.Add(TagValue.Database.GetDescription()); json.Tag.Add(TagValue.JsonDB.GetDescription()); json.UUID = IdGenerator.Guid(); json.RelPathFile = String.Format("dlc_guitar_{0}.json", dlcName); JsonDB.Add(json); if (currentPlatform.IsConsole) { // HsonDB - One file for each manifest (Xbox360 / PS3 only) HsonDB = new List <GraphItem>(); var hson = new GraphItem(); hson.Name = String.Format("dlc_{0}", dlcName); hson.Canonical = CANONICAL_MANIFEST_CONSOLE; hson.RelPathDirectory = hson.Canonical; hson.Tag = new List <string>(); hson.Tag.Add(TagValue.Database.GetDescription()); hson.Tag.Add(TagValue.HsonDB.GetDescription()); hson.UUID = IdGenerator.Guid(); hson.RelPathFile = String.Format("dlc_{0}.hson", dlcName); HsonDB.Add(hson); } else { // HsanDB - One file for all manifest (PC / Mac) var hsan = new GraphItem(); hsan.Name = String.Format("dlc_{0}", dlcName); hsan.Canonical = String.Format(CANONICAL_MANIFEST_PC, dlcName); hsan.RelPathDirectory = hsan.Canonical; hsan.Tag = new List <string>(); hsan.Tag.Add(TagValue.Database.GetDescription()); hsan.Tag.Add(TagValue.HsanDB.GetDescription()); hsan.UUID = IdGenerator.Guid(); hsan.RelPathFile = String.Format("dlc_{0}.hsan", dlcName); HsanDB = hsan; } ImageArt = new List <GraphItemLLID>(); // Inlay Icon (DDS) var aArtArray = new string[] { String.Format("reward_inlay_{0}_512", dlcName), String.Format("reward_inlay_{0}_256", dlcName), String.Format("reward_inlay_{0}_128", dlcName), String.Format("reward_inlay_{0}_64", dlcName) }; foreach (var icon in aArtArray) { var iconDDS = new GraphItemLLID(); iconDDS.Canonical = CANONICAL_IMAGEART[dlcType]; iconDDS.RelPathDirectory = iconDDS.Canonical; iconDDS.LogPathDirectory = iconDDS.Canonical; iconDDS.Tag = new List <string>(); iconDDS.Tag.Add(TagValue.DDS.GetDescription()); iconDDS.Tag.Add(TagValue.Image.GetDescription()); iconDDS.UUID = IdGenerator.Guid(); iconDDS.LLID = Guid.Parse(IdGenerator.LLID()); iconDDS.Name = icon; iconDDS.RelPathFile = String.Format("{0}.dds", iconDDS.Name); iconDDS.LogPathFile = iconDDS.RelPathFile; ImageArt.Add(iconDDS); } // Inlay Art var inlayDDS = new GraphItemLLID(); inlayDDS.Canonical = CANONICAL_INLAY; inlayDDS.RelPathDirectory = inlayDDS.Canonical; inlayDDS.LogPathDirectory = inlayDDS.Canonical; inlayDDS.Tag = new List <string>(); inlayDDS.Tag.Add(TagValue.DDS.GetDescription()); inlayDDS.Tag.Add(TagValue.Image.GetDescription()); inlayDDS.UUID = IdGenerator.Guid(); inlayDDS.LLID = Guid.Parse(IdGenerator.LLID()); inlayDDS.Name = String.Format("inlay_{0}", dlcName); inlayDDS.RelPathFile = String.Format("{0}.dds", inlayDDS.Name); inlayDDS.LogPathFile = inlayDDS.RelPathFile; ImageArt.Add(inlayDDS); // Inlay Nif var nif = new GraphItemLLID(); nif.Canonical = CANONICAL_INLAY; nif.RelPathDirectory = nif.Canonical; nif.LogPathDirectory = nif.Canonical; nif.Tag = new List <string>(); nif.Tag.Add(TagValue.Application.GetDescription()); nif.Tag.Add(TagValue.GamebryoSceneGraph.GetDescription()); nif.UUID = IdGenerator.Guid(); nif.LLID = Guid.Parse(IdGenerator.LLID()); nif.Name = dlcName; nif.RelPathFile = String.Format("{0}.nif", dlcName); nif.LogPathFile = nif.RelPathFile; InlayNif = nif; }
public Genre() { CreatedTime = DateTime.Now; Id = IdGenerator.NewGuid(); LastModifiedTime = DateTime.Now; }
public IReferencingStage <TObject> ToRegisteredDefault <TDerived>() where TDerived : TObject { return(MakeAlias(IdGenerator <TDerived> .GetDefaultId())); }
/// <summary> /// Создать <see cref="HistorySessionHolder"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public HistorySessionHolder(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { StartDate = DateTimeOffset.MinValue; StopDate = DateTimeOffset.MaxValue; }
public HospitalRepository(DialysisContext context, IOptions <MyOptions> optionsAccessor) { _context = context; _optionsAccessor = optionsAccessor.Value; _idGenerator = IdGenerator.CreateGenerator(_optionsAccessor.GeneratorId); }
/// <summary> /// Initializes a new instance of the <see cref="CfhFixDialect"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public CfhFixDialect(IdGenerator transactionIdGenerator) : base(transactionIdGenerator, Encoding.UTF8) { }
/// <summary> /// Создать <see cref="BasketMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public BasketMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { _innerAdapters = new InnerAdapterList(); Portfolios = new SynchronizedDictionary <string, IMessageAdapter>(StringComparer.InvariantCultureIgnoreCase); }
public StudioHistorySessionHolder(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { IsTransactionEnabled = true; IsMarketDataEnabled = false; }
public void Execute_should_use_cached_IWireProtocol_if_available([Values(false, true)] bool withSameConnection) { var session = NoCoreSession.Instance; var responseHandling = CommandResponseHandling.Return; var messageEncoderSettings = new MessageEncoderSettings(); var subject = new CommandWireProtocol <BsonDocument>( session, ReadPreference.Primary, new DatabaseNamespace("test"), new BsonDocument("cmd", 1), null, // commandPayloads NoOpElementNameValidator.Instance, null, // additionalOptions null, // postWriteAction responseHandling, BsonDocumentSerializer.Instance, messageEncoderSettings, null); // serverApi var mockConnection = new Mock <IConnection>(); var commandResponse = MessageHelper.BuildCommandResponse(CreateRawBsonDocument(new BsonDocument("ok", 1))); var connectionId = SetupConnection(mockConnection); var result = subject.Execute(mockConnection.Object, CancellationToken.None); var cachedWireProtocol = subject._cachedWireProtocol(); cachedWireProtocol.Should().NotBeNull(); var cachedConnectionId = subject._cachedConnectionId(); cachedConnectionId.Should().NotBeNull(); subject._cachedConnectionId().Should().BeSameAs(connectionId); result.Should().Be("{ ok : 1 }"); commandResponse = MessageHelper.BuildCommandResponse(CreateRawBsonDocument(new BsonDocument("ok", 1))); _ = SetupConnection(mockConnection, connectionId); subject._responseHandling(CommandResponseHandling.Ignore); // will trigger the exception if the CommandUsingCommandMessageWireProtocol ctor will be called result = null; var exception = Record.Exception(() => { result = subject.Execute(mockConnection.Object, CancellationToken.None); }); if (withSameConnection) { exception.Should().BeNull(); subject._cachedWireProtocol().Should().BeSameAs(cachedWireProtocol); subject._cachedConnectionId().Should().BeSameAs(connectionId); result.Should().Be("{ ok : 1 }"); } else { var e = exception.Should().BeOfType <ArgumentException>().Subject; e.Message.Should().StartWith("CommandResponseHandling must be Return, NoneExpected or ExhaustAllowed."); e.ParamName.Should().Be("responseHandling"); subject._cachedConnectionId().Should().NotBeSameAs(cachedWireProtocol); subject._cachedConnectionId().Should().NotBeSameAs(connectionId); result.Should().BeNull(); } ConnectionId SetupConnection(Mock <IConnection> connection, ConnectionId id = null) { if (id == null || !withSameConnection) { id = new ConnectionId(new ServerId(new ClusterId(IdGenerator <ClusterId> .GetNextId()), new DnsEndPoint("localhost", 27017))); } connection .Setup(c => c.ReceiveMessage(It.IsAny <int>(), It.IsAny <IMessageEncoderSelector>(), messageEncoderSettings, CancellationToken.None)) .Returns(commandResponse); connection.SetupGet(c => c.ConnectionId).Returns(id); connection .SetupGet(c => c.Description) .Returns( new ConnectionDescription( id, new HelloResult(new BsonDocument("ok", 1)), new BuildInfoResult(new BsonDocument("version", "4.4")))); return(id); } }
/// <summary> /// Создать <see cref="QuikTrans2QuikAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public QuikTrans2QuikAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { IsAsyncMode = true; Platform = Platforms.x86; //SessionHolder.TerminalChanged += ResetApi; this.AddTransactionalSupport(); this.RemoveSupportedMessage(MessageTypes.OrderStatus); this.RemoveSupportedMessage(MessageTypes.PortfolioLookup); }
/// <summary> /// Initializes a new instance of the <see cref="BarChartMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public BarChartMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.AddMarketDataSupport(); }
/// <summary> /// Создать <see cref="HistorySessionHolder"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> /// <param name="securityProvider">Поставщик информации об инструментах.</param> public HistorySessionHolder(IdGenerator transactionIdGenerator, ISecurityProvider securityProvider) : this(transactionIdGenerator) { SecurityProvider = securityProvider; }
// constructors /// <summary> /// Initializes a new instance of the <see cref="ConnectionId"/> class. /// </summary> /// <param name="serverId">The server identifier.</param> public ConnectionId(ServerId serverId) : this(serverId, IdGenerator <ConnectionId> .GetNextId()) { }
/// <summary> /// Initializes a new instance of the <see cref="PassThroughMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public PassThroughMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { }
public JsonResult CreateToken() { return(Json(IdGenerator.GenerateId())); }
/// <summary> /// Обработать сообщение. /// </summary> /// <param name="message">Сообщение.</param> /// <returns>Результат обработки. Если будет возрвщено <see langword="null"/>, /// то генератору пока недостаточно данных для генерации нового сообщения.</returns> protected override Message OnProcess(Message message) { DateTimeOffset time; switch (message.Type) { case MessageTypes.Board: return(null); case MessageTypes.Level1Change: { var l1Msg = (Level1ChangeMessage)message; var value = l1Msg.Changes.TryGetValue(Level1Fields.LastTradePrice); if (value != null) { _lastTradePrice = (decimal)value; } time = l1Msg.ServerTime; break; } case MessageTypes.Execution: { var execMsg = (ExecutionMessage)message; switch (execMsg.ExecutionType) { case ExecutionTypes.Tick: case ExecutionTypes.Trade: _lastTradePrice = execMsg.TradePrice.Value; break; case ExecutionTypes.OrderLog: if (execMsg.TradePrice != null) { _lastTradePrice = execMsg.TradePrice.Value; } break; default: return(null); } time = execMsg.ServerTime; break; } case MessageTypes.Time: { var timeMsg = (TimeMessage)message; time = timeMsg.ServerTime; break; } default: return(null); } if (!IsTimeToGenerate(time)) { return(null); } var trade = new ExecutionMessage { SecurityId = SecurityId, TradeId = IdGenerator.GetNextId(), ServerTime = time, LocalTime = time.LocalDateTime, OriginSide = GenerateDirection ? RandomGen.GetEnum <Sides>() : (Sides?)null, Volume = Volumes.Next(), ExecutionType = ExecutionTypes.Tick }; var priceStep = SecurityDefinition.PriceStep ?? 0.01m; _lastTradePrice += RandomGen.GetInt(-MaxPriceStepCount, MaxPriceStepCount) * priceStep; if (_lastTradePrice <= 0) { _lastTradePrice = priceStep; } trade.TradePrice = _lastTradePrice; LastGenerationTime = time; return(trade); }
/// <summary> /// Initializes a new instance of the <see cref="OpenECryMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public OpenECryMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.AddMarketDataSupport(); this.AddTransactionalSupport(); }
private void SongAggregateGraph(DLCPackageData info, DLCPackageType dlcType) { var dlcName = info.Name.ToLower(); var songPartition = new SongPartition(); // Xblock var xbl = new GraphItem(); xbl.Name = dlcName; xbl.Canonical = String.Format(CANONICAL_XBLOCK[dlcType], dlcName); xbl.RelPathDirectory = xbl.Canonical; xbl.Tag = new List <string>(); xbl.Tag.Add(TagValue.EmergentWorld.GetDescription()); xbl.Tag.Add(TagValue.XWorld.GetDescription()); xbl.UUID = IdGenerator.Guid(); xbl.RelPathFile = String.Format("{0}.xblock", xbl.Name); GameXblock = xbl; JsonDB = new List <GraphItem>(); if (currentPlatform.IsConsole) { HsonDB = new List <GraphItem>(); } SongXml = new List <GraphItemLLID>(); MusicgameSong = new List <GraphItemLLID>(); foreach (var arrangement in info.Arrangements) { var name = String.Format(NAME_ARRANGEMENT, dlcName, songPartition.GetArrangementFileName(arrangement.Name, arrangement.ArrangementType).ToLower()); // JsonDB var json = new GraphItem(); json.Name = name; json.Canonical = currentPlatform.IsConsole ? CANONICAL_MANIFEST_CONSOLE : String.Format(CANONICAL_MANIFEST_PC, dlcName); json.RelPathDirectory = json.Canonical; json.Tag = new List <string>(); json.Tag.Add(TagValue.Database.GetDescription()); json.Tag.Add(TagValue.JsonDB.GetDescription()); json.UUID = IdGenerator.Guid(); json.RelPathFile = String.Format("{0}.json", json.Name); JsonDB.Add(json); //One file for each arrangement (Xbox360 / PS3 only) if (currentPlatform.IsConsole) { // HsonDB var hson = new GraphItem(); hson.Name = name; hson.Canonical = CANONICAL_MANIFEST_CONSOLE; hson.RelPathDirectory = hson.Canonical; hson.Tag = new List <string>(); hson.Tag.Add(TagValue.Database.GetDescription()); hson.Tag.Add(TagValue.HsonDB.GetDescription()); hson.UUID = IdGenerator.Guid(); hson.RelPathFile = String.Format("{0}.hson", json.Name); HsonDB.Add(hson); } // XmlSong var xml = new GraphItemLLID(); xml.Name = name; xml.Canonical = String.Format(CANONICAL_XMLSONG, dlcName); xml.RelPathDirectory = xml.Canonical; xml.LogPathDirectory = xml.Canonical; xml.Tag = new List <string>(); xml.Tag.Add(TagValue.Application.GetDescription()); xml.Tag.Add(TagValue.XML.GetDescription()); xml.UUID = arrangement.SongXml.UUID; xml.LLID = Guid.Parse(arrangement.SongXml.LLID); xml.RelPathFile = String.Format("{0}.xml", xml.Name); xml.LogPathFile = xml.RelPathFile; SongXml.Add(xml); // Musicgame var sng = new GraphItemLLID(); sng.Name = name; sng.Canonical = String.Format(CANONICAL_GAMESONG, currentPlatform.GetPathName()[1].ToLower()); sng.RelPathDirectory = sng.Canonical; sng.LogPathDirectory = sng.Canonical; sng.Tag = new List <string>(); sng.Tag.Add(TagValue.Application.GetDescription()); sng.Tag.Add(TagValue.MusicgameSong.GetDescription()); if (currentPlatform.IsConsole) { sng.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform)); } sng.UUID = arrangement.SongFile.UUID; sng.LLID = Guid.Parse(arrangement.SongFile.LLID); sng.RelPathFile = String.Format("{0}.sng", sng.Name); sng.LogPathFile = sng.RelPathFile; MusicgameSong.Add(sng); } if (currentPlatform.version == GameVersion.RS2014) { //One file for all arrangement (PC / Mac only) if (!currentPlatform.IsConsole) { // HsanDB var hsan = new GraphItem(); hsan.Name = String.Format("songs_dlc_{0}", dlcName); hsan.Canonical = String.Format(CANONICAL_MANIFEST_PC, dlcName); hsan.RelPathDirectory = hsan.Canonical; hsan.Tag = new List <string>(); hsan.Tag.Add(TagValue.Database.GetDescription()); hsan.Tag.Add(TagValue.HsanDB.GetDescription()); hsan.UUID = IdGenerator.Guid(); hsan.RelPathFile = String.Format("{0}.hsan", hsan.Name); HsanDB = hsan; } // Showlight (Xml) var xml = new GraphItemLLID(); xml.Name = String.Format(NAME_SHOWLIGHT, dlcName); xml.Canonical = String.Format(CANONICAL_XMLSONG, dlcName); xml.RelPathDirectory = xml.Canonical; xml.LogPathDirectory = xml.Canonical; xml.Tag = new List <string>(); xml.Tag.Add(TagValue.Application.GetDescription()); xml.Tag.Add(TagValue.XML.GetDescription()); xml.UUID = IdGenerator.Guid(); xml.LLID = Guid.Parse(IdGenerator.LLID()); xml.RelPathFile = String.Format("{0}.xml", xml.Name); xml.LogPathFile = xml.RelPathFile; SongXml.Add(xml); ShowlightXml = xml; } // Image Art (DDS) var aArtArray = new string[] { info.AlbumArtPath }; if (currentPlatform.version == GameVersion.RS2014) { aArtArray = new string[] { String.Format("album_{0}_256.dds", dlcName), String.Format("album_{0}_128.dds", dlcName), String.Format("album_{0}_64.dds", dlcName) } } ; ImageArt = new List <GraphItemLLID>(); foreach (var album in aArtArray) { var dds = new GraphItemLLID(); dds.Canonical = CANONICAL_IMAGEART[dlcType]; dds.RelPathDirectory = dds.Canonical; dds.LogPathDirectory = dds.Canonical; dds.Tag = new List <string>(); dds.Tag.Add(TagValue.DDS.GetDescription()); dds.Tag.Add(TagValue.Image.GetDescription()); dds.UUID = IdGenerator.Guid(); dds.LLID = Guid.Parse(IdGenerator.LLID()); dds.Name = Path.GetFileNameWithoutExtension(album); dds.RelPathFile = Path.GetFileName(album); dds.LogPathFile = dds.RelPathFile; ImageArt.Add(dds); } // Lyrics Font Texture if (!String.IsNullOrEmpty(info.LyricsTex)) { LyricsTex = new GraphItemLLID(); var tex = new GraphItemLLID(); tex.Canonical = String.Format(CANONICAL_MANIFEST_PC, dlcName); tex.RelPathDirectory = tex.Canonical; tex.LogPathDirectory = tex.Canonical; tex.Tag = new List <string>(); tex.Tag.Add(TagValue.DDS.GetDescription()); tex.Tag.Add(TagValue.Image.GetDescription()); tex.UUID = IdGenerator.Guid(); tex.LLID = Guid.Parse(IdGenerator.LLID()); tex.Name = String.Format("lyrics_{0}", dlcName); tex.RelPathFile = tex.Name; tex.LogPathFile = tex.RelPathFile; LyricsTex = tex; } // Soundbank Soundbank = new List <GraphItemLLID>(); var bnk = new GraphItemLLID(); bnk.Canonical = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower()); bnk.RelPathDirectory = bnk.Canonical; bnk.LogPathDirectory = LOGPATH_SOUNDBANK; bnk.Tag = new List <string>(); bnk.Tag.Add(TagValue.Audio.GetDescription()); bnk.Tag.Add(TagValue.WwiseSoundBank.GetDescription()); bnk.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform)); bnk.UUID = IdGenerator.Guid(); bnk.LLID = Guid.Parse(IdGenerator.LLID()); bnk.Name = String.Format("song_{0}", dlcName); bnk.RelPathFile = String.Format("{0}.bnk", bnk.Name); bnk.LogPathFile = bnk.RelPathFile; Soundbank.Add(bnk); if (currentPlatform.version == GameVersion.RS2014) { // Soundbank Preview var bnkPreview = new GraphItemLLID(); bnkPreview.Canonical = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower()); bnkPreview.RelPathDirectory = bnkPreview.Canonical; bnkPreview.LogPathDirectory = LOGPATH_SOUNDBANK; bnkPreview.Tag = new List <string>(); bnkPreview.Tag.Add(TagValue.Audio.GetDescription()); bnkPreview.Tag.Add(TagValue.WwiseSoundBank.GetDescription()); bnkPreview.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform)); bnkPreview.UUID = IdGenerator.Guid(); bnkPreview.LLID = Guid.Parse(IdGenerator.LLID()); bnkPreview.Name = String.Format("song_{0}_preview", dlcName); bnkPreview.RelPathFile = String.Format("{0}.bnk", bnkPreview.Name); bnkPreview.LogPathFile = bnkPreview.RelPathFile; Soundbank.Add(bnkPreview); } }
public InMemorySessionTransactionIdStorage(IdGenerator idGenerator) { _idGenerator = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator)); }
/// <summary> /// Создать <see cref="LuaFixTransactionMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> public LuaFixTransactionMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { this.RemoveMarketDataSupport(); }
public string GenerateCompanyExternalId() => IdGenerator.FromGuid(prefix: _companyExternalIdPrefix);
private string GenerateStorageBucketName() => IdGenerator.FromDateTime(prefix: "bigquerytests-");
internal string CreateTopicId() => IdGenerator.FromGuid(prefix: TopicPrefix);
/// <summary> /// Инициализировать <see cref="QuikMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Генератор идентификаторов транзакций.</param> protected QuikMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { SecurityClassInfo.FillDefault(); }
protected override void PopulateTable(bool fresh) { using (var connection = GetConnection()) { connection.Open(); SpannerCommand command = connection.CreateInsertOrUpdateCommand(TableName); var keyParameter = command.Parameters.Add("K", SpannerDbType.String, IdGenerator.FromGuid()); var valueParameter = command.Parameters.Add("StringValue", SpannerDbType.String, IdGenerator.FromGuid()); // Create a lowest-bound timestamp which is definitely valid, but not // associated with TestKey RetryHelpers.ExecuteWithRetry(() => { using (var tx = connection.BeginTransaction()) { command.Transaction = tx; command.ExecuteNonQuery(); tx.Commit(out var timestamp); TimestampBeforeEntries = timestamp; } }); // It's a pity we have to do this, but otherwise it's hard to get reliable tests. Thread.Sleep(Staleness + TimeSpan.FromSeconds(2)); } }
internal string CreateTableId() => IdGenerator.FromGuid(prefix: "test_", separator: "_");
public void Save() { Car.Id = IdGenerator.GetId(cars); cars.Add(Car); ClosePage(); }
public void CreateWorld(IdGenerator generator) { }
/// <summary> /// When the whole ride ends /// </summary> /// <param name="rideId"></param> static async Task OnRideEndedAsync(ActiveRideStatus status) { //Reward the driver: { string driverId = status.RideInfo.DriverId; //Handle any equipped item GameItem item = await ValidateAndTakeEquippedItem(driverId, status.DriverGameElements); GameMultipliers multipliers = new GameMultipliers(item); await AddNewEffect(driverId, new CompoundEffect( new GameInfoEffectBase[] { new LevelEffect((int)(1000 * multipliers.Level), "", "", ""), new KingdomEffect((int)(500 * multipliers.Kingdom), "", "", ""), new ItemEffect( new GameItem( "Sword", GameItem.Effect.Level, 2, 10, 1, flavorText: "It's sharp!"), "", "", "") }, "Gave a ride", "Gave a chocolate ride", IdGenerator.GenerateNewId(status) ), true ); } //Reward the passengers foreach (var kvp in status.RidersState) { //Only riders who finished the ride //TODO this assuems that all riders either canceled, or got dropped off if (kvp.Value == ActiveRideStatus.RiderState.Canceled) { continue; } GameItem item = null; if (status.RidersGameElements.TryGetValue(kvp.Key, out RequestGameElements gameElements)) { item = await ValidateAndTakeEquippedItem(kvp.Key, gameElements); } GameMultipliers multipliers = new GameMultipliers(item); await AddNewEffect(kvp.Key, new CompoundEffect( new GameInfoEffectBase[] { new LevelEffect((int)(200 * multipliers.Level), "", "", ""), new ItemEffect( new GameItem( "Ticket stub", GameItem.Effect.None, 0, startCount: 1, flavorText: "What a nice ride it was"), "", "", "") }, "Took a ride", "Took a strawberry ride", IdGenerator.GenerateNewId(status) ), true ); } }
public IDictionary <int, string> ClonePubArchive(int sourceSiteId, int targetSiteId, int toCid, int[] archiveIdArray, bool includeExtend, bool includeTempateBind, bool includeRelatedLink) { int totalFailed = 0; int totalSuccess = 0; IDictionary <int, string> errDict = new Dictionary <int, string>(); bool isFailed; bool shouldReSave; IContentContainer srcContent = this._contentRep.GetContent(sourceSiteId); IContentContainer tarContent = this._contentRep.GetContent(targetSiteId); foreach (int archiveId in archiveIdArray) { var srcArchive = srcContent.GetArchiveById(archiveId); var tarArchive = tarContent.CreateArchive(0, IdGenerator.GetNext(5), toCid, srcArchive.Title); tarArchive.CreateDate = DateTime.Now; tarArchive.LastModifyDate = tarArchive.CreateDate; tarArchive.Content = srcArchive.Content; tarArchive.Alias = srcArchive.Alias; tarArchive.PublisherId = srcArchive.PublisherId; tarArchive.Flags = srcArchive.Flags; tarArchive.Outline = srcArchive.Outline; tarArchive.Source = srcArchive.Source; tarArchive.Tags = srcArchive.Tags; tarArchive.Location = srcArchive.Location; tarArchive.Thumbnail = srcArchive.Thumbnail; tarArchive.SmallTitle = srcArchive.SmallTitle; tarArchive.ViewCount = srcArchive.ViewCount; isFailed = false; shouldReSave = false; if (tarArchive.Save() > 0) { if (includeTempateBind && srcArchive.Template != null && srcArchive.Template.BindType == TemplateBindType.ArchiveTemplate && !string.IsNullOrEmpty(srcArchive.Template.TplPath)) { tarArchive.SetTemplatePath(srcArchive.Template.TplPath); shouldReSave = true; } //克隆扩展 if (includeExtend) { this.CloneArchiveExtendValue(srcArchive, tarArchive, errDict, ref isFailed, ref shouldReSave); } //包含关联链接 if (includeRelatedLink) { this.CloneArchiveRelatedLink(srcArchive, tarArchive); } if (isFailed) { this._archiveRep.DeleteArchive(targetSiteId, tarArchive.Id); } else if (shouldReSave) { tarArchive.Save(); } } if (isFailed) { totalFailed += 1; } else { totalSuccess += 1; } } return(errDict); }
internal string CreateSubscriptionId() => IdGenerator.FromGuid(prefix: SubscriptionPrefix);
/// <summary> /// Initializes a new instance of the <see cref="BarChartMessageAdapter"/>. /// </summary> /// <param name="transactionIdGenerator">Transaction id generator.</param> public BarChartMessageAdapter(IdGenerator transactionIdGenerator) : base(transactionIdGenerator) { }
/// <inheritdoc /> public override IMessageAdapter CreateTransportAdapter(IdGenerator transactionIdGenerator) => new FixMessageAdapter(transactionIdGenerator);
public Error Set(CmsArchiveEntity src) { this._value.ID = src.ID; this._value.StrId = src.StrId; this._value.SiteId = src.SiteId; this._value.Alias = src.Alias; this._value.CatId = src.CatId; this._value.Path = src.Path; this._value.Flag = src.Flag; this._value.AuthorId = src.AuthorId; this._value.Title = src.Title; this._value.SmallTitle = src.SmallTitle; this._value.Location = src.Location; this._value.Source = src.Source; this._value.Tags = src.Tags; this._value.Outline = src.Outline; this._value.Content = src.Content; this._value.ViewCount = src.ViewCount; this._value.Agree = src.Agree; this._value.Disagree = src.Disagree; this._value.UpdateTime = src.UpdateTime; this._value.CreateTime = src.CreateTime; this._value.Flags = src.Flags; this._value.Thumbnail = src.Thumbnail; int unix = TimeUtils.Unix(DateTime.Now); this._value.UpdateTime = unix; if (this.GetAggregaterootId() <= 0) { if (src.SiteId <= 0) { return(new Error("参数错误:SiteId")); } if (this._value.CatId < 0) { return(new Error("参数错误:CatId")); } this._value.SiteId = src.SiteId; this._value.CatId = src.CatId; this._value.CreateTime = unix; string strId; do { strId = IdGenerator.GetNext(5); //创建5位ID } while (this._archiveRep.CheckSidIsExist(this._value.SiteId, strId)); } ICategory ic = this.Category; if (ic == null) { return(new Error("栏目不存在")); } // 如果设置了别名,检测路径是缶匹配 if (!String.IsNullOrEmpty(src.Alias)) { bool isMatch = this._archiveRep.CheckPathMatch(this._value.SiteId, ic.Get().Path + "/" + src.Alias, this.GetAggregaterootId()); if (!isMatch) { return(new Error("文档路径已存在")); } } if (src.SortNumber > 0) { this._value.SortNumber = src.SortNumber; } return(null); }
public static int CacheApi(MethodDescriptor methodDescriptor) { methodDescriptor.ApiId = methodDescriptor.ApiId = IdGenerator.SequenceId(); return(dataService.CacheApi(methodDescriptor)); }