internal SymbolBuild(string Name, SymbolType Type, bool UsesDFA, CreatorType CreatedBy) : base(Name, Type) { this.First = new LookaheadSymbolSet(); this.UsesDFA = UsesDFA; this.CreatedBy = CreatedBy; this.Reclassified = false; }
public async Task <IActionResult> CreateWallet([FromRoute] string blockchainType, [FromRoute] Guid clientId, [FromQuery] CreatorType createdBy) { if (!ValidateRequest(blockchainType, clientId, out var badRequest)) { return(badRequest); } if (blockchainType == SpecialBlockchainTypes.FirstGenerationBlockchain) { return(BadRequest ( BlockchainWalletsErrorResponse.Create($"{SpecialBlockchainTypes.FirstGenerationBlockchain} does not supported.") )); } var wallet = await _walletService.CreateWalletAsync(blockchainType, clientId, createdBy); return(Ok(new BlockchainWalletResponse { Address = wallet.Address, AddressExtension = wallet.AddressExtension, BaseAddress = wallet.BaseAddress, BlockchainType = wallet.BlockchainType, ClientId = wallet.ClientId, CreatedBy = wallet.CreatorType })); }
internal SymbolBuild(string Name, SymbolType Type) : base(Name, Type) { this.First = new LookaheadSymbolSet(); this.UsesDFA = this.ImpliedDFAUsage(Type) > SymbolType.Nonterminal; this.CreatedBy = CreatorType.Defined; this.Reclassified = false; }
internal SymbolBuild(string Name, SymbolType Type, int TableIndex) : base(Name, Type, (short)TableIndex) { this.First = new LookaheadSymbolSet(); this.UsesDFA = true; this.CreatedBy = CreatorType.Defined; this.Reclassified = false; }
internal SymbolBuild(string Name, SymbolType Type, RegExp Exp) : base(Name, Type) { this.First = new LookaheadSymbolSet(); this.RegularExp = Exp; this.UsesDFA = true; this.CreatedBy = CreatorType.Defined; this.Reclassified = false; }
public Creator GetCreator(CreatorType type) { if (cached == false) { Init(); } return(Cache[type]); }
public async Task <WalletWithAddressExtensionDto> CreateWalletAsync(string blockchainType, Guid clientId, CreatorType createdBy) { string address; if (blockchainType == SpecialBlockchainTypes.FirstGenerationBlockchain) { return(null); } var isAddressMappingRequired = _blockchainExtensionsService.IsAddressMappingRequired(blockchainType); var wallet = await _blockchainSignFacadeClient.CreateWalletAsync(blockchainType); address = wallet.PublicAddress; var underlyingAddress = await _addressService.GetUnderlyingAddressAsync(blockchainType, address); if (isAddressMappingRequired.HasValue && isAddressMappingRequired.Value && underlyingAddress == null) { throw new ArgumentException( $"Failed to get UnderlyingAddress for blockchainType={blockchainType} and address={address}"); } await _walletRepository.AddAsync(blockchainType, clientId, address, createdBy); var @event = new WalletCreatedEvent { Address = address, BlockchainType = blockchainType, IntegrationLayerId = blockchainType, CreatedBy = createdBy, ClientId = clientId }; _cqrsEngine.PublishEvent ( @event, BlockchainWalletsBoundedContext.Name ); return(ConvertWalletToWalletWithAddressExtension ( new WalletDto { Address = isAddressMappingRequired.HasValue && isAddressMappingRequired.Value ? underlyingAddress : address, BlockchainType = blockchainType, ClientId = clientId, CreatorType = createdBy } )); }
//clientLatestDepositIndexManualPartitionKey let it be null for common operations public async Task AddAsync(string blockchainType, Guid clientId, string address, CreatorType createdBy, string clientLatestDepositIndexManualPartitionKey = null, bool addAsLatest = true) { var partitionKey = BlockchainWalletEntity.GetPartitionKey(blockchainType, clientId); var rowKey = BlockchainWalletEntity.GetRowKey(address); var clientLatestDepositIndexPartitionKey = GetClientLatestIndexPartitionKey(clientId); var clientLatestDepositIndexRowKey = GetClientLatestIndexRowKey(blockchainType); var(indexPartitionKey, indexRowKey) = GetAddressIndexKeys(blockchainType, address); var(clientBtIndexPartitionKey, clientBtIndexRowKey) = GetClientBlockchainTypeIndexKeys(blockchainType, clientId); clientBtIndexRowKey = clientLatestDepositIndexManualPartitionKey ?? clientBtIndexRowKey; await _addressIndexTable.InsertOrReplaceAsync(new AzureIndex( indexPartitionKey, indexRowKey, partitionKey, rowKey )); await _clientBlockchainTypeIndexTable.InsertOrReplaceAsync(new AzureIndex( clientBtIndexPartitionKey, clientBtIndexRowKey, partitionKey, rowKey )); if (addAsLatest) { await _clientLatestDepositsIndexTable.InsertOrReplaceAsync(new AzureIndex( clientLatestDepositIndexPartitionKey, clientLatestDepositIndexRowKey, partitionKey, rowKey )); } // Wallet entity await _walletsTable.InsertOrReplaceAsync(new BlockchainWalletEntity { PartitionKey = partitionKey, RowKey = rowKey, Address = address, ClientId = clientId, IntegrationLayerId = blockchainType, CreatedBy = createdBy }); }
public static IObjectCreator Create <T>(CreatorType creatorType) where T : class, new() { switch (creatorType) { case CreatorType.Dynamic: return(new DynamicObjectCreator()); case CreatorType.StronglyTyped: return(new ObjectCreator <T>()); } throw new Exception("No implementation for " + creatorType); }
public ListDocumentInfo(Type implementingType) { if (implementingType.IsGenericType) { _listValueType = implementingType.GetGenericArguments()[0]; _documentFieldInfo = new DocumentFieldInfo(_listValueType); _listAdapterFactoryType = ListAdapterFactoryType.Generic; _creatorType = _type.IsInterface || _type.IsArray ? CreatorType.SpecifiedTypeList : CreatorType.SpecifiedType; } else { _listValueType = typeof(object); _documentFieldInfo = new DocumentFieldInfo(_listValueType); _listAdapterFactoryType = ListAdapterFactoryType.NonGeneric; _creatorType = _type.IsInterface || _type.IsArray ? CreatorType.ObjectList : CreatorType.SpecifiedType; } }
/// <summary> /// Add a new content to the list /// </summary> /// <param name="name"></param> /// <param name="creator"></param> /// <param name="disposition"></param> /// <param name="senders"></param> /// <returns></returns> public JingleContent AddContent(String name, CreatorType creator, MailContentDisposition disposition, SendersType senders) { Debug.Assert(!String.IsNullOrEmpty(name)); JingleContent jcnt = CreateChildElement <JingleContent>(); jcnt.ContentName = name; // Set default values jcnt.Creator = creator == CreatorType.UNSPECIFIED ? CreatorType.initiator : creator; jcnt.Disposition = disposition == MailContentDisposition.UNSPECIFIED ? MailContentDisposition.session : disposition; jcnt.Senders = senders == SendersType.UNSPECIFIED ? SendersType.both : senders; return(jcnt); }
public DictionaryDocumentInfo() { if (_type.TryGetImplementingGenericType(out var dictionaryType, typeof(IDictionary <,>)) || _type.TryGetImplementingGenericType(out dictionaryType, typeof(IReadOnlyDictionary <,>))) { var arguments = dictionaryType.GetGenericArguments(); _dictionaryKeyType = arguments[0]; _dictionaryValueType = arguments[1]; _documentFieldInfo = new DocumentFieldInfo(_dictionaryValueType); if (_type == dictionaryType) { _creatorType = CreatorType.SpecifiedTypeDictionary; _dictionaryAdapterFactoryType = DictionaryAdapterFactoryType.NonGeneric; } else { _creatorType = CreatorType.SpecifiedType; _dictionaryAdapterFactoryType = DictionaryAdapterFactoryType.Generic; } }
public DictionaryDocumentInfo(Type implementingType) { if (implementingType.IsGenericType) { var arguments = implementingType.GetGenericArguments(); _dictionaryKeyType = arguments[0]; _dictionaryValueType = arguments[1]; _documentFieldInfo = new DocumentFieldInfo(_dictionaryValueType); _dictionaryAdapterFactoryType = DictionaryAdapterFactoryType.Generic; _creatorType = _type.IsInterface ? CreatorType.SpecifiedTypeDictionary : CreatorType.SpecifiedType; } else { _dictionaryKeyType = typeof(string); _dictionaryValueType = typeof(object); _documentFieldInfo = new DocumentFieldInfo(_dictionaryValueType); _dictionaryAdapterFactoryType = DictionaryAdapterFactoryType.NonGeneric; _creatorType = _type.IsInterface ? CreatorType.ObjectDictionary : CreatorType.SpecifiedType; } }
public ListDocumentInfo() { if (_type.TryGetImplementingGenericType(out var listType, typeof(IList <>)) || _type.TryGetImplementingGenericType(out listType, typeof(IReadOnlyList <>))) { _listValueType = listType.GetGenericArguments()[0]; _documentFieldInfo = new DocumentFieldInfo(_listValueType); if (_type == listType) { _creatorType = CreatorType.SpecifiedTypeList; _listAdapterFactoryType = ListAdapterFactoryType.NonGeneric; } else if (_type.IsArray) { _creatorType = CreatorType.SpecifiedTypeList; _listAdapterFactoryType = ListAdapterFactoryType.Generic; } else { _creatorType = CreatorType.SpecifiedType; _listAdapterFactoryType = ListAdapterFactoryType.Generic; } }
public async Task <BlockchainWalletResponse> CreateWalletAsync(string blockchainType, Guid clientId, CreatorType createdBy) { if (clientId == Guid.Empty) { throw new ArgumentException(nameof(clientId)); } var response = await _apiRunner.RunWithRetriesAsync(() => _api.CreateWalletAsync(blockchainType, clientId, createdBy)); return(response); }
public Creator(CreatorType type, string firstName, string lastName) { this.Type = type; this.FirstName = firstName; this.LastName = lastName; }
private void button2_Click(object sender, EventArgs e) { DDIClassLibraryWrapper wrapper = new DDIClassLibraryWrapper(); wrapper.AgencyID = "se.snd"; wrapper.CreateURNs = false; wrapper.SetDefaultValues = false; DDIInstanceType instance = wrapper.DDIInstance; StudyUnitType s = new StudyUnitType(); instance.StudyUnit.Add(s); //Citation { s.Citation = new CitationType(); s.Citation.Title = new InternationalStringType(); s.Citation.Title.String.Add(new StringType() { lang = "en", Content = "Test title" }); s.Citation.Title.String.Add(new StringType() { lang = "sv", Content = "Title" }); CreatorType creator = new CreatorType(); creator.CreatorName = new BibliographicNameType(); creator.CreatorName.String.Add(new StringType("Johan Fihn")); s.Citation.Creator.Add(creator); } //Abstract { s.Abstract = new StructuredStringType(); s.Abstract.Content.Add(new ContentType("Beskrivning", "sv")); s.Abstract.Content.Add(new ContentType("Abstract", "en")); } //SeriesStatement { SeriesStatementType series = new SeriesStatementType(); series.SeriesName.Add(new NameType("Min serie", "sv")); series.SeriesName.Add(new NameType("My series", "en")); s.SeriesStatement.Add(series); } //KindOfData { s.KindOfData.Add(new KindOfDataType() { type = KindOfDataTypeType.Quantitative, Content = "My kind of data" }); } //LogicalProduct LogicalProductType lp = new LogicalProductType(); s.BaseLogicalProduct.Add(lp); VariableSchemeType vs = new VariableSchemeType(); lp.VariableScheme.Add(vs); //DataCollection { DataCollectionType dc = new DataCollectionType(); s.DataCollection.Add(dc); QuestionSchemeType qs = new QuestionSchemeType(); dc.QuestionScheme.Add(qs); for (int i = 1; i <= 10; i++) { QuestionItemType qi = new QuestionItemType(); qs.QuestionItem.Add(qi); DynamicTextType text = new DynamicTextType(); text.TextContent.Add(new LiteralTextType() { Text = new TextType() { Content = "Fråga #" + i, lang = "sv" } }); qi.QuestionText.Add(text); text = new DynamicTextType(); text.TextContent.Add(new LiteralTextType() { Text = new TextType() { Content = "Question #" + i, lang = "en" } }); qi.QuestionText.Add(text); VariableType var = new VariableType(); var.VariableName.Add(new NameType("Variabel #" + i, "sv")); var.VariableName.Add(new NameType("Variable #" + i, "en")); vs.Variable.Add(var); } } using (TextWriter writer = File.CreateText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\ClassLibraryTest.xml")) { wrapper.Serialize(writer); } }