Here are the examples of the csharp api System.Collections.Hashtable.ContainsKey(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
554 Examples
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public static MemcachedInstance FindInstance(string name)
{
name = name.ToLower();
if (_MemcachedInstances.ContainsKey(name))
{
return _MemcachedInstances[name] as MemcachedInstance;
}
return null;
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private bool IsInstanceExists(string instanceName)
{
return _MemcachedInstances.ContainsKey(instanceName.ToLower());
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private MemcachedInstance GetInstance(string name)
{
if (_MemcachedInstances.ContainsKey(name))
{
return _MemcachedInstances[name] as MemcachedInstance;
}
return null;
}
19
Source : ListObjectType.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Draw(Type memberType, string memberName, object value, object target, int indentLevel)
{
isFoldout = EditorGUILayout.Foldout(isFoldout, memberName, true);
if (isFoldout)
{
EditorGUI.indentLevel = indentLevel + 1;
IList iList = (IList)value;
EditorGUILayout.LabelField("Size", iList.Count.ToString());
for (int i = 0; i < iList.Count; i++)
{
if (iList[i] == null) continue;
if (objectObjectTypes.ContainsKey((value, iList[i])))
{
ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(value, iList[i])];
objectObjectType.Draw(iList[i].GetType(), $"Element {i}", iList[i], null, indentLevel + 1);
continue;
}
if (iList[i].GetType().replacedembly.ManifestModule.Name == "ILRuntime.dll" || iList[i].GetType().replacedembly.ManifestModule.Name == "Unity.Model.dll")
{
ObjectObjectType objectObjectType = new ObjectObjectType();
objectObjectType.Draw(iList[i].GetType(), $"Element {i}", iList[i], null, indentLevel + 1);
objectObjectTypes.Add((value, iList[i]), objectObjectType);
continue;
}
foreach (IObjectType objectTypeItem in ObjectTypeUtil.objectList)
{
if (!objectTypeItem.IsType(iList[i].GetType()))
{
continue;
}
iList[i] = objectTypeItem.Draw(iList[i].GetType(), $"Element {i}", iList[i], null);
}
}
EditorGUI.indentLevel = indentLevel;
}
}
19
Source : ObjectTypeUtil.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public static void Draw(object obj, int indentLevel)
{
EditorGUILayout.BeginVertical();
EditorGUI.indentLevel = indentLevel;
string replacedemblyName = string.Empty;
switch (Path.GetFileNameWithoutExtension(obj.GetType().replacedembly.ManifestModule.Name))
{
case "Unity.Model":
replacedemblyName = "Unity.Model";
break;
case "Unity.Hotfix":
replacedemblyName = "Unity.Hotfix";
break;
case "ILRuntime":
replacedemblyName = "Unity.Hotfix";
break;
}
if (replacedemblyName == "Unity.Model")
{
FieldInfo[] fieldInfos = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (FieldInfo item in fieldInfos)
{
object value = item.GetValue(obj);
Type type = item.FieldType;
if (item.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (type.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (objectObjectTypes.ContainsKey((obj, item)))
{
ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "Unity.Model.dll")
{
ObjectObjectType objectObjectType = new ObjectObjectType();
if (value == null)
{
object instance = Activator.CreateInstance(type);
objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
item.SetValue(obj, instance);
}
else
{
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
}
objectObjectTypes.Add((obj, item), objectObjectType);
continue;
}
if (listObjectTypes.ContainsKey((obj, item)))
{
ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
listObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if (type.GetInterface("IList") != null)
{
ListObjectType listObjectType = new ListObjectType();
if (value == null)
{
continue;
}
listObjectType.Draw(type, item.Name, value, null, indentLevel);
listObjectTypes.Add((obj, item), listObjectType);
continue;
}
foreach (IObjectType objectTypeItem in objectList)
{
if (!objectTypeItem.IsType(type))
{
continue;
}
string fieldName = item.Name;
if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
{
continue;
}
if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
{
fieldName = fieldName.Substring(1, fieldName.Length - 17);
}
value = objectTypeItem.Draw(type, fieldName, value, null);
item.SetValue(obj, value);
}
}
}
else
{
#if ILRuntime
FieldInfo[] fieldInfos = ILRuntimeManager.Instance.appdomain.LoadedTypes[obj.ToString()].ReflectionType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (FieldInfo item in fieldInfos)
{
object value = item.GetValue(obj);
if (item.FieldType is ILRuntimeWrapperType)
{
//基础类型绘制
Type type = ((ILRuntimeWrapperType)item.FieldType).RealType;
if (item.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (type.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (listObjectTypes.ContainsKey((obj, item)))
{
ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
listObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if (type.GetInterface("IList") != null)
{
ListObjectType listObjectType = new ListObjectType();
if (value == null)
{
continue;
}
listObjectType.Draw(type, item.Name, value, null, indentLevel);
listObjectTypes.Add((obj, item), listObjectType);
continue;
}
foreach (IObjectType objectTypeItem in objectList)
{
if (!objectTypeItem.IsType(type))
{
continue;
}
string fieldName = item.Name;
if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
{
continue;
}
if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
{
fieldName = fieldName.Substring(1, fieldName.Length - 17);
}
value = objectTypeItem.Draw(type, fieldName, value, null);
item.SetValue(obj, value);
}
}
else
{
//自定义类型绘制
Type type = item.FieldType;
if (item.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (type.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (objectObjectTypes.ContainsKey((obj, item)))
{
ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "ILRuntime.dll")
{
ObjectObjectType objectObjectType = new ObjectObjectType();
if (value == null)
{
object instance = ILRuntimeManager.Instance.appdomain.Instantiate(type.ToString());
objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
item.SetValue(obj, instance);
}
else
{
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
}
objectObjectTypes.Add((obj, item), objectObjectType);
continue;
}
}
}
#else
FieldInfo[] fieldInfos = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (FieldInfo item in fieldInfos)
{
object value = item.GetValue(obj);
Type type = item.FieldType;
if (item.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (type.IsDefined(typeof(HideInInspector), false))
{
continue;
}
if (objectObjectTypes.ContainsKey((obj, item)))
{
ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "Unity.Hotfix.dll")
{
ObjectObjectType objectObjectType = new ObjectObjectType();
if (value == null)
{
object instance = Activator.CreateInstance(type);
objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
item.SetValue(obj, instance);
}
else
{
objectObjectType.Draw(type, item.Name, value, null, indentLevel);
}
objectObjectTypes.Add((obj, item), objectObjectType);
continue;
}
if (listObjectTypes.ContainsKey((obj, item)))
{
ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
listObjectType.Draw(type, item.Name, value, null, indentLevel);
continue;
}
if (type.GetInterface("IList") != null)
{
ListObjectType listObjectType = new ListObjectType();
if (value == null)
{
continue;
}
listObjectType.Draw(type, item.Name, value, null, indentLevel);
listObjectTypes.Add((obj, item), listObjectType);
continue;
}
foreach (IObjectType objectTypeItem in objectList)
{
if (!objectTypeItem.IsType(type))
{
continue;
}
string fieldName = item.Name;
if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
{
continue;
}
if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
{
fieldName = fieldName.Substring(1, fieldName.Length - 17);
}
value = objectTypeItem.Draw(type, fieldName, value, null);
item.SetValue(obj, value);
}
}
#endif
EditorGUI.indentLevel = indentLevel;
EditorGUILayout.EndVertical();
}
}
19
Source : EventManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Publish<T>(T data)
{
Type type = typeof(T);
if (events.ContainsKey(type))
{
AEvent<T> aEvent = (AEvent<T>)events[type];
aEvent.Publish(data);
}
else
{
LogUtil.Log($"事件不存在{type.Name}");
}
}
19
Source : ItemManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public bool ItemExist(ItemType type)
{
if (items.ContainsKey(type))
{
return true;
}
return false;
}
19
Source : Manager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void InitManager()
{
if (LccModel.MonoManager.Instance.typeList.Count != 0)
{
foreach (Type item in LccModel.MonoManager.Instance.typeList)
{
if (!types.ContainsKey(item.Name))
{
types.Add(item.Name, item);
}
}
}
else
{
foreach (Type item in LccModel.ILRuntimeManager.Instance.typeList)
{
if (!types.ContainsKey(item.Name))
{
types.Add(item.Name, item);
}
}
}
}
19
Source : NumericEventManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void InitManager()
{
foreach (Type item in Manager.Instance.types.Values)
{
if (item.IsAbstract) continue;
NumericEventHandlerAttribute[] numericEventHandlerAttributes = (NumericEventHandlerAttribute[])item.GetCustomAttributes(typeof(NumericEventHandlerAttribute), false);
foreach (NumericEventHandlerAttribute numericEventHandlerAttributeItem in numericEventHandlerAttributes)
{
INumericEvent iNumericEvent = (INumericEvent)Activator.CreateInstance(item);
if (!numericEvents.ContainsKey(numericEventHandlerAttributeItem.numericType))
{
numericEvents.Add(numericEventHandlerAttributeItem.numericType, new List<INumericEvent>());
}
((List<INumericEvent>)numericEvents[numericEventHandlerAttributeItem.numericType]).Add(iNumericEvent);
}
}
}
19
Source : UIEventManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Publish(string uiEventType)
{
if (uiEvents.ContainsKey(uiEventType))
{
UIEvent uiEvent = (UIEvent)uiEvents[uiEventType];
uiEvent.Publish();
}
else
{
LogUtil.Log($"事件不存在{uiEventType}");
}
}
19
Source : UIEventManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Publish<T>(string uiEventType, T data)
{
if (uiEvents.ContainsKey(uiEventType))
{
UIEvent uiEvent = (UIEvent)uiEvents[uiEventType];
uiEvent.Publish(data);
}
else
{
LogUtil.Log($"事件不存在{uiEventType}");
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
private void FixedUpdate()
{
while (fixedUpdate.Count > 0)
{
long id = fixedUpdate.Dequeue();
if (aObjectBases.ContainsKey(id))
{
AObjectBase aObjectBase = (AObjectBase)aObjectBases[id];
aObjectBase.FixedUpdate();
fixedUpdateCopy.Enqueue(id);
}
}
ObjectUtil.Swap(ref fixedUpdate, ref fixedUpdateCopy);
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
private void Update()
{
while (update.Count > 0)
{
long id = update.Dequeue();
if (aObjectBases.ContainsKey(id))
{
AObjectBase aObjectBase = (AObjectBase)aObjectBases[id];
aObjectBase.Update();
updateCopy.Enqueue(id);
}
}
ObjectUtil.Swap(ref update, ref updateCopy);
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
private void LateUpdate()
{
while (lateUpdate.Count > 0)
{
long id = lateUpdate.Dequeue();
if (aObjectBases.ContainsKey(id))
{
AObjectBase aObjectBase = (AObjectBase)aObjectBases[id];
aObjectBase.LateUpdate();
lateUpdateCopy.Enqueue(id);
}
}
ObjectUtil.Swap(ref lateUpdate, ref lateUpdateCopy);
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Remove(AObjectBase aObjectBase)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBases.Remove(aObjectBase.id);
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Awake(AObjectBase aObjectBase)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBase.Awake();
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Awake<P1>(AObjectBase aObjectBase, P1 p1)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBase.Awake(p1);
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Awake<P1, P2>(AObjectBase aObjectBase, P1 p1, P2 p2)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBase.Awake(p1, p2);
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Awake<P1, P2, P3>(AObjectBase aObjectBase, P1 p1, P2 p2, P3 p3)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBase.Awake(p1, p2, p3);
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Awake<P1, P2, P3, P4>(AObjectBase aObjectBase, P1 p1, P2 p2, P3 p3, P4 p4)
{
if (aObjectBases.ContainsKey(aObjectBase.id))
{
aObjectBase.Awake(p1, p2, p3, p4);
}
}
19
Source : ObjectBaseEventSystem.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
private void Start()
{
while (start.Count > 0)
{
long id = start.Dequeue();
if (aObjectBases.ContainsKey(id))
{
AObjectBase aObjectBase = (AObjectBase)aObjectBases[id];
aObjectBase.Start();
}
}
}
19
Source : AudioManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public bool AudioExist(string audio)
{
if (audios.ContainsKey(audio))
{
return true;
}
return false;
}
19
Source : LanguageManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void ChangeLanguage(LanguageType type)
{
Textreplacedet replacedet = replacedetManager.Instance.Loadreplacedet<Textreplacedet>(type.ToString(), ".txt", false, true, replacedetType.Config);
foreach (string item in replacedet.text.Split('\n'))
{
if (string.IsNullOrEmpty(item))
{
continue;
}
string[] KeyValue = item.Split('=');
if (languages.ContainsKey(KeyValue[0])) return;
languages.Add(KeyValue[0], KeyValue[1]);
}
}
19
Source : LanguageManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public string GetValue(string key)
{
if (!languages.ContainsKey(key)) return string.Empty;
string value = (string)languages[key];
return value;
}
19
Source : AssetBundleManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public replacedetBundle Loadreplacedet(string replacedetName)
{
string replacedetBundleName;
if (localreplacedetBundleConfig.replacedetBundleRuleTypeDict[replacedetName] == replacedetBundleRuleType.File)
{
replacedetBundleName = $"{MD5Util.ComputeMD5(replacedetName)}.unity3d";
}
else
{
replacedetBundleName = $"{MD5Util.ComputeMD5(Path.GetDirectoryName(replacedetName).Replace("\\", "/"))}.unity3d";
}
if (replacedetBundles.ContainsKey(replacedetBundleName))
{
return (replacedetBundle)replacedetBundles[replacedetBundleName];
}
else
{
replacedetBundle replacedetBundle = replacedetBundle.LoadFromFile($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{replacedetBundleName}");
string[] dependencies = replacedetBundleManifest.GetAllDependencies(replacedetBundleName);
foreach (string item in dependencies)
{
replacedetBundles.Add(item, replacedetBundle.LoadFromFile($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item}"));
}
replacedetBundles.Add(replacedetBundleName, replacedetBundle);
return replacedetBundle;
}
}
19
Source : AssetBundleManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Unloadreplacedet(string replacedetName)
{
string replacedetBundleName = $"{MD5Util.ComputeMD5(replacedetName)}.unity3d";
if (replacedetBundles.ContainsKey(replacedetName))
{
replacedetBundle replacedetBundle = (replacedetBundle)replacedetBundles[replacedetBundleName];
replacedetBundle.Unload(true);
replacedetBundles.Remove(replacedetBundle);
}
}
19
Source : Manager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void InitManager()
{
foreach (Type item in GetType().replacedembly.GetTypes())
{
if (!types.ContainsKey(item.Name))
{
types.Add(item.Name, item);
}
}
}
19
Source : NumericEventManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void Publish(NumericType type, long value)
{
if (numericEvents.ContainsKey(type))
{
List<INumericEvent> list = (List<INumericEvent>)numericEvents[type];
foreach (INumericEvent item in list)
{
item.Publish(value);
}
}
else
{
LogUtil.Log($"事件不存在{type}");
}
}
19
Source : PanelManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public bool PanelExist(PanelType type)
{
if (panels.ContainsKey(type))
{
return true;
}
return false;
}
19
Source : VideoManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public bool VideoExist(string video)
{
if (videos.ContainsKey(video))
{
return true;
}
return false;
}
19
Source : VoiceManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public bool AudioExist(string audio)
{
if (voices.ContainsKey(audio))
{
return true;
}
return false;
}
19
Source : AdColonyAdView.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void UpdateValues(Hashtable values)
{
if (values != null)
{
if (values.ContainsKey("zone_id"))
{
ZoneId = values["zone_id"] as string;
}
if (values.ContainsKey("id"))
{
Id = values["id"] as string;
}
if (values.ContainsKey("position"))
{
int adpositionTemp = Int32.Parse(values["position"] as string);
adPosition = getAdPosition(adpositionTemp);
}
}
}
19
Source : AdColonyInterstitialAd.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void UpdateValues(Hashtable values)
{
if (values != null)
{
if (values.ContainsKey("zone_id"))
{
ZoneId = values["zone_id"] as string;
}
if (values.ContainsKey("expired"))
{
Expired = Convert.ToBoolean(values["expired"]);
}
if (values.ContainsKey("id"))
{
Id = values["id"] as string;
}
}
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public bool GetPrivacyFrameworkRequired(string type)
{
if (type == null)
{
Debug.Log("Invalid option type.");
return false;
}
return _data.ContainsKey(type + Constants.CONSENT_REQUIRED) ? (bool)_data[type + Constants.CONSENT_REQUIRED] : false;
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public string GetPrivacyConsentString(string type)
{
if (type == null)
{
Debug.Log("Invalid option type.");
return null;
}
return _data.ContainsKey(type + Constants.CONSENT_STRING) ? _data[type + Constants.CONSENT_STRING] as string : null;
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public int GetIntOption(string key)
{
return _data.ContainsKey(key) ? Convert.ToInt32(_data[key]) : 0;
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public double GetDoubleOption(string key)
{
return _data.ContainsKey(key) ? Convert.ToDouble(_data[key]) : 0.0;
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public bool GetBoolOption(string key)
{
return _data.ContainsKey(key) ? Convert.ToBoolean(_data[key]) : false;
}
19
Source : AdColonyUserMetadata.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
[Obsolete("GetDoubleMetadata is deprecated")]
public double GetDoubleMetadata(string key)
{
return _data.ContainsKey(key) ? Convert.ToDouble(_data[key]) : 0.0;
}
19
Source : AdColonyUserMetadata.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
[Obsolete("GetBoolMetadata is deprecated")]
public bool GetBoolMetadata(string key)
{
return _data.ContainsKey(key) ? Convert.ToBoolean(Convert.ToInt32(_data[key])) : false;
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void _OnIAPOpportunity(string paramJson)
{
Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
if (values == null)
{
Debug.LogError("Unable to parse parameters in _OnIAPOpportunity, " + (paramJson ?? "null"));
return;
}
Hashtable valuesAd = null;
string iapProductId = null;
AdsIAPEngagementType engagement = AdsIAPEngagementType.AdColonyIAPEngagementEndCard;
if (values.ContainsKey(Constants.OnIAPOpportunityAdKey))
{
valuesAd = (AdColonyJson.Decode(values[Constants.OnIAPOpportunityAdKey] as String)) as Hashtable;
}
if (values.ContainsKey(Constants.OnIAPOpportunityEngagementKey))
{
engagement = (AdsIAPEngagementType)Convert.ToInt32(values[Constants.OnIAPOpportunityEngagementKey]);
}
if (values.ContainsKey(Constants.OnIAPOpportunityIapProductIdKey))
{
iapProductId = values[Constants.OnIAPOpportunityIapProductIdKey] as string;
}
IntersreplacedialAd ad = GetAdFromHashtable(valuesAd);
if (ad == null)
{
Debug.LogError("Unable to create ad within _OnIAPOpportunity, " + (paramJson ?? "null"));
return;
}
if (Ads.OnIAPOpportunity != null)
{
Ads.OnIAPOpportunity(ad, iapProductId, engagement);
}
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void _OnRewardGranted(string paramJson)
{
string zoneId = null;
bool success = false;
string productId = null;
int amount = 0;
Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
if (values == null)
{
Debug.LogError("Unable to parse parameters in _OnRewardGranted, " + (paramJson ?? "null"));
return;
}
if (values != null)
{
if (values.ContainsKey(Constants.OnRewardGrantedZoneIdKey))
{
zoneId = values[Constants.OnRewardGrantedZoneIdKey] as string;
}
if (values.ContainsKey(Constants.OnRewardGrantedSuccessKey))
{
success = Convert.ToBoolean(Convert.ToInt32(values[Constants.OnRewardGrantedSuccessKey]));
}
if (values.ContainsKey(Constants.OnRewardGrantedNameKey))
{
productId = values[Constants.OnRewardGrantedNameKey] as string;
}
if (values.ContainsKey(Constants.OnRewardGrantedAmountKey))
{
amount = Convert.ToInt32(values[Constants.OnRewardGrantedAmountKey]);
}
}
if (Ads.OnRewardGranted != null)
{
Ads.OnRewardGranted(zoneId, success, productId, amount);
}
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void _OnCustomMessageReceived(string paramJson)
{
string type = null;
string message = null;
Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
if (values == null)
{
Debug.LogError("Unable to parse parameters in _OnCustomMessageReceived, " + (paramJson ?? "null"));
return;
}
if (values != null)
{
if (values.ContainsKey(Constants.OnCustomMessageReceivedTypeKey))
{
type = values[Constants.OnCustomMessageReceivedTypeKey] as string;
}
if (values.ContainsKey(Constants.OnCustomMessageReceivedMessageKey))
{
message = values[Constants.OnCustomMessageReceivedMessageKey] as string;
}
}
if (Ads.OnCustomMessageReceived != null)
{
Ads.OnCustomMessageReceived(type, message);
}
}
19
Source : AdColonyUserMetadata.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
[Obsolete("GetIntMetadata is deprecated")]
public int GetIntMetadata(string key)
{
return _data.ContainsKey(key) ? Convert.ToInt32(_data[key]) : 0;
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public void _OnRequestIntersreplacedialFailed(string paramJson)
{
Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
if (values == null)
{
Debug.LogError("Unable to parse parameters in _OnRequestIntersreplacedialFailed, " + (paramJson ?? "null"));
return;
}
string zoneId = "";
if (values != null && values.ContainsKey("zone_id"))
{
zoneId = values["zone_id"] as string;
}
if (Ads.OnRequestIntersreplacedialFailed != null)
{
Ads.OnRequestIntersreplacedialFailed();
}
if (Ads.OnRequestIntersreplacedialFailedWithZone != null)
{
Ads.OnRequestIntersreplacedialFailedWithZone(zoneId);
}
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
private AdColonyAdView GetAdColonyAdViewFromHashtable(Hashtable values)
{
string id = null;
if (values != null && values.ContainsKey("id"))
{
id = values["id"] as string;
}
AdColonyAdView ad = null;
if (id != null)
{
if (adcolonyAdViewDictionary.ContainsKey(id))
{
ad = adcolonyAdViewDictionary[id];
ad.UpdateValues(values);
}
else
{
ad = new AdColonyAdView(values);
adcolonyAdViewDictionary[id] = ad;
}
}
return ad;
}
19
Source : AdColonyUserMetadata.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
[Obsolete("GetStringMetadata is deprecated")]
public string GetStringMetadata(string key)
{
return _data.ContainsKey(key) ? _data[key] as string : null;
}
19
Source : AdColony.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
private IntersreplacedialAd GetAdFromHashtable(Hashtable values)
{
string id = null;
if (values != null && values.ContainsKey("id"))
{
id = values["id"] as string;
}
IntersreplacedialAd ad = null;
if (id != null)
{
if (_ads.ContainsKey(id))
{
ad = _ads[id];
ad.UpdateValues(values);
}
else
{
ad = new IntersreplacedialAd(values);
_ads[id] = ad;
}
}
return ad;
}
19
Source : AdColonyOptions.cs
with Apache License 2.0
from AdColony
with Apache License 2.0
from AdColony
public string GetStringOption(string key)
{
return _data.ContainsKey(key) ? _data[key] as string : null;
}
19
Source : FileStorage.cs
with GNU General Public License v3.0
from aiportal
with GNU General Public License v3.0
from aiportal
public bool Exists(string fpath)
{
Debug.replacedert(!string.IsNullOrEmpty(fpath));
fpath = fpath.TrimStart('/');
bool exists = false;
try
{
exists = _files.ContainsKey(fpath);
if (!exists)
{
if (File.Exists(WebPackage))
{
using (FileStream fs = new FileStream(WebPackage, FileMode.Open, FileAccess.Read, FileShare.Read))
exists = ZipStream.IsExists(fs, fpath);
}
else
{
// package not exists.
using (MemoryStream fs = new MemoryStream(Resources.ResourceManager.GetObject("web") as byte[]))
exists = ZipStream.IsExists(fs, fpath);
}
}
if (exists)
{
if (!_files.ContainsKey(fpath))
_files[fpath] = Guid.NewGuid().ToString();
}
}
catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
return exists;
}
See More Examples