private static void OnTimeEvent(object source, ElapsedEventArgs e) { Dictionary <int, int> tempDic = new Dictionary <int, int>(); MacroDropMgr.m_lock.AcquireWriterLock(-1); try { foreach (KeyValuePair <int, MacroDropInfo> kvp in DropInfoMgr.DropInfo) { int templateId = kvp.Key; MacroDropInfo macroDropInfo = kvp.Value; if (macroDropInfo.SelfDropCount > 0) { tempDic.Add(templateId, macroDropInfo.SelfDropCount); macroDropInfo.SelfDropCount = 0; } } } catch (Exception ex) { //if (MacroDropMgr.log.IsErrorEnabled) { MacroDropMgr.log.Error("DropInfoMgr OnTimeEvent", ex); } } finally { MacroDropMgr.m_lock.ReleaseWriterLock(); } MacroDropMgr.SendMacroDrop(tempDic); }
public static bool Init() { MacroDropMgr.m_lock = new ReaderWriterLock(); return(MacroDropMgr.ReLoad()); }