wasSharpNET – Diff between revs 27 and 31

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 27 Rev 31
Line 2... Line 2...
2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line -... Line 6...
-   6  
6   7 using System;
7 using System.ComponentModel; 8 using System.ComponentModel;
8 using System.Diagnostics; 9 using System.Diagnostics;
9 using System.Text; 10 using System.Text;
Line 10... Line 11...
10 using System.Text.RegularExpressions; 11 using System.Text.RegularExpressions;
11   12  
12 namespace wasSharpNET.Platform.Windows.Commands.NetSH 13 namespace wasSharpNET.Platform.Windows.Commands.NetSH
13 { 14 {
14 public class URLACL 15 public class URLACL : IDisposable
15 { 16 {
16 private readonly string domain; 17 private string domain { get; set; }
Line 17... Line 18...
17 private readonly int timeout; 18 private int timeout { get; set; } = 60000;
18 private readonly string URL; 19 private string URL { get; set; }
Line 19... Line 20...
19   20  
20 private readonly Regex URLReservationRegex; 21 private Regex URLReservationRegex { get; set; }
21 private readonly string username; 22 private string username { get; set; }
22   23  
23 public URLACL(string URL, string username, string domain, int timeout) 24 public URLACL(string URL, string username, string domain)
24 { -  
Line 25... Line 25...
25 this.URL = URL; 25 {
26 this.username = username; 26 this.URL = URL;
27 this.domain = domain; 27 this.username = username;
28 this.timeout = timeout; 28 this.domain = domain;
29   29  
-   30 URLReservationRegex =
-   31 new Regex(
-   32 $@"{Regex.Escape(URL)}.*{Regex.Escape($@"{domain}\{username}")}",
-   33 RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase |
-   34 RegexOptions.Compiled);
30 URLReservationRegex = 35 }
Line 31... Line 36...
31 new Regex( 36  
32 $@"{Regex.Escape(URL)}.*{Regex.Escape($@"{domain}\{username}")}", 37 public URLACL(string URL, string username, string domain, int timeout) : this(URL, username, domain)
33 RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | 38 {
34 RegexOptions.Compiled); 39 this.timeout = timeout;
35 } 40 }
36   41  
Line 56... Line 61...
56 netSHOutput.Append(output.Data); 61 netSHOutput.Append(output.Data);
57 }; 62 };
Line 58... Line 63...
58   63  
59 checkProcess.Start(); 64 checkProcess.Start();
60 checkProcess.BeginOutputReadLine(); 65 checkProcess.BeginOutputReadLine();
Line 61... Line 66...
61 checkProcess.WaitForExit(60000); 66 checkProcess.WaitForExit(timeout);
62   67  
63 return URLReservationRegex.IsMatch(netSHOutput.ToString()); 68 return URLReservationRegex.IsMatch(netSHOutput.ToString());
Line 115... Line 120...
115 if (process == null) 120 if (process == null)
116 return false; 121 return false;
Line 117... Line 122...
117   122  
118 return process.WaitForExit(timeout); 123 return process.WaitForExit(timeout);
-   124 }
-   125  
-   126 public void Dispose()
-   127 {
119 } 128 }
120 } 129 }
121 } 130 }