Ejemplo n.º 1
0
 private static void StatReset()
 {
     try
     {
         LockStat.AcquireWriterLock(5000);
         try
         {
             AppVars.Profile.Stat.LastReset     = DateTime.Now.Ticks;
             AppVars.Profile.Stat.LastUpdateDay = DateTime.Now.DayOfYear;
             AppVars.Profile.Stat.Traffic       = 0;
             AppVars.Profile.Stat.SavedTraffic  = 0;
             AppVars.Profile.Stat.Drop          = string.Empty;
             AppVars.Profile.Stat.ItemDrop.Clear();
             AppVars.Profile.Stat.XP     = 0;
             AppVars.Profile.Stat.NV     = 0;
             AppVars.Profile.Stat.FishNV = 0;
         }
         finally
         {
             LockStat.ReleaseWriterLock();
         }
     }
     catch (ApplicationException)
     {
     }
 }
Ejemplo n.º 2
0
        internal void UpdateSavedTrafficSafe(int addSavedTraffic)
        {
            if (InvokeRequired)
            {
                BeginInvoke((MethodInvoker)(() => UpdateSavedTrafficSafe(addSavedTraffic)));
                return;
            }

            try
            {
                LockStat.AcquireWriterLock(5000);
                try
                {
                    AppVars.Profile.Stat.SavedTraffic += addSavedTraffic;
                }
                finally
                {
                    LockStat.ReleaseWriterLock();
                }
            }
            catch (ApplicationException)
            {
            }

            menuitemStatItem1.Text = string.Concat("Сэкономлено трафика: ", TraficToString(AppVars.Profile.Stat.SavedTraffic));
            UpdateStatString();
        }