Exemple #1
0
        public MainForm()
        {
            InitializeComponent();

            SetLocaleEnglish();

            ///////////////////////
            // Keep this at the top:
            SetupDirectories();
            GlobalProps = new GlobalProperties( this );
            ///////////////////////

            CryptoRand = new RNGCryptoServiceProvider();

            NetStats = new NetIPStatus( this );
            NetStats.ReadFromFile();

            FactorDictionary1 = new FactorDictionary( this );

            LaPlataData1 = new LaPlataData( this );
            WebFData = new WebFilesData( this );
            X509Data = new DomainX509Data( this, GetDataDirectory() + "Certificates.txt" );

            if( !CheckSingleInstance())
              return;

            IsSingleInstance = true;

            WebListenForm = new WebListenerForm( this );
            TLSListenForm = new TLSListenerForm( this );
            CustomerMsgForm = new CustomerMessageForm( this );
            QuadResForm = new QuadResSearchForm( this );

            CheckTimer.Interval = 5 * 60 * 1000;
            CheckTimer.Start();

            StartTimer.Interval = 1000;
            StartTimer.Start();
        }
Exemple #2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if( IsSingleInstance )
              {
              if( DialogResult.Yes != MessageBox.Show( "Close the program?", MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question ))
            {
            e.Cancel = true;
            return;
            }
              }

            IsClosing = true;
            CheckTimer.Stop();

            X509Data.WriteToTextFile();
            NetStats.SaveToFile();

            if( WebListenForm != null )
              {
              if( !WebListenForm.IsDisposed )
            {
            WebListenForm.Hide();

            // This could take a while since it's closing connections:
            WebListenForm.FreeEverythingAndStopServer();
            WebListenForm.Dispose();
            }

              WebListenForm = null;
              }

            if( TLSListenForm != null )
              {
              if( !TLSListenForm.IsDisposed )
            {
            TLSListenForm.Hide();

            // This could take a while since it's closing connections:
            TLSListenForm.FreeEverythingAndStopServer();
            TLSListenForm.Dispose();
            }

              TLSListenForm = null;
              }

            if( CustomerMsgForm != null )
              {
              if( !CustomerMsgForm.IsDisposed )
            {
            CustomerMsgForm.Hide();

            CustomerMsgForm.FreeEverything();
            CustomerMsgForm.Dispose();
            }

              CustomerMsgForm = null;
              }

            /*
            if( MakeKeysForm != null )
              {
              if( !MakeKeysForm.IsDisposed )
            {
            MakeKeysForm.Hide();

            // This could take a while:
            MakeKeysForm.FreeEverything();
            MakeKeysForm.Dispose();
            }

              MakeKeysForm = null;
              }
              */

            if( QuadResForm != null )
              {
              if( !QuadResForm.IsDisposed )
            {
            QuadResForm.Hide();

            // This could take a while:
            QuadResForm.FreeEverything();
            QuadResForm.Dispose();
            }

              QuadResForm = null;
              }
        }