Beispiel #1
0
        private static int Main(string[] args)
        {
            try
            {
                try { Console.OutputEncoding = Encoding.Unicode; }
                catch (IOException) { /*Old .NET v4 without support for unicode output*/ }

                ProcessCommandlineArguments(args);

                switch (_queryType)
                {
                case QueryType.Uninstall:
                    UpdateManager.UninstallUpdate(_updateId);
                    break;

                case QueryType.List:
                    UpdateManager.WriteUpdateList();
                    break;
                }
            }
            catch (OperationCanceledException)
            {
                return((int)ReturnValue.CancelledByUserCode);
            }
            catch (COMException ex)
            {
                LogWriter.WriteMessageToLog(ex.ToString());
                Console.WriteLine("Error: {0}", Hresult.ConvertHresultToDetails(ex.ErrorCode));
                return((int)ReturnValue.UnexpectedNetworkErrorCode);
            }
            catch (Exception ex)
            {
                LogWriter.WriteMessageToLog(ex.ToString());
                Console.WriteLine("Error: {0}", ex.Message);
                return((int)ReturnValue.UnexpectedNetworkErrorCode);
            }
            return((int)ReturnValue.OkCode);
        }