wasSharpNET – Diff between revs 22 and 27
?pathlinks?
Rev 22 | Rev 27 | |||
---|---|---|---|---|
Line 12... | Line 12... | |||
12 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
12 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
|
13 | { |
13 | { |
|
14 | public class URLACL |
14 | public class URLACL |
|
15 | { |
15 | { |
|
16 | private readonly string domain; |
16 | private readonly string domain; |
|
- | 17 | private readonly int timeout; |
||
17 | private readonly string URL; |
18 | private readonly string URL; |
|
Line 18... | Line 19... | |||
18 | |
19 | |
|
19 | private readonly Regex URLReservationRegex; |
20 | private readonly Regex URLReservationRegex; |
|
20 | private readonly string username; |
- | ||
Line 21... | Line 21... | |||
21 | private readonly int timeout; |
21 | private readonly string username; |
|
22 | |
22 | |
|
23 | public URLACL(string URL, string username, string domain, int timeout) |
23 | public URLACL(string URL, string username, string domain, int timeout) |
|
24 | { |
24 | { |
|
Line 51... | Line 51... | |||
51 | }; |
51 | }; |
|
Line 52... | Line 52... | |||
52 | |
52 | |
|
53 | checkProcess.OutputDataReceived += (sender, output) => |
53 | checkProcess.OutputDataReceived += (sender, output) => |
|
54 | { |
54 | { |
|
55 | if (output?.Data != null) |
- | ||
56 | { |
55 | if (output?.Data != null) |
|
57 | netSHOutput.Append(output.Data); |
- | ||
58 | } |
56 | netSHOutput.Append(output.Data); |
|
Line 59... | Line 57... | |||
59 | }; |
57 | }; |
|
60 | |
58 | |
|
61 | checkProcess.Start(); |
59 | checkProcess.Start(); |
|
Line 82... | Line 80... | |||
82 | } |
80 | } |
|
83 | catch (Win32Exception ex) |
81 | catch (Win32Exception ex) |
|
84 | { |
82 | { |
|
85 | // User cancelled the UAC elevation prompt. |
83 | // User cancelled the UAC elevation prompt. |
|
86 | if (ex.NativeErrorCode == 1223) |
84 | if (ex.NativeErrorCode == 1223) |
|
87 | { |
- | ||
88 | return false; |
85 | return false; |
|
89 | } |
- | ||
90 | } |
86 | } |
|
Line 91... | Line 87... | |||
91 | |
87 | |
|
92 | if (process == null) |
88 | if (process == null) |
|
Line 111... | Line 107... | |||
111 | } |
107 | } |
|
112 | catch (Win32Exception ex) |
108 | catch (Win32Exception ex) |
|
113 | { |
109 | { |
|
114 | // User cancelled the UAC elevation prompt. |
110 | // User cancelled the UAC elevation prompt. |
|
115 | if (ex.NativeErrorCode == 1223) |
111 | if (ex.NativeErrorCode == 1223) |
|
116 | { |
- | ||
117 | return false; |
112 | return false; |
|
118 | } |
- | ||
119 | } |
113 | } |
|
Line 120... | Line 114... | |||
120 | |
114 | |
|
121 | if (process == null) |
115 | if (process == null) |
|
Line 122... | Line 116... | |||
122 | return false; |
116 | return false; |
|
123 | |
117 | |
|
124 | return process.WaitForExit(timeout); |
118 | return process.WaitForExit(timeout); |
|
125 | } |
119 | } |
|
126 | } |
120 | } |