Exemple #1
0
 private static bool LoadWinds(Dictionary <int, WindInfo> Winds)
 {
     int[] windID = WindMgr.WindID;
     for (int i = 0; i < windID.Length; i++)
     {
         int      num      = windID[i];
         WindInfo windInfo = new WindInfo();
         byte[]   array    = WindMgr.CreateVane(WindMgr.fontWind[num]);
         if (array == null || array.Length <= 0)
         {
             if (WindMgr.log.IsErrorEnabled)
             {
                 WindMgr.log.Error("Load Wind Error!");
             }
             return(false);
         }
         windInfo.WindID  = num;
         windInfo.WindPic = array;
         if (!Winds.ContainsKey(num))
         {
             Winds.Add(num, windInfo);
         }
     }
     return(true);
 }
Exemple #2
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <int, WindInfo> winds = new Dictionary <int, WindInfo>();
         if (WindMgr.LoadWinds(winds))
         {
             WindMgr.m_lock.AcquireWriterLock(-1);
             try
             {
                 WindMgr._winds = winds;
                 return(true);
             }
             catch
             {
             }
             finally
             {
                 WindMgr.m_lock.ReleaseWriterLock();
             }
         }
     }
     catch (Exception exception)
     {
         if (WindMgr.log.IsErrorEnabled)
         {
             WindMgr.log.Error("WindMgr", exception);
         }
     }
     return(false);
 }
Exemple #3
0
        public static bool Init()
        {
            bool result;

            try
            {
                WindMgr.m_lock = new ReaderWriterLock();
                WindMgr._winds = new Dictionary <int, WindInfo>();
                WindMgr.rand   = new ThreadSafeRandom();
                result         = WindMgr.LoadWinds(WindMgr._winds);
            }
            catch (Exception exception)
            {
                if (WindMgr.log.IsErrorEnabled)
                {
                    WindMgr.log.Error("WindInfoMgr", exception);
                }
                result = false;
            }
            return(result);
        }