/// <summary> /// Fills the meta. /// </summary> /// <param name="meta">The meta.</param> /// <param name="blobMeta">The BLOB meta.</param> public static void FillMeta(this BinaryStorageMetaData meta, Dictionary<string, string> blobMeta) { if (meta != null && blobMeta != null) { meta.Duration = blobMeta.SafeGetValue("duration").ObjectToNullableInt32(); meta.Height = blobMeta.SafeGetValue("height").ObjectToNullableInt32(); meta.Width = blobMeta.SafeGetValue("width").ObjectToNullableInt32(); meta.OwnerKey = blobMeta.SafeGetValue("owner").ObjectToGuid(); } }
public bool Contains(KeyValuePair <TKey, TValue> item) { TValue value = _forwardDictionary.SafeGetValue(item.Key); if (value == null) { return(false); } if (item.Value.Equals(value)) { return(true); } return(false); }
protected T SafeGetMetaField<T>(string field) { var res = _properties?.SafeGetValue(field); if (!(res is T)) return default; return (T)res; }
WordSet GetWord(WordId id) { if (!isInitialized) { Init(); } return(wordLibrary.SafeGetValue(id)); }
/// <summary> /// Adds the specified to. /// </summary> /// <param name="to">To.</param> /// <param name="replacements">The replacements.</param> public void Add(string to, Dictionary<string, string> replacements) { this.To.Add(to); foreach (var one in this.Substitution) { one.Value.Add(replacements.SafeGetValue(one.Key)); } }
public static string SafeGetStringValue( this Dictionary <string, object> dict, string key) { object val = dict.SafeGetValue(key); return(val != null?val.ToString() : null); }
private PersonData GetData(int peerId) { if (peerId == Id) { throw new ArgumentException("Cannot have self as peer"); } return(_peers.SafeGetValue(peerId) ?? (_peers[peerId] = new PersonData(peerId, _network.GetName(peerId)))); }
public void Add(TKey key, TValue value) { _forwardDictionary.Add(key, value); HashSet <TKey> keySet = _reverseDictionary.SafeGetValue(value); if (keySet == null) { keySet = new HashSet <TKey> { key }; _reverseDictionary.Add(value, keySet); } else { _ = keySet.Add(key); } }
public IPool <T> GetPool <T>(T poolableObject) { var gameObject = Convert(poolableObject); return(_poolsDictionary.SafeGetValue(gameObject) as IPool <T>); }
public AnimationCurve GetAnimationCurve(MyAnimationCurveType type) { return(curveDic.SafeGetValue(type)); }
public static T SafeGetValue <T>(this Dictionary <string, object> dictionary, string key) { return(dictionary.SafeGetValue <string, object, T>(key)); }
internal ArtefactData GetArtefact(int id) => _artefacts.SafeGetValue(id);