короче та срань має дивитись якшо пів години небуло ніяких дій то перегрузити прогу.... а він деколи злітає
Код
internal static class Program
{
// Fields
public static CookieContainer _cookies = new CookieContainer();
public static bool is_restart = false;
public static DateTime m_lastActive = DateTime.Now;
private static readonly Timer m_manageTimer = new Timer();
public static Cache myCache;
public static ClientProxy proxy;
private static Settings set = new Settings();
// Methods
private static void DoReload(object source, ElapsedEventArgs e)
{
if (!(((DateTime.Compare(m_lastActive, DateTime.Now.AddSeconds(-1800.0)) >= 0) || (!set.AutoFight && !set.Fishing)) || set.Travma))
{
Application.Exit();
Process.Start(Application.ExecutablePath);
}
}
[STAThread]
private static void Main()
{
try
{
bool flag;
string name = @"Local\" + Assembly.GetExecutingAssembly().GetName().Name;
Mutex mutex = new Mutex(true, name, out flag);
if (!is_restart && !flag)
{
MessageBox.Show("Клиент уже запущен. Вы неможете запустить больше одной копии клиента.");
}
else
{
is_restart = true;
if (set.usecache)
{
myCache = new Cache();
proxy = new ClientProxy();
proxy.StartProxy();
}
m_manageTimer.Elapsed += new ElapsedEventHandler(Program.DoReload);
m_manageTimer.Interval = 300000.0;
m_manageTimer.Enabled = true;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Client());
if (proxy != null)
{
proxy.StopProxy();
}
GC.KeepAlive(mutex);
}
}
catch (Exception exception)
{
ShowEror(exception);
}
}
private static void ShowEror(Exception ex)
{
MessageBox.Show("Сообшите мне об етой ошибке\r\n" + ex.Message + " \r\n" + ex.Source + " \r\n" + ex.StackTrace);
}
public static void StartProxy()
{
}
}
{
// Fields
public static CookieContainer _cookies = new CookieContainer();
public static bool is_restart = false;
public static DateTime m_lastActive = DateTime.Now;
private static readonly Timer m_manageTimer = new Timer();
public static Cache myCache;
public static ClientProxy proxy;
private static Settings set = new Settings();
// Methods
private static void DoReload(object source, ElapsedEventArgs e)
{
if (!(((DateTime.Compare(m_lastActive, DateTime.Now.AddSeconds(-1800.0)) >= 0) || (!set.AutoFight && !set.Fishing)) || set.Travma))
{
Application.Exit();
Process.Start(Application.ExecutablePath);
}
}
[STAThread]
private static void Main()
{
try
{
bool flag;
string name = @"Local\" + Assembly.GetExecutingAssembly().GetName().Name;
Mutex mutex = new Mutex(true, name, out flag);
if (!is_restart && !flag)
{
MessageBox.Show("Клиент уже запущен. Вы неможете запустить больше одной копии клиента.");
}
else
{
is_restart = true;
if (set.usecache)
{
myCache = new Cache();
proxy = new ClientProxy();
proxy.StartProxy();
}
m_manageTimer.Elapsed += new ElapsedEventHandler(Program.DoReload);
m_manageTimer.Interval = 300000.0;
m_manageTimer.Enabled = true;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Client());
if (proxy != null)
{
proxy.StopProxy();
}
GC.KeepAlive(mutex);
}
}
catch (Exception exception)
{
ShowEror(exception);
}
}
private static void ShowEror(Exception ex)
{
MessageBox.Show("Сообшите мне об етой ошибке\r\n" + ex.Message + " \r\n" + ex.Source + " \r\n" + ex.StackTrace);
}
public static void StartProxy()
{
}
}