wasSharpNET – Diff between revs 11 and 16
?pathlinks?
Rev 11 | Rev 16 | |||
---|---|---|---|---|
Line 10... | Line 10... | |||
10 | |
10 | |
|
11 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
11 | namespace wasSharpNET.Platform.Windows.Commands.NetSH |
|
12 | { |
12 | { |
|
13 | public class URLACL |
13 | public class URLACL |
|
14 | { |
14 | { |
|
15 | public string domain; |
15 | private string domain; |
|
Line 16... | Line 16... | |||
16 | public string URL; |
16 | private string URL; |
|
17 | |
17 | |
|
- | 18 | private readonly Regex URLReservationRegex; |
||
Line 18... | Line 19... | |||
18 | private readonly Regex URLReservationRegex; |
19 | private string username; |
|
19 | public string username; |
20 | private int timeout; |
|
20 | |
21 | |
|
21 | public URLACL(string URL, string username, string domain) |
22 | public URLACL(string URL, string username, string domain, int timeout) |
|
22 | { |
23 | { |
|
- | 24 | this.URL = URL; |
||
Line 23... | Line 25... | |||
23 | this.URL = URL; |
25 | this.username = username; |
|
24 | this.username = username; |
26 | this.domain = domain; |
|
25 | this.domain = domain; |
27 | this.timeout = timeout; |
|
26 | |
28 | |
|
Line 54... | Line 56... | |||
54 | } |
56 | } |
|
55 | }; |
57 | }; |
|
Line 56... | Line 58... | |||
56 | |
58 | |
|
57 | checkProcess.Start(); |
59 | checkProcess.Start(); |
|
58 | checkProcess.BeginOutputReadLine(); |
60 | checkProcess.BeginOutputReadLine(); |
|
Line 59... | Line 61... | |||
59 | checkProcess.WaitForExit(); |
61 | checkProcess.WaitForExit(60000); |
|
60 | |
62 | |
|
61 | return URLReservationRegex.IsMatch(netSHOutput.ToString()); |
63 | return URLReservationRegex.IsMatch(netSHOutput.ToString()); |
|
Line 68... | Line 70... | |||
68 | string.Format(@"http add urlacl url={0} user={1}\{2}", URL, domain, username)) |
70 | string.Format(@"http add urlacl url={0} user={1}\{2}", URL, domain, username)) |
|
69 | { |
71 | { |
|
70 | Verb = @"runas", |
72 | Verb = @"runas", |
|
71 | CreateNoWindow = true, |
73 | CreateNoWindow = true, |
|
72 | WindowStyle = ProcessWindowStyle.Hidden, |
74 | WindowStyle = ProcessWindowStyle.Hidden, |
|
73 | UseShellExecute = true |
75 | UseShellExecute = false |
|
74 | }).WaitForExit(); |
76 | }).WaitForExit(timeout); |
|
75 | } |
77 | } |
|
Line 76... | Line 78... | |||
76 | |
78 | |
|
77 | public void Release() |
79 | public void Release() |
|
78 | { |
80 | { |
|
79 | System.Diagnostics.Process.Start(new ProcessStartInfo("netsh", |
81 | System.Diagnostics.Process.Start(new ProcessStartInfo("netsh", |
|
80 | string.Format(@"http del urlacl url={0}", URL)) |
82 | string.Format(@"http del urlacl url={0}", URL)) |
|
81 | { |
83 | { |
|
82 | Verb = @"runas", |
84 | Verb = @"runas", |
|
83 | CreateNoWindow = true, |
85 | CreateNoWindow = true, |
|
84 | WindowStyle = ProcessWindowStyle.Hidden, |
86 | WindowStyle = ProcessWindowStyle.Hidden, |
|
85 | UseShellExecute = true |
87 | UseShellExecute = false |
|
86 | }).WaitForExit(); |
88 | }).WaitForExit(timeout); |
|
87 | } |
89 | } |
|
88 | } |
90 | } |