public void IICastOidToIITest() { II interactionID = new II(); OID validOid = new OID("1.2.3.4"); interactionID = validOid; Assert.AreEqual(validOid.ToString(), interactionID.Root); }
public string GetCoookieStr() { string result = ""; foreach (OrderPacket op in Packets) { result += OID.ToString() + "," + op.Count + "," + op.Product.Title.Substring(0, Math.Min(20, op.Product.Title.Length)) + "," + op.Product.ImgPathArr[0] + ","; } return(result); }
private CodeCell.AgileMap.Core.Feature ToFeature(Shape shape, double[] statAreas) { string[] fieldValues = new string[_fieldNames.Length]; fieldValues[0] = OID.ToString(); for (int i = 0; i < statAreas.Length; i++) { fieldValues[i + 1] = statAreas[i].ToString("0.###"); } CodeCell.AgileMap.Core.Feature fet = new CodeCell.AgileMap.Core.Feature(OID, shape, _fieldNames, fieldValues, null); OID++; return(fet); }
public void IICreatePublicTest() { II interactionID = new II(); OID inputOID = "1.2.3.4"; string inputExtension = "1"; interactionID = II.CreatePublic(inputOID, inputExtension); Assert.AreEqual(inputOID.ToString(), interactionID.Root); Assert.AreEqual("II.PUBLIC", interactionID.Flavor); Assert.AreEqual(true, interactionID.Displayable); Assert.AreEqual(IdentifierUse.Business, interactionID.Use); }
public void HandleGuildChat(Dictionary <string, object> props) { OID senderOid = (OID)props["senderOid"]; string senderName = (string)props["senderName"]; string message = (string)props["message"]; string[] args = new string[4]; args[0] = message; args[1] = senderName; args[2] = "5"; args[3] = senderOid.ToString(); AtavismEventSystem.DispatchEvent("CHAT_MSG_SAY", args); }
void _HandleMerchantList(Dictionary <string, object> props) { merchantItems.Clear(); NpcId = (OID)props["npcOid"]; int numItems = (int)props["numItems"]; for (int i = 0; i < numItems; i++) { MerchantItem merchantItem = new MerchantItem(); merchantItem.itemID = (int)props["item_" + i + "ID"]; merchantItem.count = (int)props["item_" + i + "Count"]; merchantItem.cost = (int)props["item_" + i + "Cost"]; merchantItem.purchaseCurrency = (int)props["item_" + i + "Currency"]; merchantItems.Add(merchantItem); } // dispatch a ui event to tell the rest of the system string[] args = new string[1]; args[0] = NpcId.ToString(); AtavismEventSystem.DispatchEvent("MERCHANT_UPDATE", args); }
public void HandleCombatEvent(Dictionary <string, object> props) { string eventType = (string)props["event"]; OID caster = (OID)props["caster"]; OID target = (OID)props["target"]; int abilityID = (int)props["abilityID"]; int effectID = (int)props["effectID"]; string value1 = "" + (int)props["value1"]; string value2 = "" + (int)props["value2"]; string value3 = (string)props["value3"]; string value4 = (string)props["value4"]; // Debug.LogWarning("Got Combat Event " + eventType); // Debug.LogError("HandleCombatEvent " + caster + " | " + target + " | " + abilityID + " | " + effectID + " | " + value1 + " | " + value2+" | "+ eventType); //Automatical select attacer try { if (target.ToLong() == ClientAPI.GetPlayerOid() && target != caster && (ClientAPI.GetTargetObject() == null || (ClientAPI.GetTargetObject() != null && ClientAPI.GetTargetObject().PropertyExists("health") && (int)ClientAPI.GetTargetObject().GetProperty("health") == 0))) { ClientAPI.SetTarget(caster.ToLong()); } } catch (System.Exception e) { Debug.LogError("Exception e=" + e); } // ClientAPI.Write("Got Combat Event: " + eventType); // int messageType = 2; if (eventType == "CombatPhysicalDamage") { // messageType = 1; } else if (eventType == "CombatMagicalDamage") { } else if (eventType == "CombatPhysicalCritical") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic"); // messageType = 1; } else if (eventType == "CombatMagicalCritical") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic"); // messageType = 1; } else if (eventType == "CombatMissed") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("MissedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Missed"); } #else value1 = "Missed"; #endif } else if (eventType == "CombatDodged") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Dodged"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("DodgedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Dodged"); } #else value1 = "Dodged"; #endif } else if (eventType == "CombatBlocked") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Blocked"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("BlockedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Blocked"); } #else value1 = "Blocked"; #endif } else if (eventType == "CombatParried") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Parried"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("ParriedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Parried"); } #else value1 = "Parried"; #endif } else if (eventType == "CombatEvaded") { ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded"); #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("EvadedSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Evaded"); } #else value1 = "Evaded"; #endif } else if (eventType == "CombatImmune") { #if AT_I2LOC_PRESET if (target.ToLong() == ClientAPI.GetPlayerOid()) { value1 = I2.Loc.LocalizationManager.GetTranslation("ImmuneSelf"); } else { value1 = I2.Loc.LocalizationManager.GetTranslation("Immune"); } #else value1 = "Immune"; #endif } else if (eventType == "CombatBuffGained" || eventType == "CombatDebuffGained") { AtavismEffect e = Abilities.Instance.GetEffect(effectID); if (e != null) { #if AT_I2LOC_PRESET value1 = I2.Loc.LocalizationManager.GetTranslation("Ability/" + e.name); #else value1 = e.name; #endif } else { value1 = ""; } } else if (eventType == "CombatBuffLost" || eventType == "CombatDebuffLost") { AtavismEffect e = Abilities.Instance.GetEffect(effectID); if (e != null) { #if AT_I2LOC_PRESET value1 = I2.Loc.LocalizationManager.GetTranslation("Effects/" + e.name); #else value1 = e.name; #endif } else { value1 = ""; } } else if (eventType == "CastingStarted") { if (int.Parse(value1) > 0) { string[] csArgs = new string[2]; csArgs[0] = value1; csArgs[1] = caster.ToString(); AtavismEventSystem.DispatchEvent("CASTING_STARTED", csArgs); } return; } else if (eventType == "CastingCancelled") { // Debug.LogError("CastingCancelled 1"); string[] ccArgs = new string[2]; ccArgs[0] = abilityID.ToString(); ccArgs[1] = caster.ToString(); AtavismEventSystem.DispatchEvent("CASTING_CANCELLED", ccArgs); // Debug.LogError("CastingCancelled 2"); return; } // dispatch a ui event to tell the rest of the system try { string[] args = new string[9]; args[0] = eventType; args[1] = caster.ToString(); args[2] = target.ToString(); args[3] = value1; args[4] = value2; args[5] = abilityID.ToString(); args[6] = effectID.ToString(); args[7] = value3; args[8] = value4; AtavismEventSystem.DispatchEvent("COMBAT_EVENT", args); } catch (System.Exception e) { Debug.LogError("COMBAT_EVENT Exception:" + e); } //ClientAPI.GetObjectNode(target.ToLong()).GameObject.GetComponent<MobController3D>().GotDamageMessage(messageType, value1); }
private IASSod(byte[] sod) { //Create asn1 structure of IAS sod object var asn1 = ASN1Tag.Parse(sod, true); //Take root element that represents all data signed var root = asn1.Child(0); root.Child(0, 06).Verify(OID.ToByteArray(OID.OIDsignedData)); //06 Verify that result is a OBJECT IDENTIFIER //Struttura che negli altri elementi verrà firmata SignedDataObject = root.DeepChild(1, 0, 2); SignedDataObject.Child(0, 06).Verify(OID.ToByteArray(OID.OIDldsSecurityObject)); //06 Verify that result is a OBJECT IDENTIFIER /*GET SIGNED DATA THAT CONTAINS HASHED INFORMATION OF: * - ID servizi * - Seriale carta * - Certificato utente * - Chiave pubblica di internal authentication * - Chiave pubblica di internal authentication per i servizi*/ SignedData = SignedDataObject.DeepChild(1, 0).Child(0, 0x30); //0x30 Verify that result is a SEQUENCE //GET DOCUMENT SIGNER CERTIFICATE //This object can be parsed to X509Certificate2 class costrusctor DSCertificate = root.DeepChild(1, 0, 3).Child(0, 0x30); //0x30 Verify that result is a SEQUENCE //GET SIGNER INFO var signerInfo = root.DeepChild(1, 0, 4).Child(0, 0x30); //0x30 Verify that result is a SEQUENCE /*GET INFORMATION OF ISSUER FROM SIGNER INFO * La struttura dati contenuta si avvicina alla seguente: * 0 SET (1 elem) * 0.0 SEQUENCE (2 elem) * 0.0.0 OBJECT IDENTIFIER (2.5.4.3 commonName (X.520 DN component)) * 0.0.1 PrintableString (Italian Country Signer CA - TEST) * 1 SET (1 elem) * 1.0 SEQUENCE (2 elem) * 1.0.0 OBJECT IDENTIFIER (2.5.4.11 organizationalUnitName (X.520 DN component)) * 1.0.1 PrintableString (National Electronic Center of State Police) * 2 SET (1 elem) * 2.0 SEQUENCE (2 elem) * 2.0.0 OBJECT IDENTIFIER (2.5.4.10 organizationName (X.520 DN component)) * 2.0.1 PrintableString (Ministry of Interior) * 3 SET (1 elem) * 3.0 SEQUENCE (2 elem) * 3.0.0 OBJECT IDENTIFIER (2.5.4.6 countryName (X.520 DN component)) * 3.0.1 PrintableString (IT)*/ IssuerName = signerInfo.DeepChild(1).Child(0, 0x30); //0x30 Verify that result is a SEQUENCE /*GET INFORMATION OF SIGNER CERTIFICATE SERIAL NUMBER FROM DS CERT * La struttura dati contenuta si avvicina alla seguente: * 0 INTEGER (value of serial number)*/ SerialNumber = signerInfo.DeepChild(1).Child(1, 0x02); //02 Verify that result is a INTEGER /*GET INFORMATION ABOUT SIGNER FROM DS CERT * La struttura dati contenuta si avvicina alla seguente: * 0 SEQUENCE (2 elem) * 0.0 OBJECT IDENTIFIER (1.2.840.113549.1.9.3 OIDcontentType) * 0.1 SET (1 elem) * 0.1.0 OBJECT IDENTIFIER (2.23.136.1.1.1 Security) * 1 SEQUENCE (2 elem) * 1.0 OBJECT IDENTIFIER (1.2.840.113549.1.9.4 OIDmessageDigest) * 1.1 SET (1 elem) * 1.1.0 OCTET STRING (F92C82AE7A944DCFFE4CCD0B6CAFA9D0134ED16EBEEFE6D9A44B641920F99BA9... (hash)) */ SignatureAlgoritmIdentifier = signerInfo.Child(3, 0xA0); //0xA0 Verify that result is a CONTEXT_SPECIFIC //Verify data structure of SignerInfo object SignatureAlgoritmIdentifier.DeepChild(0, 0).Verify(OID.ToByteArray(OID.OIDcontentType)); //Verify that node 0.0 is a OIDcontentType Object identifier SignatureAlgoritmIdentifier.DeepChild(0, 1, 0).Verify(OID.ToByteArray(OID.OIDldsSecurityObject)); //Verify that node 0.1.0 is a OIDldsSecurityObject Object identifier SignatureAlgoritmIdentifier.DeepChild(1, 0).Verify(OID.ToByteArray(OID.OIDmessageDigest)); //Verify that node 1.0 is a OIDmessageDigest Object identifier //Get message digest of Signer that is in the octect string object SignerMessageDigest = SignatureAlgoritmIdentifier.DeepChild(1, 1).Child(0, 04); //04 Verify that result is a OCTECT STRING //GET MESSAGE DIGEST SIGN ALGORYTM AND HASH ALGORYTM OIDDSMessageDigestSignAlgo = OID.ToString(signerInfo.DeepChild(4).Child(0, 06).Data); //06 Verify that result is a OBJECT IDENTIFIER OIDDSMessageDigestHashAlgo = OID.ToString(signerInfo.DeepChild(2).Child(0, 06).Data); //06 Verify that result is a OBJECT IDENTIFIER //Verify Signed data hash algoritm //SignedData.Child(0, 02).Verify(new byte[] { 0 }); SignedData.DeepChild(1).Child(0, 06).Verify(OID.Encode(OIDDSMessageDigestHashAlgo)); //Verify hash algoritm /*GET SIGNATURE * La struttura dati contenuta si avvicina alla seguente: * 0 OCTET STRING (42C600B32BD5EFF0A684F65BD4526872AD3D4EADA3017A6E836736340BCCDA7DB9622...)*/ Signature = signerInfo.Child(5, 04); //04 Verify that result is a OCTECT STRING }
/// <summary> /// The URL path of the resource being requested. /// </summary> /// <returns></returns> public override string UrlPath() { return(RequestHelpers.MakeUrl("/", new string[] { "metadata", "studies", ProjectName, "versions", OID.ToString() })); }
public override string ToString() { return(OID.ToString()); }
public override string ToString() { return(string.IsNullOrEmpty(Name) ? OID.ToString() : Name); }