WGet.NET 4.4.1
A WinGet wrapper library for .Net.
Loading...
Searching...
No Matches
WinGetResult.cs
1//--------------------------------------------------//
2// Created by basicx-StrgV //
3// https://github.com/basicx-StrgV/ //
4//--------------------------------------------------//
5using System;
7
8namespace WGetNET
9{
13 public sealed class WinGetResult : IWinGetObject
14 {
18 public int ExitCode
19 {
20 get
21 {
22 if (_processResult != null)
23 {
24 return _processResult.ExitCode;
25 }
26 else
27 {
28 return -1;
29 }
30 }
31 }
32
39 public string[] Output
40 {
41 get
42 {
43 if (_processResult != null)
44 {
45 return _processResult.Output;
46 }
47 else
48 {
49 return Array.Empty<string>();
50 }
51 }
52 }
53
57 public bool Success
58 {
59 get
60 {
61 if (_processResult != null)
62 {
63 return _processResult.Success;
64 }
65 else
66 {
67 return false;
68 }
69 }
70 }
71
75 public string ExecutedCmd
76 {
77 get
78 {
79 if (_arguments != null)
80 {
81 return $"winget {_arguments.ToString()}";
82 }
83 else
84 {
85 return string.Empty;
86 }
87 }
88 }
89
91 public bool IsEmpty
92 {
93 get
94 {
95 return (_processResult == null);
96 }
97 }
98
99 private readonly ProcessResult? _processResult = null;
100 private readonly WinGetArguments? _arguments = null;
101
111 internal WinGetResult(ProcessResult processResult, WinGetArguments? arguments)
112 {
113 _processResult = processResult;
114 _arguments = arguments;
115 }
116 }
117}
Represents a winget arguments string for different winget actions.
Represents a winget execution result.
bool Success
Gets if the process finished successfully.
string[] Output
Gets the output of the process as a System.String array.
string ExecutedCmd
Gets the cmd that was executed.
bool IsEmpty
Gets if the object is empty.
int ExitCode
Gets the exit code of the process.
Interface for all winget related objects.