wasSharpNET – Diff between revs 20 and 22
?pathlinks?
Rev 20 | Rev 22 | |||
---|---|---|---|---|
Line 4... | Line 4... | |||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | using System.ComponentModel; |
7 | using System.ComponentModel; |
|
8 | using System.Diagnostics; |
- | ||
9 | using System.IO; |
8 | using System.Diagnostics; |
|
10 | using System.Text; |
9 | using System.Text; |
|
11 | using System.Text.RegularExpressions; |
- | ||
Line 12... | Line 10... | |||
12 | using Process = System.Diagnostics.Process; |
10 | using System.Text.RegularExpressions; |
|
13 | |
11 | |
|
14 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
12 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
|
15 | { |
13 | { |
|
16 | public class URLACL |
14 | public class URLACL |
|
17 | { |
15 | { |
|
Line 18... | Line 16... | |||
18 | private string domain; |
16 | private readonly string domain; |
|
19 | private string URL; |
17 | private readonly string URL; |
|
20 | |
18 | |
|
Line 21... | Line 19... | |||
21 | private readonly Regex URLReservationRegex; |
19 | private readonly Regex URLReservationRegex; |
|
22 | private string username; |
20 | private readonly string username; |
|
23 | private int timeout; |
21 | private readonly int timeout; |
|
24 | |
22 | |
|
25 | public URLACL(string URL, string username, string domain, int timeout) |
23 | public URLACL(string URL, string username, string domain, int timeout) |
|
26 | { |
24 | { |
|
Line 27... | Line 25... | |||
27 | this.URL = URL; |
25 | this.URL = URL; |
|
28 | this.username = username; |
26 | this.username = username; |
|
29 | this.domain = domain; |
27 | this.domain = domain; |
|
30 | this.timeout = timeout; |
28 | this.timeout = timeout; |
|
31 | |
29 | |
|
32 | URLReservationRegex = |
30 | URLReservationRegex = |
|
Line 33... | Line 31... | |||
33 | new Regex( |
31 | new Regex( |
|
34 | $@"{Regex.Escape(URL)}.*{Regex.Escape(string.Format(@"{0}\{1}", domain, username))}", |
32 | $@"{Regex.Escape(URL)}.*{Regex.Escape($@"{domain}\{username}")}", |
|
35 | RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | |
33 | RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | |
|
36 | RegexOptions.Compiled); |
34 | RegexOptions.Compiled); |
|
37 | } |
35 | } |
|
38 | |
36 | |
|
- | 37 | public bool isReserved |
||
39 | public bool isReserved |
38 | { |
|
40 | { |
39 | get |
|
41 | get |
40 | { |
|
42 | { |
41 | var netSHOutput = new StringBuilder(); |
|
43 | var netSHOutput = new StringBuilder(); |
42 | var checkProcess = new System.Diagnostics.Process |
|
44 | var checkProcess = new System.Diagnostics.Process(); |
43 | { |
|
- | 44 | StartInfo = new ProcessStartInfo("netsh", @"http show urlacl") |
||
45 | checkProcess.StartInfo = new ProcessStartInfo("netsh", @"http show urlacl") |
45 | { |
|
Line 46... | Line 46... | |||
46 | { |
46 | RedirectStandardOutput = true, |
|
47 | RedirectStandardOutput = true, |
47 | CreateNoWindow = true, |
|
48 | CreateNoWindow = true, |
48 | WindowStyle = ProcessWindowStyle.Hidden, |