public UserIdentitiesUpdater(ulong accountId, IUtxoClientCryptoService clientCryptoService, IAssetsService assetsService, IDataAccessService externalDataAccessService, IHubContext <IdentitiesHub> idenitiesHubContext, IRelationsProofsValidationService relationsProofsValidationService, ITrackingService trackingService) { _accountId = accountId; _clientCryptoService = clientCryptoService; _assetsService = assetsService; _dataAccessService = externalDataAccessService; _idenitiesHubContext = idenitiesHubContext; _relationsProofsValidationService = relationsProofsValidationService; _trackingService = trackingService; PipeIn = new ActionBlock <PacketBase>(p => { try { if (p is TransferAssetToUtxo packet) { _clientCryptoService.DecodeEcdhTuple(packet.TransferredAsset.EcdhTuple, packet.TransactionPublicKey, out byte[] blindingFactor, out byte[] assetId); AttributeType attributeType = _assetsService.GetAttributeType(assetId); _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushAttribute", new UserAttributeDto { AttributeType = attributeType.ToString(), Source = packet.Signer.ArraySegment.Array.ToHexString(), AssetId = assetId.ToHexString(), OriginalBlindingFactor = blindingFactor.ToHexString(), OriginalCommitment = packet.TransferredAsset.AssetCommitment.ToHexString(), LastBlindingFactor = blindingFactor.ToHexString(), LastCommitment = packet.TransferredAsset.AssetCommitment.ToHexString(), LastTransactionKey = packet.TransactionPublicKey.ToHexString(), LastDestinationKey = packet.DestinationKey.ToHexString(), Validated = false, IsOverriden = false }); } else if (p is GroupsRelationsProofs relationsProofs && _clientCryptoService.CheckTarget(relationsProofs.DestinationKey2, relationsProofs.TransactionPublicKey)) { RelationProofsValidationResults validationResults = _relationsProofsValidationService.VerifyRelationProofs(relationsProofs, _clientCryptoService); _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushRelationValidation", validationResults); } } catch { } }); }
private static ResourceObject CreateAttributeTypeIfDoesntExist(string typeName, string regex, bool multivalued, AttributeType type) { ResourceObject testAttribute = client.GetResourceByKey(ObjectTypeNames.AttributeTypeDescription, AttributeNames.Name, typeName); if (testAttribute != null) { return(testAttribute); } testAttribute = client.CreateResource(ObjectTypeNames.AttributeTypeDescription); testAttribute.Attributes[AttributeNames.Name].SetValue(typeName); testAttribute.Attributes[AttributeNames.DisplayName].SetValue(typeName); if (regex != null) { testAttribute.Attributes[AttributeNames.StringRegex].SetValue(regex); } testAttribute.Attributes[AttributeNames.Multivalued].SetValue(multivalued); testAttribute.Attributes[AttributeNames.DataType].SetValue(type.ToString()); client.SaveResource(testAttribute); return(testAttribute); }
//Creating for player status elements void CreateAttributeUIElement(List <AttributeSlot> list, Transform parent, AttributeType type, string txt1Text = null) { AttributeSlot attackDefense = new AttributeSlot(); attackDefense.type = type; list.Add(attackDefense); GameObject go = Instantiate(playerStatus.playerStatus_Slot_Template) as GameObject; go.transform.SetParent(parent); go.transform.localScale = Vector3.one; attackDefense.slot = go.GetComponent <InventoryUISlot>(); if (string.IsNullOrEmpty(txt1Text)) { attackDefense.slot.text1.text = type.ToString().Replace('_', ' '); } else { attackDefense.slot.text1.text = txt1Text; } attackDefense.slot.text2.text = "30"; go.SetActive(true); }
public override string ToString() { return(string.Concat( nameof(Location) + "=", Location.ToString(), ", " + nameof(Name) + "=\"", Name, "\"", ", " + nameof(Size) + "=", Size.ToString(), ", " + nameof(AttribType) + "=", AttribType.ToString() )); }
public override string Result(string dataType, string propertyName) { if (AddAttritbute) { FactoryString.Append("\n\t\t" + AttributeFactory.AddAttribute(AttributeType.ToString(), AttributeValue)); } FactoryString.Append($"\n\t\t{AccessModifier.GetDescription()} {dataType} {propertyName} {{ get; set; }}"); return(FactoryString.ToString()); }
private string GetAttributeTypeString(AttributeType attributeType) { string attributeName = attributeType.ToString(); if (attributeType == AttributeType.Position && this is KeywordFragmentInput) { attributeName = "SV_Position"; } return(attributeName); }
private void ProcessTransferAsset(TransferAsset transferAsset) { _clientCryptoService.DecodeEcdhTuple(transferAsset.TransferredAsset.EcdhTuple, null, out byte[] blindingFactor, out byte[] assetId); AttributeType attributeType = _assetsService.GetAttributeType(assetId); _dataAccessService.StoreSpAttribute(_accountId, attributeType, assetId, transferAsset.Signer.Value.ToHexString(), blindingFactor, transferAsset.TransferredAsset.AssetCommitment, transferAsset.SurjectionProof.AssetCommitments[0]); _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushAttribute", new SpAttributeDto { AttributeType = attributeType.ToString(), Source = transferAsset.Signer.ArraySegment.Array.ToHexString(), AssetId = assetId.ToHexString(), OriginalBlindingFactor = blindingFactor.ToHexString(), OriginalCommitment = transferAsset.TransferredAsset.AssetCommitment.ToHexString(), IssuingCommitment = transferAsset.SurjectionProof.AssetCommitments[0].ToHexString(), Validated = false, IsOverriden = false }); }
private void Start() { titleText.text = bonusName; StringBuilder sb = new StringBuilder(); sb.Append("+"); sb.Append(bonusValue); sb.Append(" "); sb.Append(attributeType.ToString()); bodyText.text = sb.ToString(); }
public override string Result(string dataType, string name) { if (AddAttritbute) { FactoryString.Append("\n" + AttributeFactory.AddAttribute(AttributeType.ToString(), AttributeValue)); } FactoryString.Append($"\n\t{AccessModifier.GetDescription()} class {name}"); FactoryString.Append("\n\t{"); FactoryString.Append($"{Properties}"); FactoryString.Append("\n\t}"); return(FactoryString.ToString()); }
public void AddSkillData(JsonData data, AttributeType fieldName) { string field = fieldName.ToString(); if (data.ContainsKey(field)) { Skills.Add(fieldName, Convert.ToSingle(data[field].ToString())); } else { Skills.Add(fieldName, 0); } }
public override string ToString() { if (IsPadding) { return(string.Concat("Padding=", SizeInBytes.ToString(), " bytes")); } return(string.Concat( Normalized ? "Normalized " : "Unnormalized ", AttribType.ToString(), ", " + nameof(AttribBaseType) + "=", AttribBaseType.ToString(), ", " + nameof(AttribIndicesUseCount) + "=", AttribIndicesUseCount.ToString(), ", " + nameof(AttribDivisor) + "=", AttribDivisor.ToString() )); }
public BaseAttribute GetAttribute(AttributeType stat) { if (singleAttributes.ContainsKey(stat)) { return(singleAttributes[stat]); } else if (pairedAttributes.ContainsKey(stat)) { return(pairedAttributes[stat]); } else { Debug.Log("Attribute not found: " + stat.ToString()); return(null); } }
public ResponseDataModel OnGivingPrimaryAttribute(User u, AttributeType attributeType) { _machine.Fire(Trigger.GivePrimaryAttribute); _storyRepository.SetPrimaryAttribute(u, attributeType); var storymsg = $"A kiválasztott attribútumod, {attributeType.ToString()}"; return(new ResponseDataModel { text = storymsg, quick_replies = new List <QuickReply> { new QuickReply { content_type = "text", title = "backtomenu", payload = "RED" }, } }); }
public static string ConvertAttTypeToString(AttributeType attType) { string newAttType = attType.ToString(); switch (newAttType) { case "Integer16": newAttType = "Integer 16"; break; case "Integer32": newAttType = "Integer 32"; break; case "Integer64": newAttType = "Integer 64"; break; } return(newAttType); }
public void WriteAttributeDefinition(ShaderGenerationContext context, int attributeIndex, bool isFragmentShader) { context.WriteLine($"{DataTypeAndDimensionsString} {Name} : "); if (AttributeType == AttributeType.Anonymous) { context.Write($"COLOR1{attributeIndex}"); } else { if (isFragmentShader && AttributeType == AttributeType.Position) { context.Write("SV_POSITION"); } else { context.Write(AttributeType.ToString().ToUpper()); } } context.Write(";"); }
///<summary> /// 获得指定类型的升星加成值 /// </summary> private int getNeedTypeValue(AttributeType type) { int result = 0; equipSample = EquipmentSampleManager.Instance.getEquipSampleBySid(this.sid); if (equipSample.equipStarSid != 0) { starSample = EquipStarAttrSampleManager.Instance.getEquipStarAttrSampleBySid(equipSample.equipStarSid); } if (starSample == null || this.equpStarState == 0) { return(0); } starEffects = starSample.getAttrChangeSample(this.equpStarState); for (int i = 0; i < starEffects.Length; i++) { if (starEffects[i].getAttrType() == type.ToString()) { result += starEffects[i].getAttrValue(0); } } return(result); }
void CreateAttributeElement(List <AttributeSlot> l, Transform p, AttributeType t, string txt1Text = null) { AttributeSlot a = new AttributeSlot(); a.type = t; l.Add(a); GameObject g = Instantiate(playerStatus.slotTemplate) as GameObject; g.transform.SetParent(p); a.slot = g.GetComponent <InventoryUISlot>(); if (string.IsNullOrEmpty(txt1Text)) { a.slot.text1.text = t.ToString(); } else { a.slot.text1.text = txt1Text; } a.slot.text2.text = "30"; g.SetActive(true); g.transform.localScale = Vector3.one; }
private string GetName(AttributeType type) { return(String.Concat(Prefix, type.ToString())); }
public void addBuff(AttributeType type, int modifiedvalue, int counter) { buffs.Add(new Vector3((int)type, modifiedvalue, counter)); isDirty = true; switch ((int)type) { case (int)AttributeType.Attack: case (int)AttributeType.MagicAttack: case (int)AttributeType.Defense: case (int)AttributeType.MagicDefense: case (int)AttributeType.Dexertiry: case (int)AttributeType.AttackRange: if (this.pawnType == PawnType.Monster) { uilog.UpdateLog("<color=" + TextColor.BlueColor + ">" + this.Name + "</color>'s " + type.ToString() + (modifiedvalue > 0?" increased ":" decreadsed ") + modifiedvalue + " points in " + counter + "turn"); } else if (this.pawnType == PawnType.Enemy) { uilog.UpdateLog("<color=" + TextColor.GreyColor + ">" + this.Name + "'s " + type.ToString() + (modifiedvalue > 0?" increased ":" decreadsed ") + modifiedvalue + " points in " + counter + "turn</color>"); } break; case (int)AttributeType.Mobility: if (this.pawnType == PawnType.Monster) { uilog.UpdateLog("<color=" + TextColor.BlueColor + ">" + this.Name + "</color> can't move for " + counter + " turn"); } else if (this.pawnType == PawnType.Enemy) { uilog.UpdateLog("<color=" + TextColor.GreyColor + ">" + this.Name + " can't move for " + counter + " turn</color>"); } break; default: break; } }
public AttributeRemoveException(String myAttributeName, AttributeType myAttributeType, String myInfo = "") { _msg = String.Format("The attribute {0} of type {1} cannot be removed. {2}", myAttributeName, myAttributeType.ToString(), myInfo); }
private string GetAffectDurationName(AttributeType type) { return(String.Concat(AffectDurationPrefix, type.ToString())); }
public object Coerce(object value) { switch (AttributeType) { case AttributeType.Boolean: return(DB.Bit(value)); case AttributeType.Numeric: return(DB.Real(value)); case AttributeType.Date: return(DB.DateTime(value)); case AttributeType.Duration: if (value == null || value is Duration) { return(value); } if (value is int) { return(new Duration((int)value, Duration.Unit.Days)); } if (value is TimeSpan) { return(new Duration((TimeSpan)value)); } return(Duration.Parse((string)value)); case AttributeType.Text: case AttributeType.LongText: case AttributeType.LocalizerTag: case AttributeType.Password: return(DB.Str(value)); case AttributeType.Relation: var oid = CoerceOid(value); if (RelatedAsset != null && !oid.IsNull && !(oid.AssetType).Is(RelatedAsset)) { throw new OidException("Wrong OID AssetType", oid.Token); } return(oid); case AttributeType.AssetType: return(CoerceAssetType(value)); case AttributeType.Opaque: return(value); case AttributeType.State: return(CoerceState(value)); case AttributeType.Rank: return(new Rank(value)); case AttributeType.LongInt: return(DB.BigInt(value)); case AttributeType.Blob: return(value); default: throw new MetaException("Unsupported AttributeType ", AttributeType.ToString()); } }
private object ParseAttributeSimpleValue(AttributeType attrType) { switch(attrType.Kind) { case AttributeKind.ByteAttr: return ParseByteValue(); case AttributeKind.ShortAttr: return ParseShortValue(); case AttributeKind.IntegerAttr: return ParseIntValue(); case AttributeKind.LongAttr: return ParseLongValue(); case AttributeKind.BooleanAttr: return ParseBooleanValue(); case AttributeKind.StringAttr: return ParseStringValue(); case AttributeKind.EnumAttr: return ParseEnumValue(attrType.EnumType); case AttributeKind.FloatAttr: return ParseFloatValue(); case AttributeKind.DoubleAttr: return ParseDoubleValue(); case AttributeKind.ObjectAttr: return ParseObjectValue(attrType); case AttributeKind.GraphAttr: return ParseGraphValue(); case AttributeKind.NodeAttr: return ParseNodeValue(attrType.PackagePrefixedTypeName); case AttributeKind.EdgeAttr: return ParseEdgeValue(attrType.PackagePrefixedTypeName); case AttributeKind.MapAttr: case AttributeKind.SetAttr: case AttributeKind.ArrayAttr: case AttributeKind.DequeAttr: throw new Exception("Internal error, non-simple value in simple value parsing"); default: throw new Exception("Unsupported attribute type " + attrType.ToString()); } }
private string GetAffectAppliedName(AttributeType type) { return(String.Concat(AffectAppliedPrefix, type.ToString())); }
///--------------------------------------------------------------------------- /// <summary>Parses values for enum</summary> ///--------------------------------------------------------------------------- static public string ParseType(AttributeType value) { return ParseType(value.GetType().ToString(), value.ToString()); }
public OffnetAttrInstanceWeb(string name, string value, string display, AttributeType type) { Name = name; Type = (type == null) ? "Unknown" : type.ToString(); Value = new AttributeChoiceWeb(value, display); }
/// <summary> /// Initializes a new instance of the UnsupportedDataTypeException class /// </summary> /// <param name="expected">The data type that was expected</param> /// <param name="actual">The data type that was provided</param> public UnsupportedDataTypeException(AttributeType expected, Type actual) : base(string.Format("Type {0} is not compatible with attribute data type {1}", actual.Name, expected.ToString())) { }
public override string ToString() { return("Counter: " + counter + "\nAttibuteType: " + attributeType.ToString() + "\nValue: " + value); }
public static String GetElementAttribute(this IWebElement webElement, AttributeType attribute) { return(webElement.GetAttribute(attribute.ToString())); }
public override string ToString() { return("Player: " + PlayerId + ", AttributeType: " + AttributeType.ToString() + ", Value: " + Encoding.UTF8.GetString(Value.Reverse().ToArray())); }
protected void ParseValidateHeader(byte[] bytes, ref int startIndex) { if (ParseHeader(bytes, ref startIndex) != ValueLength) { throw new TurnMessageException(ErrorCode.BadRequest, @"Invalid attribute length - " + AttributeType.ToString()); } }
internal static string ToKey(this AttributeType type) { return(type.ToString().ToLowerInvariant()); }