示例#1
0
        private static void Main()
        {
            CultureInfo.DefaultThreadCurrentCulture   = GlobalCultureInfo;
            CultureInfo.DefaultThreadCurrentUICulture = GlobalCultureInfo;
            Thread.CurrentThread.Name = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
            ServicePointManager.DefaultConnectionLimit = 65535;


            ThreadPool.SetMinThreads(65535, 100);
            ThreadPool.SetMaxThreads(65535, 100);


#if DEBUG
            Log.InitializeLog(); // Initialization of log system.
            Log.AutoWriteLog();  // Start the automatic write of log lines.
#endif
            AppDomain.CurrentDomain.UnhandledException += Application_ThreadException;

            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

#if WINDOWS
            ClassMemory.CleanMemory();
#endif

            ClassTranslation.InitializationLanguage(); // Initialization of language system.
            ClassContact.InitializationContactList();  // Initialization of contact system.
            ClassPeerList.LoadPeerList();
#if WINDOWS
            Application.EnableVisualStyles();
#endif
            Application.SetCompatibleTextRenderingDefault(false);
            WalletXiropht = new WalletXiropht();
            Application.Run(WalletXiropht); // Start the main interface.
        }
示例#2
0
        static void Main()
        {
            Thread.CurrentThread.Name = Path.GetFileName(Environment.GetCommandLineArgs()[0]);

#if DEBUG
            Log.InitializeLog(); // Initialization of log system.
            Log.AutoWriteLog();  // Start the automatic write of log lines.
#endif
            AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs args)
            {
                var filePath  = ClassUtility.ConvertPath(System.AppDomain.CurrentDomain.BaseDirectory + "\\error_wallet.txt");
                var exception = (Exception)args.ExceptionObject;
                using (var writer = new StreamWriter(filePath, true))
                {
                    writer.WriteLine("Message :" + exception.Message + "<br/>" + Environment.NewLine +
                                     "StackTrace :" +
                                     exception.StackTrace +
                                     "" + Environment.NewLine + "Date :" + DateTime.Now);
                    writer.WriteLine(Environment.NewLine +
                                     "-----------------------------------------------------------------------------" +
                                     Environment.NewLine);
                }

                MessageBox.Show(
                    @"An error has been detected, send the file error_wallet.txt to the Team for fix the issue.");
                System.Diagnostics.Trace.TraceError(exception.StackTrace);

                Environment.Exit(1);
            };
#if WINDOWS
            ClassMemory.CleanMemory();
#endif

            bool firstStart = ClassWalletSetting.LoadSetting(); // Load the setting file.
            ClassTranslation.InitializationLanguage();          // Initialization of language system.
            ClassContact.InitializationContactList();           // Initialization of contact system.
#if WINDOWS
            Application.EnableVisualStyles();
#endif
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new WalletXiropht(firstStart)); // Start the main interface.
        }