public Main(bool debugging) { InitializeComponent(); CheckForUpdates(); TanjiSettings.Load(); _game = new HConnection(); _game.Connected += Game_Connected; _game.DataToClient += Game_DataToClient; _game.DataToServer += Game_DataToServer; _packetlogger = new Packetlogger(); _tanjiConnect = new TanjiConnect(this); _inBlockedHeaders = new List <ushort>(); _inReplacedHeaders = new List <ushort>(); _outBlockedHeaders = new List <ushort>(); _outReplacedHeaders = new List <ushort>(); OSAlwaysOnTopChckbx.Checked = TanjiSettings.Global.IsAlwaysOnTop; OSCloseOnDisconnectChckbx.Checked = TanjiSettings.Global.ShouldCloseOnDisconnect; _initiate = Initiate; _reinitiate = Reinitiate; _debugging = debugging; ISDestinationTxt.SelectedIndex = 1; IFBDestinationTxt.SelectedIndex = 1; IFRDestinationTxt.SelectedIndex = 1; }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { TanjiSettings.Save(); if (!_debugging) { e.Cancel = true; Task.Factory.StartNew(Game.Disconnect); } }
private void Game_Disconnected(object sender, EventArgs e) { _game.Disconnected -= Game_Disconnected; if (TanjiSettings.Global.ShouldCloseOnDisconnect) { TanjiSettings.Save(); Environment.Exit(0); } Task.Factory.StartNew(Reinitiate); }
private void TanjiConnect_FormClosing(object sender, FormClosingEventArgs e) { TanjiSettings.Save(); if (!_main.Game.IsConnected) { FiddlerApplication.Shutdown(); _main.Game.Dispose(); Environment.Exit(0); } ResetSetup(); }