From 123f8aab7ac47c7858253e1a83fe0bf5ca89835d Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Mon, 1 Jun 2015 17:22:28 +0200 Subject: [PATCH 1/9] commit initial --- stitch.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 stitch.txt diff --git a/stitch.txt b/stitch.txt new file mode 100644 index 0000000..e03ce19 --- /dev/null +++ b/stitch.txt @@ -0,0 +1 @@ +yoloooooooooooooooooooooooooooooooo \ No newline at end of file From 71b7baddc61f34e86a89c3891f4d7d3cd257609c Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Mon, 1 Jun 2015 17:24:30 +0200 Subject: [PATCH 2/9] Modification readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 4ceb1eb..3bc0310 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,8 @@ English readme not available at this time, it's only available in [french](readme.fr.md) + + +IMBART Emerich + +e.imbart@hotmail.fr \ No newline at end of file From 3b3fc74084c688086f0f53183938834c33b9619d Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Mon, 1 Jun 2015 19:09:28 +0200 Subject: [PATCH 3/9] nget-v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mise en place des fonctionnalités get et test --- .../IMBART-Emerich/nget-v1/nget/Program.cs | 115 ++++++++++++++++++ .../nget-v1/nget/Properties/AssemblyInfo.cs | 31 +++++ .../IMBART-Emerich/nget-v1/nget/app.config | 6 + .../IMBART-Emerich/nget-v1/nget/nget.csproj | 58 +++++++++ 4 files changed, 210 insertions(+) create mode 100644 Students/IMBART-Emerich/nget-v1/nget/Program.cs create mode 100644 Students/IMBART-Emerich/nget-v1/nget/Properties/AssemblyInfo.cs create mode 100644 Students/IMBART-Emerich/nget-v1/nget/app.config create mode 100644 Students/IMBART-Emerich/nget-v1/nget/nget.csproj diff --git a/Students/IMBART-Emerich/nget-v1/nget/Program.cs b/Students/IMBART-Emerich/nget-v1/nget/Program.cs new file mode 100644 index 0000000..ffc6356 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v1/nget/Program.cs @@ -0,0 +1,115 @@ +/* + * Created by SharpDevelop. + * User: 626 + * Date: 01/06/2015 + * Time: 17:41 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; + + +namespace nget +{ + class Program + { + public static void Main(string[] args) + { + + if(args.Length == 3 && args[0] == "get" && args[1] == "-url") /* test requete de type ==> nget.exe get -url "http://abc" */ + { + Console.WriteLine("Affichage du fichier \n\n "); + print(args[2]); + } + else if(args.Length == 5 && args[0] == "get" && args[1] == "-url" && args[3] == "-save") /* test requete de type ==> nget.exe get -url "http://abc" -save "c:\abc.json" */ + { + Console.WriteLine("\n\nFichier : " + args[2] + " copié dans : \n" + args[4]); + download(args[2],args[4]); + } + else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 */ + { + int compteur; + try{ + compteur = Convert.ToInt32(args[4]); + test(args[2],compteur,0); + }catch(Exception e){ + Console.WriteLine(e.Message); + } + } + else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 -avg */ + { + int compteur; + try{ + compteur = Convert.ToInt32(args[4]); + test(args[2],compteur,1); + }catch(Exception e){ + Console.WriteLine(e.Message); + } + } + + Console.ReadKey(true); + } + + //Fonction de téléchargement de l'URL + private static void download(string URL, string path) + { + var wc = new System.Net.WebClient(); + try{ + wc.DownloadFile(URL, path); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + } + + //Fonction d'affichage de l'URL + private static void print(String URL) + { + var wc = new System.Net.WebClient(); + try{ + Console.WriteLine(wc.DownloadString(URL)); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + + } + + //fonciton de chargement de l'URL + private static void NoPrint(string URL) + { + var wc = new System.Net.WebClient(); + wc.DownloadString(URL); + } + + //Fonction de routage des tests de chargement + private static void test(string URL,int compteur, int mode) + { + long[] tab = new long[compteur]; + long moyenne = 0; + Stopwatch sw = new Stopwatch(); // variable timer + + for(int i = 0 ; i < compteur ; i++) + { + sw.Start(); + if(mode == 0) // mode avec affichage + print(URL); + else + NoPrint(URL); // mode sans affichage + + sw.Stop(); + tab[i]=sw.ElapsedMilliseconds; + moyenne += tab[i]; + sw = Stopwatch.StartNew(); // reset du timer + } + + Console.Clear(); + if(mode == 0) + for(int i = 0 ; i < compteur ; i++) + Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); + else + Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); + } + } +} \ No newline at end of file diff --git a/Students/IMBART-Emerich/nget-v1/nget/Properties/AssemblyInfo.cs b/Students/IMBART-Emerich/nget-v1/nget/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1b0bef5 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v1/nget/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("nget")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget")] +[assembly: AssemblyCopyright("Copyright 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/Students/IMBART-Emerich/nget-v1/nget/app.config b/Students/IMBART-Emerich/nget-v1/nget/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/Students/IMBART-Emerich/nget-v1/nget/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/IMBART-Emerich/nget-v1/nget/nget.csproj b/Students/IMBART-Emerich/nget-v1/nget/nget.csproj new file mode 100644 index 0000000..34cd33a --- /dev/null +++ b/Students/IMBART-Emerich/nget-v1/nget/nget.csproj @@ -0,0 +1,58 @@ + + + + {4F423ADF-535C-4917-8B76-85CA115A59A1} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Exe + nget + nget + v4.0 + Properties + + + x86 + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + 4.0 + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + + + \ No newline at end of file From a65d5cc44719e710cb12defbb7c3b2de5af14d63 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 15:57:59 +0200 Subject: [PATCH 4/9] fichier de depart v2 a clean --- Students/IMBART-Emerich/nget-v1/nget/nget.sln | 18 +++ .../IMBART-Emerich/nget-v2/nget/Program.cs | 115 ++++++++++++++++++ .../nget-v2/nget/Properties/AssemblyInfo.cs | 31 +++++ .../IMBART-Emerich/nget-v2/nget/app.config | 6 + .../IMBART-Emerich/nget-v2/nget/nget.csproj | 58 +++++++++ Students/IMBART-Emerich/nget-v2/nget/nget.sln | 18 +++ 6 files changed, 246 insertions(+) create mode 100644 Students/IMBART-Emerich/nget-v1/nget/nget.sln create mode 100644 Students/IMBART-Emerich/nget-v2/nget/Program.cs create mode 100644 Students/IMBART-Emerich/nget-v2/nget/Properties/AssemblyInfo.cs create mode 100644 Students/IMBART-Emerich/nget-v2/nget/app.config create mode 100644 Students/IMBART-Emerich/nget-v2/nget/nget.csproj create mode 100644 Students/IMBART-Emerich/nget-v2/nget/nget.sln diff --git a/Students/IMBART-Emerich/nget-v1/nget/nget.sln b/Students/IMBART-Emerich/nget-v1/nget/nget.sln new file mode 100644 index 0000000..4dd3fe8 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v1/nget/nget.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 5.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget", "nget.csproj", "{4F423ADF-535C-4917-8B76-85CA115A59A1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs new file mode 100644 index 0000000..ffc6356 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -0,0 +1,115 @@ +/* + * Created by SharpDevelop. + * User: 626 + * Date: 01/06/2015 + * Time: 17:41 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; + + +namespace nget +{ + class Program + { + public static void Main(string[] args) + { + + if(args.Length == 3 && args[0] == "get" && args[1] == "-url") /* test requete de type ==> nget.exe get -url "http://abc" */ + { + Console.WriteLine("Affichage du fichier \n\n "); + print(args[2]); + } + else if(args.Length == 5 && args[0] == "get" && args[1] == "-url" && args[3] == "-save") /* test requete de type ==> nget.exe get -url "http://abc" -save "c:\abc.json" */ + { + Console.WriteLine("\n\nFichier : " + args[2] + " copié dans : \n" + args[4]); + download(args[2],args[4]); + } + else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 */ + { + int compteur; + try{ + compteur = Convert.ToInt32(args[4]); + test(args[2],compteur,0); + }catch(Exception e){ + Console.WriteLine(e.Message); + } + } + else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 -avg */ + { + int compteur; + try{ + compteur = Convert.ToInt32(args[4]); + test(args[2],compteur,1); + }catch(Exception e){ + Console.WriteLine(e.Message); + } + } + + Console.ReadKey(true); + } + + //Fonction de téléchargement de l'URL + private static void download(string URL, string path) + { + var wc = new System.Net.WebClient(); + try{ + wc.DownloadFile(URL, path); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + } + + //Fonction d'affichage de l'URL + private static void print(String URL) + { + var wc = new System.Net.WebClient(); + try{ + Console.WriteLine(wc.DownloadString(URL)); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + + } + + //fonciton de chargement de l'URL + private static void NoPrint(string URL) + { + var wc = new System.Net.WebClient(); + wc.DownloadString(URL); + } + + //Fonction de routage des tests de chargement + private static void test(string URL,int compteur, int mode) + { + long[] tab = new long[compteur]; + long moyenne = 0; + Stopwatch sw = new Stopwatch(); // variable timer + + for(int i = 0 ; i < compteur ; i++) + { + sw.Start(); + if(mode == 0) // mode avec affichage + print(URL); + else + NoPrint(URL); // mode sans affichage + + sw.Stop(); + tab[i]=sw.ElapsedMilliseconds; + moyenne += tab[i]; + sw = Stopwatch.StartNew(); // reset du timer + } + + Console.Clear(); + if(mode == 0) + for(int i = 0 ; i < compteur ; i++) + Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); + else + Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); + } + } +} \ No newline at end of file diff --git a/Students/IMBART-Emerich/nget-v2/nget/Properties/AssemblyInfo.cs b/Students/IMBART-Emerich/nget-v2/nget/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1b0bef5 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("nget")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget")] +[assembly: AssemblyCopyright("Copyright 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/Students/IMBART-Emerich/nget-v2/nget/app.config b/Students/IMBART-Emerich/nget-v2/nget/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/IMBART-Emerich/nget-v2/nget/nget.csproj b/Students/IMBART-Emerich/nget-v2/nget/nget.csproj new file mode 100644 index 0000000..34cd33a --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/nget.csproj @@ -0,0 +1,58 @@ + + + + {4F423ADF-535C-4917-8B76-85CA115A59A1} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Exe + nget + nget + v4.0 + Properties + + + x86 + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + 4.0 + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + + + \ No newline at end of file diff --git a/Students/IMBART-Emerich/nget-v2/nget/nget.sln b/Students/IMBART-Emerich/nget-v2/nget/nget.sln new file mode 100644 index 0000000..4dd3fe8 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/nget.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 5.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget", "nget.csproj", "{4F423ADF-535C-4917-8B76-85CA115A59A1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal From 2f9b36bc40bd787ddd2487830b281b53eb4c7537 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 16:31:35 +0200 Subject: [PATCH 5/9] fonction get et test --- .../IMBART-Emerich/nget-v2/nget/Program.cs | 160 ++++++++++-------- 1 file changed, 91 insertions(+), 69 deletions(-) diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs index ffc6356..c2d4f07 100644 --- a/Students/IMBART-Emerich/nget-v2/nget/Program.cs +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -1,12 +1,12 @@ /* - * Created by SharpDevelop. * User: 626 - * Date: 01/06/2015 - * Time: 17:41 + * Date: 17/06/2015 + * Time: 15:53 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; @@ -16,20 +16,23 @@ namespace nget { class Program { + private static List listeDeCommande = new List(new string[] { "get", "test"}); + private static List listeArgument = new List(new string[] { "-url", "-save", "-times", "-avg"}); + public static void Main(string[] args) - { - - if(args.Length == 3 && args[0] == "get" && args[1] == "-url") /* test requete de type ==> nget.exe get -url "http://abc" */ - { - Console.WriteLine("Affichage du fichier \n\n "); - print(args[2]); - } - else if(args.Length == 5 && args[0] == "get" && args[1] == "-url" && args[3] == "-save") /* test requete de type ==> nget.exe get -url "http://abc" -save "c:\abc.json" */ - { - Console.WriteLine("\n\nFichier : " + args[2] + " copié dans : \n" + args[4]); - download(args[2],args[4]); - } - else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 */ + { + switch (listeDeCommande.IndexOf(args[0]) ) + { + case 0 : + getMethode(args); + break; + + case 1: + testMethode(args); + break; + } + /* + else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") { int compteur; try{ @@ -39,7 +42,7 @@ public static void Main(string[] args) Console.WriteLine(e.Message); } } - else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 -avg */ + else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") { int compteur; try{ @@ -48,68 +51,87 @@ public static void Main(string[] args) }catch(Exception e){ Console.WriteLine(e.Message); } - } + }*/ Console.ReadKey(true); } - //Fonction de téléchargement de l'URL - private static void download(string URL, string path) - { - var wc = new System.Net.WebClient(); - try{ - wc.DownloadFile(URL, path); - }catch(System.Net.WebException e){ - Console.WriteLine(e.Message); - } - } + //Fonction de téléchargement de l'URL + private static void download(string URL, string path) + { + var wc = new System.Net.WebClient(); + try{ + wc.DownloadFile(URL, path); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + } - //Fonction d'affichage de l'URL - private static void print(String URL) - { - var wc = new System.Net.WebClient(); - try{ - Console.WriteLine(wc.DownloadString(URL)); - }catch(System.Net.WebException e){ - Console.WriteLine(e.Message); - } + //Fonction d'affichage de l'URL + private static void print(String URL, String path ="") + { + var wc = new System.Net.WebClient(); + try{ + if(path == "") + Console.WriteLine(wc.DownloadString(URL)); + else + wc.DownloadFile(URL, path); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } - } + } - //fonciton de chargement de l'URL - private static void NoPrint(string URL) - { - var wc = new System.Net.WebClient(); - wc.DownloadString(URL); - } + //fonciton de chargement de l'URL + private static void NoPrint(string URL) + { + var wc = new System.Net.WebClient(); + wc.DownloadString(URL); + } - //Fonction de routage des tests de chargement - private static void test(string URL,int compteur, int mode) - { - long[] tab = new long[compteur]; - long moyenne = 0; - Stopwatch sw = new Stopwatch(); // variable timer + //Fonction de routage des tests de chargement + private static void test(string URL,int compteur, int mode) + { + long[] tab = new long[compteur]; + long moyenne = 0; + Stopwatch sw = new Stopwatch(); // variable timer - for(int i = 0 ; i < compteur ; i++) - { - sw.Start(); - if(mode == 0) // mode avec affichage - print(URL); - else - NoPrint(URL); // mode sans affichage + for(int i = 0 ; i < compteur ; i++) + { + sw.Start(); + if(mode == 0) // mode avec affichage + print(URL); + else + NoPrint(URL); // mode sans affichage - sw.Stop(); - tab[i]=sw.ElapsedMilliseconds; - moyenne += tab[i]; - sw = Stopwatch.StartNew(); // reset du timer - } + sw.Stop(); + tab[i]=sw.ElapsedMilliseconds; + moyenne += tab[i]; + sw = Stopwatch.StartNew(); // reset du timer + } - Console.Clear(); - if(mode == 0) - for(int i = 0 ; i < compteur ; i++) - Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); - else - Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); - } + Console.Clear(); + if(mode == 0) + for(int i = 0 ; i < compteur ; i++) + Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); + else + Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); + } + + private static void printMessage(string message) + { + + } + + private static void getMethode(string [] args) + { + print(args[listeArgument.IndexOf("-url")+1],args[listeArgument.IndexOf("-save")+1]); + } + + private static void testMethode(string [] args) + { + + } + } } } \ No newline at end of file From 700bf07e3387e6f26221173a1656c7b2fbcc5699 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 16:46:22 +0200 Subject: [PATCH 6/9] implementation get test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rediretion dans les méthode get et test fonctionnelle --- .../IMBART-Emerich/nget-v2/nget/Program.cs | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs index c2d4f07..9035f06 100644 --- a/Students/IMBART-Emerich/nget-v2/nget/Program.cs +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -17,10 +17,11 @@ namespace nget class Program { private static List listeDeCommande = new List(new string[] { "get", "test"}); - private static List listeArgument = new List(new string[] { "-url", "-save", "-times", "-avg"}); + private static List listeArgument; public static void Main(string[] args) { + listeArgument = new List(args); switch (listeDeCommande.IndexOf(args[0]) ) { case 0 : @@ -56,20 +57,10 @@ public static void Main(string[] args) Console.ReadKey(true); } - //Fonction de téléchargement de l'URL - private static void download(string URL, string path) - { - var wc = new System.Net.WebClient(); - try{ - wc.DownloadFile(URL, path); - }catch(System.Net.WebException e){ - Console.WriteLine(e.Message); - } - } - //Fonction d'affichage de l'URL private static void print(String URL, String path ="") { + Console.WriteLine(path); var wc = new System.Net.WebClient(); try{ if(path == "") @@ -120,18 +111,40 @@ private static void test(string URL,int compteur, int mode) private static void printMessage(string message) { - + } private static void getMethode(string [] args) { - print(args[listeArgument.IndexOf("-url")+1],args[listeArgument.IndexOf("-save")+1]); + int arg1,arg2; + string path =""; + + arg1 = listeArgument.IndexOf("-url")+1; + arg2 = listeArgument.IndexOf("-save")+1; + + if(arg2 > 1) + path = args[arg2]; + + print(args[arg1],path); } private static void testMethode(string [] args) { + int compteur,mode = 1; + + if (listeArgument.IndexOf("-avg") > 0) + mode = 1; + try + { + compteur = Convert.ToInt32(args[listeArgument.IndexOf("-times") + 1]); + test(args[listeArgument.IndexOf("-url") + 1], compteur, mode); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } } - } + } } \ No newline at end of file From 2268b361cc2f8fe762fcc1759e29713381766d79 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 16:48:40 +0200 Subject: [PATCH 7/9] =?UTF-8?q?suppression=20commentaire=20et=20m=C3=A9tho?= =?UTF-8?q?des=20=20inutilsi=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IMBART-Emerich/nget-v2/nget/Program.cs | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs index 9035f06..afcc6cb 100644 --- a/Students/IMBART-Emerich/nget-v2/nget/Program.cs +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -31,28 +31,7 @@ public static void Main(string[] args) case 1: testMethode(args); break; - } - /* - else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") - { - int compteur; - try{ - compteur = Convert.ToInt32(args[4]); - test(args[2],compteur,0); - }catch(Exception e){ - Console.WriteLine(e.Message); - } - } - else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") - { - int compteur; - try{ - compteur = Convert.ToInt32(args[4]); - test(args[2],compteur,1); - }catch(Exception e){ - Console.WriteLine(e.Message); - } - }*/ + } Console.ReadKey(true); } @@ -109,11 +88,6 @@ private static void test(string URL,int compteur, int mode) Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); } - private static void printMessage(string message) - { - - } - private static void getMethode(string [] args) { int arg1,arg2; From 87ba47c34346539ed80a7d9f1964e55aeddff549 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 17:02:00 +0200 Subject: [PATCH 8/9] fix bug mode de test + re indentation --- .../IMBART-Emerich/nget-v2/nget/Program.cs | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs index afcc6cb..19a674a 100644 --- a/Students/IMBART-Emerich/nget-v2/nget/Program.cs +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -22,6 +22,7 @@ class Program public static void Main(string[] args) { listeArgument = new List(args); + switch (listeDeCommande.IndexOf(args[0]) ) { case 0 : @@ -36,7 +37,6 @@ public static void Main(string[] args) Console.ReadKey(true); } - //Fonction d'affichage de l'URL private static void print(String URL, String path ="") { Console.WriteLine(path); @@ -48,38 +48,35 @@ private static void print(String URL, String path ="") wc.DownloadFile(URL, path); }catch(System.Net.WebException e){ Console.WriteLine(e.Message); - } - + } } - //fonciton de chargement de l'URL private static void NoPrint(string URL) { var wc = new System.Net.WebClient(); wc.DownloadString(URL); } - //Fonction de routage des tests de chargement - private static void test(string URL,int compteur, int mode) + private static void testSwitch(string URL,int compteur, int mode) { long[] tab = new long[compteur]; long moyenne = 0; - Stopwatch sw = new Stopwatch(); // variable timer + Stopwatch sw = new Stopwatch(); for(int i = 0 ; i < compteur ; i++) { sw.Start(); - if(mode == 0) // mode avec affichage + if(mode == 0) print(URL); else - NoPrint(URL); // mode sans affichage + NoPrint(URL); sw.Stop(); tab[i]=sw.ElapsedMilliseconds; moyenne += tab[i]; - sw = Stopwatch.StartNew(); // reset du timer + sw = Stopwatch.StartNew(); } - + Console.Clear(); if(mode == 0) for(int i = 0 ; i < compteur ; i++) @@ -104,7 +101,7 @@ private static void getMethode(string [] args) private static void testMethode(string [] args) { - int compteur,mode = 1; + int compteur,mode = 0; if (listeArgument.IndexOf("-avg") > 0) mode = 1; @@ -112,13 +109,12 @@ private static void testMethode(string [] args) try { compteur = Convert.ToInt32(args[listeArgument.IndexOf("-times") + 1]); - test(args[listeArgument.IndexOf("-url") + 1], compteur, mode); + testSwitch(args[listeArgument.IndexOf("-url") + 1], compteur, mode); } catch (Exception e) { Console.WriteLine(e.Message); } - } - + } } } \ No newline at end of file From 44b440b2e6b658393b1a4b333dd86ca81c504ab5 Mon Sep 17 00:00:00 2001 From: Emerich IMBART Date: Wed, 17 Jun 2015 17:08:23 +0200 Subject: [PATCH 9/9] change tabulation fail --- .../IMBART-Emerich/nget-v2/nget/Program.cs | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/Students/IMBART-Emerich/nget-v2/nget/Program.cs b/Students/IMBART-Emerich/nget-v2/nget/Program.cs index 19a674a..edad185 100644 --- a/Students/IMBART-Emerich/nget-v2/nget/Program.cs +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -37,84 +37,84 @@ public static void Main(string[] args) Console.ReadKey(true); } - private static void print(String URL, String path ="") - { - Console.WriteLine(path); - var wc = new System.Net.WebClient(); - try{ - if(path == "") - Console.WriteLine(wc.DownloadString(URL)); - else - wc.DownloadFile(URL, path); - }catch(System.Net.WebException e){ - Console.WriteLine(e.Message); - } - } + private static void print(String URL, String path ="") + { + Console.WriteLine(path); + var wc = new System.Net.WebClient(); + try{ + if(path == "") + Console.WriteLine(wc.DownloadString(URL)); + else + wc.DownloadFile(URL, path); + }catch(System.Net.WebException e){ + Console.WriteLine(e.Message); + } + } - private static void NoPrint(string URL) - { - var wc = new System.Net.WebClient(); - wc.DownloadString(URL); - } + private static void NoPrint(string URL) + { + var wc = new System.Net.WebClient(); + wc.DownloadString(URL); + } - private static void testSwitch(string URL,int compteur, int mode) - { - long[] tab = new long[compteur]; - long moyenne = 0; - Stopwatch sw = new Stopwatch(); + private static void testSwitch(string URL,int compteur, int mode) + { + long[] tab = new long[compteur]; + long moyenne = 0; + Stopwatch sw = new Stopwatch(); - for(int i = 0 ; i < compteur ; i++) - { - sw.Start(); - if(mode == 0) - print(URL); - else - NoPrint(URL); + for(int i = 0 ; i < compteur ; i++) + { + sw.Start(); + if(mode == 0) + print(URL); + else + NoPrint(URL); - sw.Stop(); - tab[i]=sw.ElapsedMilliseconds; - moyenne += tab[i]; - sw = Stopwatch.StartNew(); - } + sw.Stop(); + tab[i]=sw.ElapsedMilliseconds; + moyenne += tab[i]; + sw = Stopwatch.StartNew(); + } - Console.Clear(); - if(mode == 0) - for(int i = 0 ; i < compteur ; i++) - Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); - else - Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); - } + Console.Clear(); + if(mode == 0) + for(int i = 0 ; i < compteur ; i++) + Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms"); + else + Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms"); + } - private static void getMethode(string [] args) - { - int arg1,arg2; - string path =""; + private static void getMethode(string [] args) + { + int arg1,arg2; + string path =""; - arg1 = listeArgument.IndexOf("-url")+1; - arg2 = listeArgument.IndexOf("-save")+1; + arg1 = listeArgument.IndexOf("-url")+1; + arg2 = listeArgument.IndexOf("-save")+1; - if(arg2 > 1) - path = args[arg2]; + if(arg2 > 1) + path = args[arg2]; - print(args[arg1],path); - } + print(args[arg1],path); + } - private static void testMethode(string [] args) - { - int compteur,mode = 0; + private static void testMethode(string [] args) + { + int compteur,mode = 0; - if (listeArgument.IndexOf("-avg") > 0) - mode = 1; + if (listeArgument.IndexOf("-avg") > 0) + mode = 1; - try - { - compteur = Convert.ToInt32(args[listeArgument.IndexOf("-times") + 1]); - testSwitch(args[listeArgument.IndexOf("-url") + 1], compteur, mode); - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } + try + { + compteur = Convert.ToInt32(args[listeArgument.IndexOf("-times") + 1]); + testSwitch(args[listeArgument.IndexOf("-url") + 1], compteur, mode); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } } } \ No newline at end of file