HandleException() public static method

Displays exception information. Should be called from try...catch handlers
public static HandleException ( Exception ex ) : void
ex System.Exception Exception object to handle
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Main program function
        /// </summary>
        private void UpdateAwb()
        {
            try
            {
                _proxy = WebRequest.GetSystemWebProxy();

                if (_proxy.IsBypassed(new Uri("https://en.wikipedia.org")))
                {
                    _proxy = null;
                }

                UpdateUI("Getting current AWB and Updater versions", true);
                AWBVersion();

                if ((!_updaterUpdate && !_awbUpdate) && string.IsNullOrEmpty(_awbWebAddress))
                {
                    ExitEarly();
                    return;
                }
                UpdateUI("Creating a temporary directory", true);
                CreateTempDir();

                UpdateUI("Downloading AWB", true);
                GetAwbFromInternet();

                UpdateUI("Unzipping AWB to the temporary directory", true);
                UnzipAwb();

                UpdateUI("Making sure AWB is closed", true);
                CloseAwb();

                UpdateUI("Copying AWB files from temp to AWB directory...", true);
                CopyFiles();
                UpdateUI("Update successful", true);

                UpdateUI("Cleaning up from update", true);
                KillTempDir();

                UpdateUI("Update finished. You may close this window (AWB Updater) now.", true);
                _updateSucessful = true;
                ReadyToExit();
            }
            catch (AbortException)
            {
                ReadyToExit();
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Code used to unzip the zip files to the temporary directory
 /// </summary>
 /// <param name="file"></param>
 private void Extract(string file)
 {
     try
     {
         new FastZip().ExtractZip(file, _tempDirectory, null);
     }
     catch (ZipException)
     {
         UpdateUI(Path.GetFileName(file) + " seems to be corrupt. Deleting the zip.", true);
         UpdateUI("Please confirm that sourceforge is up.", true);
         DeleteAbsoluteIfExists(file);
         throw new AbortException();
     }
     catch (Exception ex)
     {
         ErrorHandler.HandleException(ex);
         Application.Exit();
     }
 }