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 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 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..edad185 --- /dev/null +++ b/Students/IMBART-Emerich/nget-v2/nget/Program.cs @@ -0,0 +1,120 @@ +/* + * User: 626 + * 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; + + +namespace nget +{ + class Program + { + private static List listeDeCommande = new List(new string[] { "get", "test"}); + private static List listeArgument; + + public static void Main(string[] args) + { + listeArgument = new List(args); + + switch (listeDeCommande.IndexOf(args[0]) ) + { + case 0 : + getMethode(args); + break; + + case 1: + testMethode(args); + break; + } + + 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 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(); + + 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(); + } + + 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 =""; + + 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 = 0; + + 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); + } + } + } +} \ 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 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