diff --git a/README.md b/README.md
index 3398357..f878068 100644
--- a/README.md
+++ b/README.md
@@ -99,14 +99,18 @@ ngserver | NuGet server.
ngpackages | List of packages. Use it first if defined, otherwise find via ngconfig | v1.0+ *empty*
ngpath | Common path for all packages. | v1.0+ `packages`
wpath |`v1.4+` To define working directory. | v1.4+ *The absolute path of the directory where the GetNuTool is located.*
+proxycfg | `v1.6.2+` To configure connection via proxy. | v1.6.2+ *empty*. Format: [usr[:pwd]@]host[:port]
Samples:
```bash
-> msbuild gnt.core /p:ngpath="special-packages/new"
+msbuild gnt.core /p:ngpath="special-packages/new"
```
```bash
-> msbuild gnt.core /p:ngconfig=".nuget/packages.config" /p:ngpath="../packages"
+msbuild gnt.core /p:ngconfig=".nuget/packages.config" /p:ngpath="../packages"
+```
+```bash
+gnt /p:ngpackages="Conari" /p:proxycfg="guest:1234@10.0.2.15:7428"
```
#### Format of packages list
diff --git a/logic.targets b/logic.targets
index 72acfc1..1be0603 100644
--- a/logic.targets
+++ b/logic.targets
@@ -28,7 +28,7 @@
-
+
@@ -121,6 +121,7 @@
+
@@ -145,7 +146,23 @@
Console.WriteLine(s, p);
}
};
-
+
+ Func getProxy = delegate(string cfg)
+ {
+ var auth = cfg.Split('@');
+ if(auth.Length <= 1) {
+ return new WebProxy(auth[0], false);
+ }
+
+ var login = auth[0].Split(':');
+ return new WebProxy(auth[1], false) {
+ Credentials = new NetworkCredential(
+ login[0],
+ (login.Length > 1) ? login[1] : null
+ )
+ };
+ };
+
Func loc = delegate(string p) {
return Path.Combine(wpath, p ?? "");
};
@@ -160,8 +177,13 @@
Console.Write("Getting `{0}` ... ", link);
var tmp = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
- using(var l = new WebClient()) {
- try {
+ using(var l = new WebClient())
+ {
+ try
+ {
+ if(proxy != null) {
+ l.Proxy = getProxy(proxy);
+ }
l.Headers.Add("User-Agent", "GetNuTool");
l.UseDefaultCredentials = true;
l.DownloadFile(url + link, tmp);