protected virtual System.IdentityModel.Tokens.SecurityKeyIdentifier GetSigningKeyIdentifier(System.Collections.Generic.IDictionary <string, string> header, System.Collections.Generic.IDictionary <string, string> payload)
        {
            string x;

            if (!header.TryGetValue("alg", out x))
            {
                throw new System.IdentityModel.Tokens.SecurityTokenException("Invalid JWT token. No signature algorithm specified in token header.");
            }
            System.IdentityModel.Tokens.SecurityKeyIdentifierClause securityKeyIdentifierClause;
            if (System.StringComparer.Ordinal.Equals(x, "RS256"))
            {
                string arg;
                if (!header.TryGetValue("x5t", out arg))
                {
                    throw new System.IdentityModel.Tokens.SecurityTokenException("Invalid JWT token. No certificate thumbprint specified in token header.");
                }
                securityKeyIdentifierClause = new System.IdentityModel.Tokens.X509ThumbprintKeyIdentifierClause(Base64UrlEncoder.DecodeBytes(arg));
            }
            else
            {
                if (!System.StringComparer.Ordinal.Equals(x, "HS256"))
                {
                    throw new System.IdentityModel.Tokens.SecurityTokenException("Invalid JWT token. Didn't find a supported signature algorithm in token header.");
                }
                string issuer;
                payload.TryGetValue("iss", out issuer);
                securityKeyIdentifierClause = new SymmetricIssuerKeyIdentifierClause(issuer);
            }
            return(new System.IdentityModel.Tokens.SecurityKeyIdentifier(new System.IdentityModel.Tokens.SecurityKeyIdentifierClause[]
            {
                securityKeyIdentifierClause
            }));
        }
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("roomGrain", out value))
            {
                roomGrain = (IRoomGrain)value;
            }
            if (values.TryGetValue("playerGuid", out value))
            {
                playerGuid = (Guid)value;
            }
            if (values.TryGetValue("playerGrain", out value))
            {
                playerGrain = (IPlayerGrain)value;
            }
            if (values.TryGetValue("npcInfo", out value))
            {
                npcInfo = (NPCInfo)value;
            }
        }
Beispiel #3
0
        private IEnumerator processStack()
        {
            AudioClip clip;

            foreach (System.Collections.Generic.KeyValuePair <int, string> kvp in stack)
            {
                if (kvp.Value.StartsWith("#"))
                {
                    clipDict.TryGetValue(kvp.Value, out clip);

                    if (clipDict.TryGetValue(kvp.Value, out clip))
                    {
                        audioSource.clip = clip;
                        audioSource.Play();

                        do
                        {
                            yield return(null);
                        } while (audioSource.isPlaying);
                    }
                    else
                    {
                        Debug.LogWarning("Clip not found: " + kvp.Value);
                    }
                }
                else
                {
                    next = false;

                    /*
                     * if (Util.Helper.isEditorMode)
                     * {
                     #if UNITY_EDITOR
                     *  Speaker.SpeakNativeInEditor(kvp.Value, Voices.Voice, Rate, Pitch, Volume);
                     #endif
                     * }
                     * else
                     * {
                     */
                    if (Mode == Model.Enum.SpeakMode.Speak)
                    {
                        uid = Speaker.Speak(kvp.Value, audioSource, Voices.Voice, true, Rate, Pitch, Volume);
                    }
                    else
                    {
                        uid = Speaker.SpeakNative(kvp.Value, Voices.Voice, Rate, Pitch, Volume);
                    }
                    //}

                    do
                    {
                        yield return(null);
                    } while (!next);


                    yield return(null);
                }
            }
        }
 public virtual NonNativeObjectInfo GetReadingObjectInfoFromOid(NeoDatis.Odb.OID oid)
 {
     if (oid == null)
     {
         throw new ODBRuntimeException(NeoDatisError.CacheNullOid);
     }
     object[] values = null;
     readingObjectInfo.TryGetValue(oid, out values);
     if (values == null)
     {
         return(null);
     }
     return((NonNativeObjectInfo)values[1]);
 }
        private IEnumerator processStack()
        {
            onStart();

            AudioClip clip;

            foreach (System.Collections.Generic.KeyValuePair <int, string> kvp in stack)
            {
                if (kvp.Value.StartsWith("#"))
                {
                    clipDict.TryGetValue(kvp.Value, out clip);

                    if (clipDict.TryGetValue(kvp.Value, out clip))
                    {
                        audioSource.clip = clip;
                        audioSource.Play();

                        do
                        {
                            yield return(null);
                        } while (audioSource.isPlaying);
                    }
                    else
                    {
                        Debug.LogWarning("Clip not found: " + kvp.Value);
                    }
                }
                else
                {
                    next = false;

                    if (Mode == Model.Enum.SpeakMode.Speak)
                    {
                        uid = Speaker.Speak(kvp.Value, audioSource, Voices.Voice, true, Rate, Pitch, Volume);
                    }
                    else
                    {
                        uid = Speaker.SpeakNative(kvp.Value, Voices.Voice, Rate, Pitch, Volume);
                    }

                    do
                    {
                        yield return(null);
                    } while (!next);
                }
            }

            onComplete();
        }
Beispiel #6
0
 /// <summary> Adds val to the Set associated with key in the Map.  If key is not
 /// already in the map, a new Set will first be created.
 /// </summary>
 /// <returns> the size of the Set associated with key once val is added to it.
 /// </returns>
 public virtual int Put(T key, V val)
 {
     // TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
     System.Collections.Generic.Dictionary <V, V> theSet;
     if (!theMap.TryGetValue(key, out theSet))
     {
         theSet      = new System.Collections.Generic.Dictionary <V, V>(23);
         theMap[key] = theSet;
     }
     if (!theSet.ContainsKey(val))
     {
         theSet.Add(val, val);
     }
     return(theSet.Count);
 }
Beispiel #7
0
        public virtual ObjectInfoHeader GetObjectInfoHeaderFromObject(object o, bool throwExceptionIfNotFound)
        {
            NeoDatis.Odb.OID oid = null;
            objects.TryGetValue(o, out oid);

            ObjectInfoHeader oih = null;

            objectInfoPointersCacheFromOid.TryGetValue(oid, out oih);
            if (oih == null && throwExceptionIfNotFound)
            {
                throw new ODBRuntimeException(NeoDatisError.ObjectDoesNotExistInCache.AddParameter(o.ToString()));
            }
            nbCallsToGetObjectInfoHeaderFromObject++;
            return(oih);
        }
Beispiel #8
0
        public static UpdateRecord ToUpdateRecord(this IXLRow row, string header, System.Collections.Generic.IDictionary <string, string> comments)
        {
            var name            = row.GetValue <string>("A");
            var health          = row.GetValue <string>("C");
            var teams           = row.GetValue <string>("D");
            var pm              = row.GetValue <string>("E");
            var leadEng         = row.GetValue <string>("F");
            var exitOriginalStr = row.GetValue <string>("I");
            var exitCurrentStr  = row.GetValue <string>("J");
            var id              = row.GetValue <string>("L");

            if (name == "Name" && health == "Health" && teams == "Teams")
            {
                return(null);
            }
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            comments.TryGetValue(id, out string comment);

            return(new UpdateRecord
            {
                Id = id,
                Name = name,
                Health = health,
                Comment = comment,
                Header = header,
                ProductManager = pm,
                LeadEng = leadEng,
                ExitDateCurrent = exitCurrentStr.TryToDateTime(),
                ExitDateOriginal = exitOriginalStr.TryToDateTime(),
            });
        }
        public override void Configure(System.Collections.Generic.IDictionary <string, string> settings)
        {
            base.Configure(settings);

            /*
             * Ya se configuró usando el connStringName de default así que si no hay configuración por pais, o no estamos en WEB,
             * o no se usa mas conectionstringname usa esa conection string NH funciona igual.
             */
            if (settings.TryGetValue(Environment.ConnectionStringName, out defaultConnectionStringName))
            {
                /*
                 * Usa el connStringName como PREFIX de los connectionStringName por pais.
                 * De esta manera el conectionStringName configurado para NH puede tener (o no) un valor de default valido y funciona como si fuese un Environment.
                 * Por ejemplo el conectionStringName configurado para NH es "Production".
                 * La configuración levanta todas las connection string que empiezan con "Production" (case insensitive)
                 */
                foreach (ConnectionStringSettings css in ConfigurationManager.ConnectionStrings)
                {
                    if (css.Name.StartsWith(defaultConnectionStringName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        contextCs.Add(css);
                    }
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// Adds a new collection, it's assumed to be sorted.
        /// </summary>
        private uint AddCollection(int[] collection)
        {
            uint id;

            if (_collectionReverseIndex != null)
            {
                // check duplicates.
                if (_collectionReverseIndex.TryGetValue(collection, out id))
                { // collection already exists.
                    return(id + 2);
                }
            }

            id = (uint)_collectionIndex.Add(collection);
            if (_index != null)
            { // use next id.
                _index.EnsureMinimumSize(_nextId + 1);
                _index[_nextId] = id;
                id = _nextId;
                _nextId++;
            }
            if (_collectionReverseIndex != null)
            {
                _collectionReverseIndex.Add(collection, id);
            }
            return(id + 2);
        }
Beispiel #11
0
        /// <summary>
        /// Adds a new collection, it's assumed to be sorted.
        /// </summary>
        private uint AddCollection(int[] collection)
        {
            uint id;

            if (_collectionReverseIndex != null)
            {
                // check duplicates.
                if (_collectionReverseIndex.TryGetValue(collection, out id))
                { // collection already exists.
                    return(id + 2);
                }
            }

            id = (uint)_collectionIndex.Add(collection);
            if (_index != null)
            { // use next id.
                if (_nextId >= _index.Length)
                {
                    _index.Resize(_index.Length + 1024);
                }
                _index[_nextId] = id;
                id = _nextId;
                _nextId++;
            }
            if (_collectionReverseIndex != null)
            {
                _collectionReverseIndex.Add(collection, id);
            }
            return(id + 2);
        }
        public virtual ConstructorInfo GetConstrutor(string className)
        {
            ConstructorInfo ci = null;

            construtorsMap.TryGetValue(className, out ci);
            return(ci);
        }
        /// <param name="name"></param>
        /// <returns>null if it does not exist</returns>
        public virtual ClassInfo GetClassInfoWithName(string name)
        {
            ClassInfo ci = null;

            classInfos.TryGetValue(name, out ci);
            return(ci);
        }
Beispiel #14
0
        public static ODBType GetFromName(string fullName
                                          )
        {
            ODBType tc = null;

            typesByName.TryGetValue(fullName, out tc);
            if (tc != null)
            {
                return(tc);
            }
            ODBType nonNative = new ODBType
                                    (ODBType.NonNative.isPrimitive, NonNativeId
                                    , fullName, 0);

            return(nonNative);
        }
Beispiel #15
0
        public static V GetMapValue <K, V>(System.Collections.Generic.IDictionary <K, V> map, K key)
        {
            V r = default(V);

            map.TryGetValue(key, out r);
            return(r);
        }
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("LastAppliedEventId", out value))
            {
                @LastAppliedEventId = value is Int32 ? (Int32)value : (Int64)value;
            }
            if (values.TryGetValue("Value", out value))
            {
                @Value = (Decimal)value;
            }
        }
Beispiel #17
0
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("GetTaxRequest", out value))
            {
                @GetTaxRequest = (GetTaxRequest)value;
            }
            if (values.TryGetValue("GetTaxResult", out value))
            {
                @GetTaxResult = (GetTaxResult)value;
            }
        }
Beispiel #18
0
 public static T Get <T>(this System.Collections.Generic.IDictionary <string, object> dic, string key)
 {
     if (!dic.TryGetValue(key, out object obj))
     {
         return((T)(object)null);
     }
     return((T)obj);
 }
Beispiel #19
0
 public override void Initialize(System.Collections.Generic.IDictionary <string, string> parameters)
 {
     // Book ID
     if (!parameters.TryGetValue("id", out _bookId))
     {
         throw new ArgumentException("Missing book id in parameter list.", "id");
     }
 }
Beispiel #20
0
 public void Off(System.Action value)
 {
     if (_wrappers.TryGetValue(value, out var wrapper))
     {
         Off(wrapper);
         _wrappers.Remove(value);
     }
 }
Beispiel #21
0
 public static T Get <T>(this System.Collections.Generic.IDictionary <string, T> dic, string key)
     where T : class
 {
     if (!dic.TryGetValue(key, out T obj))
     {
         return((T)(object)null);
     }
     return(obj);
 }
Beispiel #22
0
        public void SetParameterValues(System.Collections.Generic.IDictionary <string, string> parameters)
        {
            string offset;

            if (parameters.TryGetValue("Offset", out offset))
            {
                Offset = TimeSpan.Parse(offset);
            }
        }
Beispiel #23
0
        public void SetParameterValues(System.Collections.Generic.IDictionary <string, string> parameters)
        {
            var typeName = string.Empty;

            if (parameters.TryGetValue(TypeNameParameter, out typeName) == true)
            {
                this.TypeName = typeName;
            }
        }
Beispiel #24
0
        public virtual void MarkIdAsDeleted(NeoDatis.Odb.OID oid)
        {
            if (oid == null)
            {
                throw new ODBRuntimeException(NeoDatisError.CacheNullOid);
            }
            IdInfo idInfo = null;

            objectPositionsByIds.TryGetValue(oid, out idInfo);
            if (idInfo != null)
            {
                idInfo.status = IDStatus.Deleted;
            }
            else
            {
                idInfo = new IdInfo(oid, -1, IDStatus.Deleted);
                objectPositionsByIds[oid] = idInfo;
            }
        }
Beispiel #25
0
        //https://stackoverflow.com/questions/1343704/casting-c-sharp-out-parameters
        static bool TryGetTypedValue <TKey, TValue, TActual>(this System.Collections.Generic.IDictionary <TKey, TValue> data, TKey key, out TActual value) where TActual : TValue
        {
            TValue tmp;

            if (data.TryGetValue(key, out tmp))
            {
                value = (TActual)tmp;
                return(true);
            }
            value = default(TActual);
            return(false);
        }
Beispiel #26
0
        //throw new ODBRuntimeException(Error.CACHE_IS_FULL.addParameter(objectInfoPointersCacheFromOid.size()).addParameter(OdbConfiguration.getMaxNumberOfObjectInCache()));
        public virtual void StartInsertingObjectWithOid(object o, NeoDatis.Odb.OID
                                                        oid, NonNativeObjectInfo nnoi)
        {
            // In this case oid can be -1,because object is beeing inserted and do
            // not have yet a defined oid.
            if (o == null)
            {
                return;
            }
            ObjectInsertingInfo oii = null;

            insertingObjects.TryGetValue(o, out oii);
            if (oii == null)
            {
                insertingObjects[o] = new ObjectInsertingInfo(oid, 1);
            }
            else
            {
                oii.level++;
            }
        }
Beispiel #27
0
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("EmailMessage", out value))
            {
                @EmailMessage = (EmailMessage)value;
            }
        }
Beispiel #28
0
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("Customer", out value))
            {
                @Customer = (Customer)value;
            }
        }
Beispiel #29
0
        public virtual void RemoveObjectWithOid(NeoDatis.Odb.OID oid)
        {
            if (oid == null)
            {
                throw new ODBRuntimeException(NeoDatisError.CacheNullOid);
            }
            object o = null;

            oids.TryGetValue(oid, out o);
            oids.Remove(oid);
            if (o != null)
            {
                objects.Remove(o);
            }
            // FIXME URL in HashMap What should we do?
            objectInfoPointersCacheFromOid.Remove(oid);
            unconnectedZoneOids.Remove(oid);
            // For monitoring purpose
            nbObjects = objects.Count;
            nbOids    = oids.Count;
            nbOih     = objectInfoPointersCacheFromOid.Count;
        }
Beispiel #30
0
        public override void SetAll(System.Collections.Generic.IDictionary <string, object> values)
        {
            object value;

            if (values == null)
            {
                InitStateFields(); return;
            }
            if (values.TryGetValue("BingLocation", out value))
            {
                @BingLocation = (GeoLocation)value;
            }
        }