private static int Main(string[] args) { try { Console.OutputEncoding = Encoding.Unicode; ProcessCommandlineArguments(args); switch (_queryType) { case QueryType.Uninstall: UpdateManager.UninstallUpdate(_updateId); break; case QueryType.List: UpdateManager.WriteUpdateList(); break; } } catch (OperationCanceledException) { return(1223); } catch (COMException ex) { Console.WriteLine("Error: {0}", Hresult.ConvertHresultToDetails(ex.ErrorCode)); return(59); } catch (Exception ex) { Console.WriteLine("Error: {0}", ex.Message); return(59); } return(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); }