From d300819bad29099931443d8a8275972ced6b0b99 Mon Sep 17 00:00:00 2001 From: harobaz Date: Mon, 1 Jun 2015 17:31:10 +0200 Subject: [PATCH 1/9] rachid --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ceb1eb..f15338a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # cleancode-webget-tool - +#rachid [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rhwy/cleancode-webget-tool?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 18a3e4207582fceb9f1abad4561770aa6f7a0044 Mon Sep 17 00:00:00 2001 From: harobaz Date: Mon, 1 Jun 2015 19:07:27 +0200 Subject: [PATCH 2/9] nget v1 --- Students/Rachid OUADI/nget -v1/nget/nget.sln | 20 ++++ .../nget -v1/nget/nget/App.config | 6 + .../nget -v1/nget/nget/Program.cs | 113 ++++++++++++++++++ .../nget/nget/Properties/AssemblyInfo.cs | 36 ++++++ .../nget -v1/nget/nget/nget.csproj | 66 ++++++++++ 5 files changed, 241 insertions(+) create mode 100644 Students/Rachid OUADI/nget -v1/nget/nget.sln create mode 100644 Students/Rachid OUADI/nget -v1/nget/nget/App.config create mode 100644 Students/Rachid OUADI/nget -v1/nget/nget/Program.cs create mode 100644 Students/Rachid OUADI/nget -v1/nget/nget/Properties/AssemblyInfo.cs create mode 100644 Students/Rachid OUADI/nget -v1/nget/nget/nget.csproj diff --git a/Students/Rachid OUADI/nget -v1/nget/nget.sln b/Students/Rachid OUADI/nget -v1/nget/nget.sln new file mode 100644 index 0000000..e5424d4 --- /dev/null +++ b/Students/Rachid OUADI/nget -v1/nget/nget.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget", "nget\nget.csproj", "{29FC1442-DEA5-4EF1-95BC-C1EA44B9980B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {29FC1442-DEA5-4EF1-95BC-C1EA44B9980B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29FC1442-DEA5-4EF1-95BC-C1EA44B9980B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29FC1442-DEA5-4EF1-95BC-C1EA44B9980B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29FC1442-DEA5-4EF1-95BC-C1EA44B9980B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Students/Rachid OUADI/nget -v1/nget/nget/App.config b/Students/Rachid OUADI/nget -v1/nget/nget/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Students/Rachid OUADI/nget -v1/nget/nget/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/Rachid OUADI/nget -v1/nget/nget/Program.cs b/Students/Rachid OUADI/nget -v1/nget/nget/Program.cs new file mode 100644 index 0000000..b4187af --- /dev/null +++ b/Students/Rachid OUADI/nget -v1/nget/nget/Program.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Timers; + +namespace nget +{ + class Program + { + static void Main(string[] args) + { + bool bonArg = false; + try + { + if (args.Length == 3) + { + if (args[0] == "get" && args.Length == 3) + { + + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + Console.WriteLine(result); + bonArg = true; + + } + } + } + else if (args.Length == 5) + { + if (args[0] == "get" && args[3] == "-save") + { + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + File.WriteAllText(args[4], result); + bonArg = true; + + } + } + + + if (args[0] == "get" && args[3] == "-times") + { + + + for (int i = 0; i < Convert.ToInt32(args[4]); i++) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + + Console.WriteLine("Chargement numero " + (i + 1) + " : " + ts.Milliseconds + "ms"); + bonArg = true; + } + } + } + else if (args.Length == 6) + { + Stopwatch stopWatch = new Stopwatch(); + ArrayList tps = new ArrayList(); + + for (int i = 0; i < Convert.ToInt32(args[4]); i++) + { + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + tps.Add(Convert.ToInt32(ts.Milliseconds)); + } + double dbResult = 0.0; + for (int i = 0; i < tps.Count; i++) + { + dbResult += Convert.ToDouble(tps[i]); + } + dbResult = dbResult / Convert.ToInt32(args[4]); + Console.WriteLine("time : " + dbResult + "ms"); + bonArg = true; + } + if (bonArg == false) + { + Console.WriteLine("Bad arg"); + Console.ReadLine(); + Environment.Exit(0); + } + } + + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + + Console.ReadLine(); + + } + } +} diff --git a/Students/Rachid OUADI/nget -v1/nget/nget/Properties/AssemblyInfo.cs b/Students/Rachid OUADI/nget -v1/nget/nget/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..35e4194 --- /dev/null +++ b/Students/Rachid OUADI/nget -v1/nget/nget/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("nget")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("3146940c-7709-4a84-90c9-794c48787df0")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Students/Rachid OUADI/nget -v1/nget/nget/nget.csproj b/Students/Rachid OUADI/nget -v1/nget/nget/nget.csproj new file mode 100644 index 0000000..bd7a33e --- /dev/null +++ b/Students/Rachid OUADI/nget -v1/nget/nget/nget.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {29FC1442-DEA5-4EF1-95BC-C1EA44B9980B} + Exe + Properties + nget + nget + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c3503d7125785aed946ec612b09e0daf82b14997 Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:09:07 +0200 Subject: [PATCH 3/9] nget-v2 (Rachid OUADI & Ivan Klarman) --- .../Rachid OUADI/nget -v2/nget-v2/nget-v2.sln | 20 +++++++ .../nget -v2/nget-v2/nget-v2/App.config | 6 ++ .../nget -v2/nget-v2/nget-v2/Program.cs | 15 +++++ .../nget-v2/Properties/AssemblyInfo.cs | 36 ++++++++++++ .../nget -v2/nget-v2/nget-v2/nget-v2.csproj | 58 +++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 Students/Rachid OUADI/nget -v2/nget-v2/nget-v2.sln create mode 100644 Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/App.config create mode 100644 Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs create mode 100644 Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Properties/AssemblyInfo.cs create mode 100644 Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/nget-v2.csproj diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2.sln b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2.sln new file mode 100644 index 0000000..cf31a21 --- /dev/null +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget-v2", "nget-v2\nget-v2.csproj", "{005DA57B-91D7-453B-9B91-CE6DE6348950}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {005DA57B-91D7-453B-9B91-CE6DE6348950}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {005DA57B-91D7-453B-9B91-CE6DE6348950}.Debug|Any CPU.Build.0 = Debug|Any CPU + {005DA57B-91D7-453B-9B91-CE6DE6348950}.Release|Any CPU.ActiveCfg = Release|Any CPU + {005DA57B-91D7-453B-9B91-CE6DE6348950}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/App.config b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs new file mode 100644 index 0000000..49790b3 --- /dev/null +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace nget_v2 +{ + class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Properties/AssemblyInfo.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..aa780ee --- /dev/null +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("nget-v2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget-v2")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("e2636ffa-15d8-411e-b174-0ac753ea2712")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/nget-v2.csproj b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/nget-v2.csproj new file mode 100644 index 0000000..06029e5 --- /dev/null +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/nget-v2.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {005DA57B-91D7-453B-9B91-CE6DE6348950} + Exe + Properties + nget_v2 + nget-v2 + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 6d9065baa286bb8d40138465a061b4cb2189253a Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:11:14 +0200 Subject: [PATCH 4/9] nget v2 (Rachid OUADI & Ivan Klarman) implementation de la v1 dans la v2 --- .../nget -v2/nget-v2/nget-v2/Program.cs | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index 49790b3..ec42f3c 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -1,6 +1,10 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; @@ -10,6 +14,99 @@ class Program { static void Main(string[] args) { + bool bonArg = false; + try + { + if (args.Length == 3) + { + if (args[0] == "get" && args.Length == 3) + { + + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + Console.WriteLine(result); + bonArg = true; + + } + } + } + else if (args.Length == 5) + { + if (args[0] == "get" && args[3] == "-save") + { + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + File.WriteAllText(args[4], result); + bonArg = true; + + } + } + + + if (args[0] == "get" && args[3] == "-times") + { + + + for (int i = 0; i < Convert.ToInt32(args[4]); i++) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + + Console.WriteLine("Chargement numero " + (i + 1) + " : " + ts.Milliseconds + "ms"); + bonArg = true; + } + } + } + else if (args.Length == 6) + { + Stopwatch stopWatch = new Stopwatch(); + ArrayList tps = new ArrayList(); + + for (int i = 0; i < Convert.ToInt32(args[4]); i++) + { + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + tps.Add(Convert.ToInt32(ts.Milliseconds)); + } + double dbResult = 0.0; + for (int i = 0; i < tps.Count; i++) + { + dbResult += Convert.ToDouble(tps[i]); + } + dbResult = dbResult / Convert.ToInt32(args[4]); + Console.WriteLine("time : " + dbResult + "ms"); + bonArg = true; + } + if (bonArg == false) + { + Console.WriteLine("Bad arg"); + Console.ReadLine(); + Environment.Exit(0); + } + } + + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + + Console.ReadLine(); + } } } From 5e74bd43e656a2f7237d97db6aba5f1310c8cd73 Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:26:18 +0200 Subject: [PATCH 5/9] nget v2 (Rachid OUADI & Ivan KLARMAN) Ajout des methodes pour chaques traitements --- .../nget -v2/nget-v2/nget-v2/Program.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index ec42f3c..81d2ae4 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -107,6 +107,27 @@ static void Main(string[] args) Console.ReadLine(); + + } + private static void GetTimeAvgLoad() + { + throw new NotImplementedException(); } + + private static void GetTimeLoad() + { + throw new NotImplementedException(); + } + + private static void GetAndSaveContent() + { + throw new NotImplementedException(); + } + + private static void GetContent() + { + throw new NotImplementedException(); + } + } } From 3c1000898652e65a18dca3ba123b31138949370c Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:32:49 +0200 Subject: [PATCH 6/9] nget v2 (Rachid OUADI & Ivan KLARMAN) Implementation des methodes --- .../nget -v2/nget-v2/nget-v2/Program.cs | 127 +++++++++--------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index 81d2ae4..daab325 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -12,85 +12,38 @@ namespace nget_v2 { class Program { + static bool bonArg; //= false; static void Main(string[] args) { - bool bonArg = false; + bonArg = false; + try { if (args.Length == 3) { if (args[0] == "get" && args.Length == 3) { - - using (var client = new WebClient()) - { - string result = client.DownloadString(args[2]); - Console.WriteLine(result); - bonArg = true; - - } + //Content } } else if (args.Length == 5) { if (args[0] == "get" && args[3] == "-save") { - using (var client = new WebClient()) - { - string result = client.DownloadString(args[2]); - File.WriteAllText(args[4], result); - bonArg = true; - - } + //getandsave } if (args[0] == "get" && args[3] == "-times") { - - for (int i = 0; i < Convert.ToInt32(args[4]); i++) - { - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - using (var client = new WebClient()) - { - string result = client.DownloadString(args[2]); - } - - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - - Console.WriteLine("Chargement numero " + (i + 1) + " : " + ts.Milliseconds + "ms"); - bonArg = true; - } + //gettimeload + } } else if (args.Length == 6) { - Stopwatch stopWatch = new Stopwatch(); - ArrayList tps = new ArrayList(); - - for (int i = 0; i < Convert.ToInt32(args[4]); i++) - { - stopWatch.Start(); - using (var client = new WebClient()) - { - string result = client.DownloadString(args[2]); - } - - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - tps.Add(Convert.ToInt32(ts.Milliseconds)); - } - double dbResult = 0.0; - for (int i = 0; i < tps.Count; i++) - { - dbResult += Convert.ToDouble(tps[i]); - } - dbResult = dbResult / Convert.ToInt32(args[4]); - Console.WriteLine("time : " + dbResult + "ms"); - bonArg = true; + //gettimeavgload } if (bonArg == false) { @@ -109,24 +62,72 @@ static void Main(string[] args) } - private static void GetTimeAvgLoad() + private static void GetTimeAvgLoad(string[] _args) { - throw new NotImplementedException(); + Stopwatch stopWatch = new Stopwatch(); + ArrayList tps = new ArrayList(); + + for (int i = 0; i < Convert.ToInt32(_args[4]); i++) + { + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(_args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + tps.Add(Convert.ToInt32(ts.Milliseconds)); + } + double dbResult = 0.0; + for (int i = 0; i < tps.Count; i++) + { + dbResult += Convert.ToDouble(tps[i]); + } + dbResult = dbResult / Convert.ToInt32(_args[4]); + Console.WriteLine("time : " + dbResult + "ms"); + bonArg = true; } - private static void GetTimeLoad() + private static void GetTimeLoad(string []_args) { - throw new NotImplementedException(); + for (int i = 0; i < Convert.ToInt32(_args[4]); i++) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + using (var client = new WebClient()) + { + string result = client.DownloadString(_args[2]); + } + + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + + Console.WriteLine("Chargement numero " + (i + 1) + " : " + ts.Milliseconds + "ms"); + bonArg = true; + } } - private static void GetAndSaveContent() + private static void GetAndSaveContent(string[] _args) { - throw new NotImplementedException(); + using (var client = new WebClient()) + { + string result = client.DownloadString(_args[2]); + File.WriteAllText(_args[4], result); + bonArg = true; + + } } - private static void GetContent() + private static void GetContent(string[] _args) { - throw new NotImplementedException(); + using (var client = new WebClient()) + { + string result = client.DownloadString(_args[2]); + Console.WriteLine(result); + bonArg = true; + + } } } From e61b017ec67daebf7c5a2bafcf8211f4de546fbe Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:34:54 +0200 Subject: [PATCH 7/9] nget v2 (Rachid OUADI & Ivan KLARMAN) Appel des methodes dans le main pour chaque traitements --- Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index daab325..53bd6c2 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -23,27 +23,29 @@ static void Main(string[] args) { if (args[0] == "get" && args.Length == 3) { - //Content + GetContent(args); } } else if (args.Length == 5) { if (args[0] == "get" && args[3] == "-save") { + GetAndSaveContent(args); //getandsave } if (args[0] == "get" && args[3] == "-times") { - + GetTimeLoad(args); //gettimeload } } else if (args.Length == 6) { - //gettimeavgload + GetTimeAvgLoad(args); + //gettimeavgload } if (bonArg == false) { From a08dce7e370edd0630bde09cf3a2bb9fd9bf0b65 Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 16:42:22 +0200 Subject: [PATCH 8/9] nget v2 (Rachid OUADI & Ivan KLARMAN) --- .../Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index 53bd6c2..9255ae6 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -31,21 +31,15 @@ static void Main(string[] args) if (args[0] == "get" && args[3] == "-save") { GetAndSaveContent(args); - //getandsave } - - if (args[0] == "get" && args[3] == "-times") { - GetTimeLoad(args); - //gettimeload - + GetTimeLoad(args); } } else if (args.Length == 6) { GetTimeAvgLoad(args); - //gettimeavgload } if (bonArg == false) { @@ -62,7 +56,6 @@ static void Main(string[] args) Console.ReadLine(); - } private static void GetTimeAvgLoad(string[] _args) { From 076436327d1f30a48051fb94beba9714d669760a Mon Sep 17 00:00:00 2001 From: harobaz Date: Wed, 17 Jun 2015 17:12:50 +0200 Subject: [PATCH 9/9] nget v2 (Rachid OUADI & Ivan KLARMAN) Ajout des check des arguments --- .../nget -v2/nget-v2/nget-v2/Program.cs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs index 9255ae6..bac71cd 100644 --- a/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs +++ b/Students/Rachid OUADI/nget -v2/nget-v2/nget-v2/Program.cs @@ -15,10 +15,32 @@ class Program static bool bonArg; //= false; static void Main(string[] args) { - bonArg = false; - + bonArg = false; + try { + + + + string[] typeOfExecution = { "get", "test" }; + bool result = IsPresentTOE(args[0], typeOfExecution); + if(result==false) + { + Console.WriteLine("Bad Argument"); + System.Environment.Exit(1); + } + + string[] typeOfArgsForTheExecution = { "-url" }; + result = IsPresentTOE(args[1], typeOfArgsForTheExecution); + if(result==false) + { + Console.WriteLine("Bad Argument"); + System.Environment.Exit(1); + } + + string[] additionalArgsToExecution = { "-times", "-avg" }; + + if (args.Length == 3) { if (args[0] == "get" && args.Length == 3) @@ -57,6 +79,17 @@ static void Main(string[] args) Console.ReadLine(); } + + private static bool IsPresentTOE(string arg,string[] tabArg) + { + if (tabArg.Contains(arg) == true) + { + return true; + } + return false; + + } + private static void GetTimeAvgLoad(string[] _args) { Stopwatch stopWatch = new Stopwatch();