Here are the examples of the csharp api System.Collections.Hashtable.Add(object, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
745 Examples
19
View Source File : MemcachedInstance.cs
License : MIT License
Project Creator : 0ffffffffh
License : MIT License
Project Creator : 0ffffffffh
private bool PutInstance(MemcachedInstance instance, string name)
{
lock (_InstanceListLock)
{
if (IsInstanceExists(name))
return false;
_MemcachedInstances.Add(name.ToLower(), instance);
}
return true;
}
19
View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise
License : Apache License 2.0
Project Creator : 0nise
private static Hashtable getAllHistorySumMoney(Hashtable userInfo)
{
Hashtable userBlank = new Hashtable();
MySqlConnection connection = null;
try
{
connection = ConnectionPool.getPool().getConnection();
// 链接为null就执行等待
while (connection == null)
{
}
foreach (DictionaryEntry item in userInfo)
{
string sql = string.Format("SELECT SUM(ABS(money)) as money FROM ichunqiu_blank_history WHERE user_qq = '{0}' AND operation = '0'", item.Key);
using (MySqlCommand mySqlCommand = new MySqlCommand(sql, connection))
{
using (MySqlDataReader myDataReader = mySqlCommand.ExecuteReader())
{
while (myDataReader.Read() == true)
{
if (myDataReader["money"] is DBNull)
{
userBlank.Add(userInfo[item.Key], 0);
}
else
{
userBlank.Add(userInfo[item.Key], myDataReader["money"]);
}
break;
}
}
}
}
}
catch (Exception)
{
throw;
}
finally {
if (connection != null)
{
connection.Close();
}
// 关闭数据库链接
ConnectionPool.getPool().closeConnection(connection);
}
return userBlank;
}
19
View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise
License : Apache License 2.0
Project Creator : 0nise
public static string Top30Money()
{
// 未提取存款
Hashtable userMoney = new Hashtable();
Hashtable userInfo = new Hashtable();
// 已经提取存款
Hashtable userBlank = new Hashtable();
// 财富榜前20
Hashtable userData = new Hashtable();
string resultMsg = "";
MySqlConnection connection = null;
try
{
connection = ConnectionPool.getPool().getConnection();
// 链接为null就执行等待
while (connection == null)
{
}
string sql = "SELECT bbs_nick_name,user_money,user_qq FROM ichunqiu_blank";
using (MySqlCommand cmd = new MySqlCommand(sql,connection))
{
using (MySqlDataReader myDataReader = cmd.ExecuteReader())
{
while (myDataReader.Read() == true)
{
userMoney.Add(myDataReader["bbs_nick_name"], myDataReader["user_money"]);
userInfo.Add(myDataReader["user_qq"], myDataReader["bbs_nick_name"]);
}
}
}
// 提取历史提取总金额
userBlank = getAllHistorySumMoney(userInfo);
// ArrayList allMoney = new ArrayList();
List<Decimal> allMoney = new List<decimal>();
foreach (DictionaryEntry item in userMoney)
{
decimal blance = Convert.ToDecimal(item.Value);
decimal historyBlance = Convert.ToDecimal(userBlank[item.Key]);
userData.Add(item.Key, historyBlance + blance);
allMoney.Add(historyBlance + blance);
}
/*
List<decimal> allMoney = new List<decimal>();
foreach (string item in userData.Values)
{
allMoney.Add(Convert.ToDecimal(item));
}*/
// 降序
allMoney.Sort((x, y) => -x.CompareTo(y));
int i = 0;
foreach (decimal money in allMoney)
{
foreach (DictionaryEntry item in userData)
{
if (Convert.ToDecimal(item.Value) == money)
{
resultMsg += string.Format("NO【{0}】:{1}身价{2},已提取存款{3},未提取存款{4}\n", (i + 1).ToString(), Convert.ToString(item.Key), Convert.ToString(money), Convert.ToString(userBlank[item.Key]), Convert.ToString(userMoney[item.Key]));
// 删除用户避免出现重复的情况
userData.Remove(item.Key);
break;
}
}
i++;
if (i > 29)
{
break;
}
}
}
catch (Exception)
{
throw;
}
finally {
if (connection != null) {
connection.Close();
}
// 关闭数据库链接
ConnectionPool.getPool().closeConnection(connection);
}
return resultMsg;
}
19
View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise
License : Apache License 2.0
Project Creator : 0nise
public static Hashtable getThisWeek()
{
string sql = "select user_qq,DATE_FORMAT(create_date,'%Y-%m-%d') as date from ichunqiu_user where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_date) GROUP BY user_qq,DATE_FORMAT(create_date,'%Y-%m-%d');";
Hashtable hashtable = new Hashtable();
MySqlConnection connection = null;
try
{
connection = ConnectionPool.getPool().getConnection();
// 链接为null就执行等待
while (connection == null)
{
}
using (MySqlCommand mySqlCommand = new MySqlCommand(sql, connection))
{
// 提取数据
using (MySqlDataReader myDataReader = mySqlCommand.ExecuteReader())
{
while (myDataReader.Read() == true)
{
string date = myDataReader["date"].ToString();
if (hashtable.Contains(date))
{
hashtable[date] = (Convert.ToInt16(hashtable[date]) + 1).ToString();
}
else
{
hashtable.Add(date, "1");
}
}
}
}
}
catch (Exception e)
{
throw e;
}
finally
{
if (connection != null)
{
connection.Close();
}
ConnectionPool.getPool().closeConnection(connection);
}
return hashtable;
}
19
View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise
License : Apache License 2.0
Project Creator : 0nise
public static Hashtable getThisWeek()
{
string sql = "select user_qq,DATE_FORMAT(create_date,'%Y-%m-%d') as date from ichunqiu_user where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_date) GROUP BY user_qq,DATE_FORMAT(create_date,'%Y-%m-%d');";
Hashtable hashtable = new Hashtable();
MySqlConnection connection = new MySqlConnection(Constants.connectionStr);
try
{
connection.Open();
MySqlCommand mySqlCommand = new MySqlCommand(sql, connection);
// 提取数据
MySqlDataReader myDataReader = mySqlCommand.ExecuteReader();
while (myDataReader.Read() == true)
{
string date = myDataReader["date"].ToString();
if (hashtable.Contains(date))
{
hashtable[date] = (Convert.ToInt16(hashtable[date]) + 1).ToString();
}
else
{
hashtable.Add(date, "1");
}
}
myDataReader.Close();
}
catch (Exception e)
{
throw e;
}
finally
{
connection.Close();
}
return hashtable;
}
19
View Source File : StringInjectExtension.cs
License : MIT License
Project Creator : 0x0ade
License : MIT License
Project Creator : 0x0ade
private static Hashtable GetPropertyHash(object properties) {
Hashtable values = new();
if (properties != null) {
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(properties);
foreach (PropertyDescriptor? prop in props) {
if (prop == null)
continue;
values.Add(prop.Name, prop.GetValue(properties));
}
}
return values;
}
19
View Source File : ListObjectType.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : ObjectTypeUtil.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : ItemManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public Item CreateItem(ItemType type, Transform parent, params object[] datas)
{
Item item = handler.CreateItem(type, parent, datas);
if (ItemExist(type))
{
((List<Item>)items[type]).Add(item);
return item;
}
else
{
List<Item> itemList = new List<Item>();
itemList.Add(item);
items.Add(type, itemList);
return item;
}
}
19
View Source File : Manager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : NumericEventManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : ConfigManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void InitManager()
{
foreach (Type item in Manager.Instance.types.Values)
{
if (item.IsAbstract) continue;
ConfigAttribute[] configAttributes = (ConfigAttribute[])item.GetCustomAttributes(typeof(ConfigAttribute), false);
if (configAttributes.Length > 0)
{
Textreplacedet replacedet = replacedetManager.Instance.Loadreplacedet<Textreplacedet>(item.Name, ".bytes", false, true, replacedetType.Config);
object obj = ProtobufUtil.Deserialize(item, replacedet.bytes, 0, replacedet.bytes.Length);
configs.Add(item, obj);
}
}
}
19
View Source File : EventManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void InitManager()
{
foreach (Type item in Manager.Instance.types.Values)
{
if (item.IsAbstract) continue;
EventHandlerAttribute[] eventHandlerAttributes = (EventHandlerAttribute[])item.GetCustomAttributes(typeof(EventHandlerAttribute), false);
if (eventHandlerAttributes.Length > 0)
{
IEvent iEvent = (IEvent)Activator.CreateInstance(item);
events.Add(iEvent.EventType(), iEvent);
}
}
}
19
View Source File : UIEventManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void InitManager()
{
foreach (Type item in Manager.Instance.types.Values)
{
if (item.IsAbstract) continue;
UIEventHandlerAttribute[] uiEventHandlerAttributes = (UIEventHandlerAttribute[])item.GetCustomAttributes(typeof(UIEventHandlerAttribute), false);
if (uiEventHandlerAttributes.Length > 0)
{
UIEvent uiEvent = (UIEvent)Activator.CreateInstance(item);
uiEvents.Add(uiEventHandlerAttributes[0].uiEventType, uiEvent);
}
}
}
19
View Source File : ObjectBaseEventSystem.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void Register(AObjectBase aObjectBase)
{
aObjectBases.Add(aObjectBase.id, aObjectBase);
start.Enqueue(aObjectBase.id);
fixedUpdate.Enqueue(aObjectBase.id);
update.Enqueue(aObjectBase.id);
lateUpdate.Enqueue(aObjectBase.id);
}
19
View Source File : AudioManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public AudioClip LoadAudio(string audio)
{
AudioClip clip = replacedetManager.Instance.Loadreplacedet<AudioClip>(audio, ".mp3", false, true, replacedetType.Audio);
audios.Add(audio, clip);
return clip;
}
19
View Source File : AudioManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public AudioClip PlayAudio(string audio, bool isInside, AudioSource source)
{
if (AudioExist(audio))
{
AudioClip clip = GetAudioClip(audio);
source.clip = clip;
source.Play();
return clip;
}
if (isInside)
{
AudioClip temp = LoadAudio(audio);
source.clip = temp;
source.Play();
return temp;
}
else
{
LoadAudio(audio, AudioType.WAV, (AudioClip clip) =>
{
audios.Add(audio, clip);
source.clip = clip;
source.Play();
});
return null;
}
}
19
View Source File : LanguageManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : TipsManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public Tips CreateTips(string info, Vector2 localPosition, Vector2 offset, float duration, Transform parent = null)
{
Tips tips = tipsPool.Dequeue();
tips.InitTips(IdUtil.Generate(), info, localPosition, offset, duration, parent);
tipss.Add(tips.id, tips);
return tips;
}
19
View Source File : TipsWindowManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public TipsWindow CreateTipsWindow(string replacedle, string info, string confirm, string cancel, Transform parent = null)
{
TipsWindow tipsWindow = tipsWindowPool.Dequeue();
tipsWindow.InitTipsWindow(IdUtil.Generate(), true, replacedle, info, confirm, cancel, parent);
tipsWindows.Add(tipsWindow.id, tipsWindow);
return tipsWindow;
}
19
View Source File : AssetBundleManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 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
View Source File : ConfigManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void InitManager()
{
foreach (Type item in Manager.Instance.types.Values)
{
if (item.IsAbstract) continue;
ConfigAttribute[] configAttributes = (ConfigAttribute[])item.GetCustomAttributes(typeof(ConfigAttribute), false);
if (configAttributes.Length > 0)
{
Textreplacedet replacedet = replacedetManager.Instance.Loadreplacedet<Textreplacedet>(item.Name, ".bytes", false, false, replacedetType.Config);
object obj = ProtobufUtil.Deserialize(item, replacedet.bytes, 0, replacedet.bytes.Length);
configs.Add(item, obj);
}
}
}
19
View Source File : DownloadManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void DownloadTask()
{
lock (lockObject)
{
runnings.Add(Thread.CurrentThread, null);
}
while (true)
{
DownloadFile downloadFile = null;
lock (lockObject)
{
if (readyQueue.Count > 0)
{
downloadFile = readyQueue.Dequeue();
runnings[Thread.CurrentThread] = downloadFile;
}
}
if (downloadFile == null) break;
downloadFile.Download();
if (downloadFile.state == DownloadState.Complete)
{
lock (lockObject)
{
completeList.Add(downloadFile.downloadData);
runnings[Thread.CurrentThread] = null;
}
}
else if (downloadFile.state == DownloadState.Error)
{
lock (lockObject)
{
if (downloadFile.count == 5)
{
errorList.Add(downloadFile);
}
else
{
readyQueue.Enqueue(downloadFile);
}
}
break;
}
else
{
break;
}
}
}
19
View Source File : Manager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public void InitManager()
{
foreach (Type item in GetType().replacedembly.GetTypes())
{
if (!types.ContainsKey(item.Name))
{
types.Add(item.Name, item);
}
}
}
19
View Source File : PanelManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public Panel CreatePanel(PanelType type, params object[] datas)
{
Panel panel = handler.CreatePanel(type, datas);
panels.Add(type, panel);
return panel;
}
19
View Source File : VideoManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public VideoClip LoadVideo(string video)
{
VideoClip clip = replacedetManager.Instance.Loadreplacedet<VideoClip>(video, ".mp4", false, true, replacedetType.Video);
videos.Add(video, clip);
return clip;
}
19
View Source File : VoiceManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public AudioClip LoadAudio(string audio)
{
AudioClip clip = replacedetManager.Instance.Loadreplacedet<AudioClip>(audio, ".mp3", false, true, replacedetType.Audio);
voices.Add(audio, clip);
return clip;
}
19
View Source File : VoiceManager.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public AudioClip PlayAudio(string audio, bool isInside, AudioSource source)
{
if (AudioExist(audio))
{
AudioClip clip = GetAudioClip(audio);
source.clip = clip;
source.Play();
return clip;
}
if (isInside)
{
AudioClip temp = LoadAudio(audio);
source.clip = temp;
source.Play();
return temp;
}
else
{
LoadAudio(audio, AudioType.WAV, (AudioClip clip) =>
{
voices.Add(audio, clip);
source.clip = clip;
source.Play();
});
return null;
}
}
19
View Source File : AdColonyZone.cs
License : Apache License 2.0
Project Creator : AdColony
License : Apache License 2.0
Project Creator : AdColony
public string toJsonString()
{
Hashtable data = new Hashtable();
data.Add(Constants.ZoneIdentifierKey, Identifier);
data.Add(Constants.ZoneTypeKey, Convert.ToInt32(Type).ToString());
data.Add(Constants.ZoneEnabledKey, Enabled ? "1" : "0");
data.Add(Constants.ZoneRewardedKey, Rewarded ? "1" : "0");
data.Add(Constants.ZoneViewsPerRewardKey, ViewsPerReward.ToString());
data.Add(Constants.ZoneViewsUntilRewardKey, ViewsUntilReward.ToString());
data.Add(Constants.ZoneRewardAmountKey, RewardAmount.ToString());
data.Add(Constants.ZoneRewardNameKey, RewardName);
return AdColonyJson.Encode(data);
}
19
View Source File : Preferences.cs
License : GNU General Public License v2.0
Project Creator : afrantzis
License : GNU General Public License v2.0
Project Creator : afrantzis
public void Change(string pref, string val, string id)
{
if (enable == false)
return;
if (currentlyHandling.Contains(pref))
return;
if (id != "__Preferences__") {
prefs.SetWithoutNotify(pref, val);
}
if (!prefSubscribers.Contains(pref))
return;
currentlyHandling.Add(pref, null);
foreach(DictionaryEntry subscriber in (prefSubscribers[pref] as Hashtable))
if ((subscriber.Key as string) != id) {
(subscriber.Value as PreferencesChangedHandler)(prefs);
}
currentlyHandling.Remove(pref);
}
19
View Source File : Preferences.cs
License : GNU General Public License v2.0
Project Creator : afrantzis
License : GNU General Public License v2.0
Project Creator : afrantzis
public void NotifyAll()
{
if (enable == false)
return;
foreach(DictionaryEntry prefSub in prefSubscribers) {
currentlyHandling.Add(prefSub.Key, null);
foreach(DictionaryEntry subscriber in (prefSub.Value as Hashtable))
(subscriber.Value as PreferencesChangedHandler)(prefs);
currentlyHandling.Remove(prefSub.Key);
}
}
19
View Source File : Preferences.cs
License : GNU General Public License v2.0
Project Creator : afrantzis
License : GNU General Public License v2.0
Project Creator : afrantzis
public void Subscribe(string pref, string id, PreferencesChangedHandler handler)
{
if (!prefSubscribers.Contains(pref))
prefSubscribers[pref] = new Hashtable();
(prefSubscribers[pref] as Hashtable).Add(id, handler);
}
19
View Source File : HashTable.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy
License : Mozilla Public License 2.0
Project Creator : ahyahy
public void Add(object key, object value)
{
M_HashTable.Add(key, value);
System.Windows.Forms.Application.DoEvents();
}
19
View Source File : JSON.cs
License : MIT License
Project Creator : AlenToma
License : MIT License
Project Creator : AlenToma
private object RootHashTable(List<object> o)
{
Hashtable h = new Hashtable();
foreach (Dictionary<string, object> values in o)
{
object key = values["k"];
object val = values["v"];
if (key is Dictionary<string, object>)
key = ParseDictionary((Dictionary<string, object>)key, null, typeof(object), null);
if (val is Dictionary<string, object>)
val = ParseDictionary((Dictionary<string, object>)val, null, typeof(object), null);
h.Add(key, val);
}
return h;
}
19
View Source File : UPSProvider.cs
License : MIT License
Project Creator : alexeybusygin
License : MIT License
Project Creator : alexeybusygin
private void LoadServiceCodes()
{
_serviceCodes.Add("01", new AvailableService("UPS Next Day Air", 1));
_serviceCodes.Add("02", new AvailableService("UPS Second Day Air", 2));
_serviceCodes.Add("03", new AvailableService("UPS Ground", 4));
_serviceCodes.Add("07", new AvailableService("UPS Worldwide Express", 8));
_serviceCodes.Add("08", new AvailableService("UPS Worldwide Expedited", 16));
_serviceCodes.Add("11", new AvailableService("UPS Standard", 32));
_serviceCodes.Add("12", new AvailableService("UPS 3-Day Select", 64));
_serviceCodes.Add("13", new AvailableService("UPS Next Day Air Saver", 128));
_serviceCodes.Add("14", new AvailableService("UPS Next Day Air Early AM", 256));
_serviceCodes.Add("54", new AvailableService("UPS Worldwide Express Plus", 512));
_serviceCodes.Add("59", new AvailableService("UPS 2nd Day Air AM", 1024));
_serviceCodes.Add("65", new AvailableService("UPS Express Saver", 2048));
_serviceCodes.Add("93", new AvailableService("UPS Sure Post", 4096));
}
19
View Source File : PACServerHandle.cs
License : MIT License
Project Creator : AmazingDM
License : MIT License
Project Creator : AmazingDM
public static void InitPACServer(string address)
{
try
{
if (!pacList.ContainsKey(address))
{
pacList.Add(address, GetPacList(address));
}
string prefixes = string.Format("http://{0}:{1}/pac/", address, Global.Settings.Pac_Port);
HttpWebServer ws = new HttpWebServer(SendResponse, prefixes);
ws.Run();
if (!httpWebServer.ContainsKey(address) && ws != null)
{
httpWebServer.Add(address, ws);
}
Global.Settings.Pac_Url = GetPacUrl();
using var service = new ProxyService
{
AutoConfigUrl = Global.Settings.Pac_Url
};
service.Pac();
Logging.Info(service.Set(service.Query()) + "");
Logging.Info($"Webserver InitServer OK: {Global.Settings.Pac_Url}");
}
catch (Exception ex)
{
Logging.Error("Webserver InitServer " + ex.Message);
}
}
19
View Source File : PACServerHandle.cs
License : MIT License
Project Creator : AmazingDM
License : MIT License
Project Creator : AmazingDM
public static void InitPACServer(string address)
{
try
{
if (!pacList.ContainsKey(address))
{
pacList.Add(address, GetPacList(address));
}
string prefixes = string.Format("http://{0}:{1}/pac/", address, Global.Settings.Pac_Port);
HttpWebServer ws = new HttpWebServer(SendResponse, prefixes);
ws.Run();
if (!httpWebServer.ContainsKey(address) && ws != null)
{
httpWebServer.Add(address, ws);
}
Global.Settings.Pac_Url = GetPacUrl();
using var service = new ProxyService
{
AutoConfigUrl = Global.Settings.Pac_Url
};
service.Pac();
Logging.Info(service.Set(service.Query()) + "");
Logging.Info($"Webserver InitServer OK: {Global.Settings.Pac_Url}");
}
catch (Exception ex)
{
Logging.Error("Webserver InitServer " + ex.Message);
}
}
19
View Source File : DNS.cs
License : MIT License
Project Creator : AmazingDM
License : MIT License
Project Creator : AmazingDM
public static IPAddress Lookup(string hostname)
{
try
{
if (Cache.Contains(hostname))
{
return Cache[hostname] as IPAddress;
}
var task = Dns.GetHostAddressesAsync(hostname);
if (!task.Wait(1000))
{
return null;
}
if (task.Result.Length == 0)
{
return null;
}
Cache.Add(hostname, task.Result[0]);
return task.Result[0];
}
catch (Exception)
{
return null;
}
}
19
View Source File : i18N.cs
License : MIT License
Project Creator : AmazingDM
License : MIT License
Project Creator : AmazingDM
public static void Load(string langCode)
{
LangCode = langCode;
var text = "";
if (langCode.Equals("System"))
{
// 加载系统语言
langCode = CultureInfo.CurrentCulture.Name;
}
if (langCode == "zh-CN")
{
// 尝试加载内置中文语言
text = Encoding.UTF8.GetString(Resources.zh_CN);
}
else if (langCode.Equals("en-US"))
{
// 清除得到英文
Data.Clear();
return;
}
else if (File.Exists($"i18n\\{langCode}"))
{
// 从外置文件中加载语言
text = File.ReadAllText($"i18n\\{langCode}");
}
else
{
Logging.Error($"无法找到语言 {langCode}, 使用系统语言");
// 加载系统语言
LangCode = CultureInfo.CurrentCulture.Name;
}
var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(text);
if (data == null) return;
Data = new Hashtable();
foreach (var v in data)
{
Data.Add(v.Key, v.Value);
}
}
19
View Source File : SccProjectMap.cs
License : Apache License 2.0
Project Creator : AmpScm
License : Apache License 2.0
Project Creator : AmpScm
public IEnumerable<SccProject> GetAllProjectsContaining(IEnumerable<string> paths)
{
if (paths == null)
throw new ArgumentNullException("paths");
Hashtable projects = new Hashtable();
foreach (string path in paths)
{
string nPath = SvnTools.GetNormalizedFullPath(path);
SccProjectFile file;
if (TryGetFile(nPath, out file))
{
foreach (SccProjectData pd in file.GetOwnerProjects())
{
if (projects.Contains(pd))
continue;
projects.Add(pd, pd);
yield return pd.SvnProject;
}
}
if (!projects.Contains(SccProject.Solution)
&& string.Equals(path, SolutionFilename, StringComparison.OrdinalIgnoreCase))
{
projects.Add(SccProject.Solution, SccProject.Solution);
yield return SccProject.Solution;
}
}
}
19
View Source File : SccProjectMap.cs
License : Apache License 2.0
Project Creator : AmpScm
License : Apache License 2.0
Project Creator : AmpScm
public IEnumerable<string> GetAllFilesOf(ICollection<SccProject> projects, bool exceptExcluded)
{
SortedList<string, string> files = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);
Hashtable handled = new Hashtable();
foreach (SccProject p in projects)
{
SccProject project = ResolveRawProject(p);
IVsSccProject2 scc = project.RawHandle;
SccProjectData data;
if (scc == null || !TryGetSccProject(scc, out data))
{
if (p.IsSolution && SolutionFilename != null && !files.ContainsKey(SolutionFilename))
{
files.Add(SolutionFilename, SolutionFilename);
if (exceptExcluded && IsSccExcluded(SolutionFilename))
continue;
yield return SolutionFilename;
}
continue;
}
if (handled.Contains(data))
continue;
handled.Add(data, data);
foreach (string file in data.GetAllFiles())
{
if (file[file.Length - 1] == '\\') // Don't return paths
continue;
if (files.ContainsKey(file))
continue;
files.Add(file, file);
if (exceptExcluded && IsSccExcluded(file))
continue;
yield return file;
}
}
}
19
View Source File : VersionResolverService.cs
License : Apache License 2.0
Project Creator : AmpScm
License : Apache License 2.0
Project Creator : AmpScm
public IEnumerable<AnkhRevisionType> GetRevisionTypes(Ankh.Scc.SvnOrigin origin)
{
Hashtable ht = new Hashtable();
foreach (IAnkhRevisionProvider p in _providers)
{
foreach (AnkhRevisionType rt in p.GetRevisionTypes(origin))
{
if (!ht.Contains(rt))
yield return rt;
ht.Add(rt, rt.UniqueName);
}
}
}
19
View Source File : SelectionContext.cs
License : Apache License 2.0
Project Creator : AmpScm
License : Apache License 2.0
Project Creator : AmpScm
protected IEnumerable<SccProject> InternalGetOwnerProjects()
{
Hashtable ht = new Hashtable();
bool searchedProjectMapper = false;
IProjectFileMapper projectMapper = null;
foreach (SelectionItem si in GetSelectedItems(false))
{
if (ht.Contains(si.Hierarchy))
continue;
ht.Add(si.Hierarchy, si);
if (si.SccProject != null)
{
yield return new SccProject(null, si.SccProject);
continue;
}
else if (si.Hierarchy is IVsSccVirtualFolders)
continue; // Skip URL WebApplications fast
string[] files;
// No need to fetch special files as we only want projects!
if (!SelectionUtils.GetSccFiles(si, out files, false, false, null) || files.Length == 0)
continue; // No files selected
if (projectMapper == null && !searchedProjectMapper)
{
searchedProjectMapper = true;
projectMapper = GetService<IProjectFileMapper>();
}
if (projectMapper != null)
foreach (string file in files)
{
foreach (SccProject project in projectMapper.GetAllProjectsContaining(file))
{
if (project.RawHandle != null)
{
if (ht.Contains(project.RawHandle))
continue;
ht.Add(project.RawHandle, si);
yield return project;
}
else if (!ht.Contains(project))
{
ht.Add(project, si);
yield return project;
}
}
}
}
}
19
View Source File : RandomHelper.cs
License : MIT License
Project Creator : AnotherEnd15
License : MIT License
Project Creator : AnotherEnd15
public static int[] GetRandoms(int sum, int min, int max)
{
int[] arr = new int[sum];
int j = 0;
//表示键和值对的集合。
Hashtable hashtable = new Hashtable();
Random rm = random;
while (hashtable.Count < sum) {
//返回一个min到max之间的随机数
int nValue = rm.Next(min, max);
// 是否包含特定值
if (!hashtable.ContainsValue(nValue))
{
//把键和值添加到hashtable
hashtable.Add(nValue, nValue);
arr[j] = nValue;
j++;
}
}
return arr;
}
19
View Source File : PrimitiveMapTest.cs
License : Apache License 2.0
Project Creator : apache
License : Apache License 2.0
Project Creator : apache
protected static IDictionary CreateDictionary()
{
Hashtable answer = new Hashtable();
answer.Add("Name", "James");
answer.Add("Location", "London");
answer.Add("Company", "LogicBlaze");
Hashtable childMap = new Hashtable();
childMap.Add("name", "childMap");
answer.Add("childMap", childMap);
ArrayList childList = new ArrayList();
childList.Add("childListElement1");
answer.Add("childList", childList);
return answer;
}
19
View Source File : LevelMapping.cs
License : Apache License 2.0
Project Creator : apache
License : Apache License 2.0
Project Creator : apache
public void Add(LevelMappingEntry entry)
{
if (m_entriesMap.ContainsKey(entry.Level))
{
m_entriesMap.Remove(entry.Level);
}
m_entriesMap.Add(entry.Level, entry);
}
19
View Source File : MinerBase.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
public void InitializePrograms()
{
try
{
DB db = Factory.Instance.Model.Data;
MinerAlgo algo = null;
foreach (MinerAlgo item in db.MinerAlgos)
{
if (item.Name == MainCoin.Algorithm.Name)
{
//found the algo. check to see alredy configured miners
algo = item;
break;
}
}
if (algo != null)
{
List<MinerProgram> programs = algo.MinerPrograms;
//if (programs != null && programs.Count > 0)
//{
//at least 1 program is there
Hashtable progs = new Hashtable();
Hashtable scripts = new Hashtable();
foreach (MinerProgram item in programs)
{
progs.Add(item.ProgramType, item);
}
foreach (MinerScript item in MinerData.MinerScripts)
{
scripts.Add(item.ProgramType, item);
}
foreach (IMinerProgram item in MinerPrograms)
{
MinerProgram p = progs[item.Type] as MinerProgram;
MinerScript scr = scripts[item.Type] as MinerScript;
if (p != null)
{
item.MinerEXE = p.Exepath;
item.MinerFolder = p.ExeFolder;
}
if (scr != null)
{
item.BATFILE = scr.BATfile;
item.BATCopied = scr.BATCopied;
item.AutomaticScriptGeneration = scr.AutomaticScriptGeneration;
item.LoadScript();
}
}
//}
}
}
catch (Exception)
{
}
}
19
View Source File : MinerInfoLogs.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
private void MinerInfoLogs_Load(object sender, EventArgs e)
{
List<IMinerProgram> programs = Miner.MinerPrograms;
Button leftbutton = btnTemplate;
int i = 0;
foreach (IMinerProgram item in programs)
{
Button btn = new Button();
btn.Top = 10;
btn.Name = "button" + i.ToString();
btn.Click += btn_Click;
btn.Text = item.Type;
btn.Left = leftbutton.Left + btnTemplate.Width;
btn.FlatStyle = FlatStyle.Popup;
btn.BackColor = Color.LightSteelBlue;
btn.ForeColor = Color.Black;
if (m_currentButton == null)
m_currentButton = btn;
leftbutton = btn;
this.Controls.Add(btn);
m_tabButtons.Add(btn);
i++;
m_ButtonToMiner.Add(btn.Name, item);
}
m_currentButton.BackColor = Color.SteelBlue;
m_currentButton.ForeColor = Color.White;
UpdateUI();
}
19
View Source File : MinerInfoScript.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
private void MinerInfoScript_Load(object sender, EventArgs e)
{
List<IMinerProgram> programs = Miner.MinerPrograms;
Button leftbutton = btnTemplate;
int i=0;
foreach (IMinerProgram item in programs)
{
Button btn = new Button();
btn.Top = 10;
btn.Name = "button"+i.ToString();
btn.Click += btn_Click;
btn.Text = item.Type;
btn.Left = leftbutton.Left + btnTemplate.Width;
btn.FlatStyle = FlatStyle.Popup;
btn.BackColor = Color.LightSteelBlue;
btn.ForeColor = Color.Black;
if (m_currentButton == null)
m_currentButton = btn;
leftbutton = btn;
this.Controls.Add(btn);
m_tabButtons.Add(btn);
i++;
m_ButtonToMiner.Add(btn.Name, item);
}
m_currentButton.BackColor = Color.SteelBlue;
m_currentButton.ForeColor = Color.White;
UpdateUI();
AddCheckboxes();
}
19
View Source File : MinerInfoScript.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
public void AddCheckboxes()
{
CheckBox leftCheckBox = chkTemplate;
int i = 0;
foreach (IMinerProgram item in Miner.MinerPrograms)
{
CheckBox chkBox = new CheckBox();
chkBox.Top = 10;
chkBox.Name = "chkBox" + i.ToString();
chkBox.Click += chkBox_Click;
chkBox.AutoSize = true;
chkBox.Text = item.Type;
chkBox.Left = leftCheckBox.Left + leftCheckBox.Width;
chkBox.Checked = item.Enabled;
//chkBox.FlatStyle = FlatStyle.Popup;
//chkBox.BackColor = Color.LightSteelBlue;
//chkBox.ForeColor = Color.Black;
leftCheckBox = chkBox;
this.Controls.Add(chkBox);
i++;
m_CheckBoxToMiner.Add(chkBox.Name, item);
}
}
See More Examples