diff --git a/README.md b/README.md index 4ceb1eb..bc54e67 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@ English readme not available at this time, it's only available in [french](readme.fr.md) + +Lucas Girardin \ No newline at end of file diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1.sln b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1.sln new file mode 100644 index 0000000..121312a --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget-v2", "nget-v1\nget-v2.csproj", "{D57D3113-D59A-4D98-8019-B717E40C2901}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Commande.cs b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Commande.cs new file mode 100644 index 0000000..6e3d3d7 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Commande.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nget_v1 +{ + public abstract class Commande + { + public Dictionary args = new Dictionary(); + public abstract void execute(); + } +} diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeGet.cs b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeGet.cs new file mode 100644 index 0000000..37b9986 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeGet.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; + +namespace nget_v1 +{ + public class CommandeGet : Commande + { + WebClient wc = null; + + override + public void execute() + { + if (args.Keys.Contains("-url")) + { + if (args.Keys.Contains("-save")) + { + save(args["-url"], args["-save"]); + } + else + { + download(args["-url"]); + } + } + } + + //Affiche le fichier passé en paramètre sur la console + public void download(String url) + { + Console.WriteLine("Download"); + wc = new WebClient(); + Console.WriteLine(wc.DownloadString(url)); + } + + //Enregistre le fichier passé en paramètre dans un fichier passé en second paramètre + public void save(String url, String path) + { + Console.WriteLine("Save"); + wc = new WebClient(); + wc.DownloadFile(url, path); + } + } +} diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeTest.cs b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeTest.cs new file mode 100644 index 0000000..0164c89 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeTest.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Text; + +namespace nget_v1 +{ + public class CommandeTest : Commande + { + Stopwatch sw = null; + WebClient wc = null; + + override + public void execute() + { + if (args.Keys.Contains("-url")) + { + if (args.Keys.Contains("-times")) + { + if (args.Keys.Contains("-avg")) + { + avg(args["-url"], args["-times"]); + } + else + { + time(args["-url"], args["-times"]); + } + } + + } + } + + //Calcule plusieur fois le temps requis pour charger un fichier en paramètre + public void time(String url, String nb) + { + Console.WriteLine("Time"); + int n = 0; + try + { + n = Convert.ToInt32(nb); + } + catch (FormatException ex) + { + Console.WriteLine("Erreur d'argument"); + return; + } + for (int i = 0; i < n; i++) + { + sw = new Stopwatch(); + sw.Start(); + wc = new WebClient(); + wc.DownloadString(url); + sw.Stop(); + Console.WriteLine(sw.ElapsedMilliseconds + " ms"); + } + } + + //Calcule la moyenne le temps requis pour charger un fichier en paramètre + public void avg(String url, String nb) + { + Console.WriteLine("avg"); + int n = 0; + try + { + n = Convert.ToInt32(nb); + } + catch (FormatException ex) + { + Console.WriteLine("Erreur d'argument"); + return; + } + double moyenne = 0; + for (int i = 0; i < n; i++) + { + sw = new Stopwatch(); + sw.Start(); + wc = new WebClient(); + wc.DownloadString(url); + sw.Stop(); + moyenne += sw.ElapsedMilliseconds; + } + moyenne = moyenne / n; + Console.WriteLine("Moyenne : " + moyenne + " ms"); + } + } +} diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Program.cs b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Program.cs new file mode 100644 index 0000000..6d30a74 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Program.cs @@ -0,0 +1,70 @@ +/* + * Created by SharpDevelop. + * User: Lucas Girardin et Kevin Suy + * Date: 01/06/2015 + * Time: 17:45 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Diagnostics; +using System.Net; + +namespace nget_v1 +{ + class Program + { + public static void Main(string[] args) + { + + try + { + Instanciation.Execute(args); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + Console.WriteLine("Appuyez sur n'improte quel touche pour fermer"); + Console.ReadKey(); + } + + + + } + + public class Instanciation + { + public static void Execute(string[] args) + { + Commande c = null; + if (args[0].Equals("get")) + { + c = new CommandeGet(); + for (int i = 1; i < args.Length; i += 2) + { + c.args.Add(args[i], args[i + 1]); + } + } + if (args[0].Equals("test")) + { + c = new CommandeTest(); + for (int i = 1; i < args.Length; i++) + { + if (args[i].Equals("-avg")) + { + c.args.Add(args[i], ""); + } + else + { + c.args.Add(args[i], args[i + 1]); + i++; + } + } + + } + + c.execute(); + } + } +} \ No newline at end of file diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Properties/AssemblyInfo.cs b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0bebfb6 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/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-v1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget-v1")] +[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/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/app.config b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/nget-v2.csproj b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/nget-v2.csproj new file mode 100644 index 0000000..75a6407 --- /dev/null +++ b/Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/nget-v2.csproj @@ -0,0 +1,61 @@ + + + + {D57D3113-D59A-4D98-8019-B717E40C2901} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Exe + nget_v1 + nget-v1 + 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/Lucas-Girardin/nget-v1/nget-v1.sln b/Students/Lucas-Girardin/nget-v1/nget-v1.sln new file mode 100644 index 0000000..46c9cec --- /dev/null +++ b/Students/Lucas-Girardin/nget-v1/nget-v1.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-v1", "nget-v1\nget-v1.csproj", "{D57D3113-D59A-4D98-8019-B717E40C2901}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Students/Lucas-Girardin/nget-v1/nget-v1/Program.cs b/Students/Lucas-Girardin/nget-v1/nget-v1/Program.cs new file mode 100644 index 0000000..560aaa0 --- /dev/null +++ b/Students/Lucas-Girardin/nget-v1/nget-v1/Program.cs @@ -0,0 +1,110 @@ +/* + * Created by SharpDevelop. + * User: Lucas + * Date: 01/06/2015 + * Time: 17:45 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Diagnostics; +using System.Net; + +namespace nget_v1 +{ + class Program + { + public static void Main(string[] args) + { + + if(args.Length < 3){ + Console.WriteLine("Erreur, pas assez d'arguments"); + }else if(args.Length == 3){ + if(args[0].Equals("get") && args[1].Equals("-url")){ + Program.download(args[2]); + }else{ + Console.WriteLine("Erreur, arguments inconnus"); + } + }else if(args.Length == 5){ + if(args[0].Equals("get") && args[1].Equals("-url") + && args[3].Equals("-save")){ + Program.save(args[2], args[4]); + }else if(args[0].Equals("test") && args[1].Equals("-url") + && args[3].Equals("-times")){ + Program.time(args[2], args[4]); + }else{ + Console.WriteLine("Erreur, arguments inconnus"); + } + }else if(args.Length == 6){ + if(args[0].Equals("test") && args[1].Equals("-url") + && args[3].Equals("-times") && args[5].Equals("-avg")){ + Program.avg(args[2], args[4]); + }else{ + Console.WriteLine("Erreur, arguments inconnus"); + } + } + + Console.WriteLine("Appuyez sur n'improte quel touche pour fermer"); + Console.ReadKey(); + } + + //Affiche le fichier passé en paramètre sur la console + public static void download(String url){ + Console.WriteLine("Download"); + WebClient wc = new WebClient(); + Console.WriteLine(wc.DownloadString(url)); + } + + //Enregistre le fichier passé en paramètre dans un fichier passé en second paramètre + public static void save(String url, String path){ + Console.WriteLine("Save"); + WebClient wc = new WebClient(); + wc.DownloadFile(url, path); + } + + //Calcule plusieur fois le temps requis pour charger un fichier en paramètre + public static void time(String url, String nb){ + Console.WriteLine("Time"); + int n = 0; + try{ + n = Convert.ToInt32(nb); + }catch(FormatException ex){ + Console.WriteLine("Erreur d'argument"); + return; + } + for(int i = 0; i < n; i++){ + //Sert à calculer le temps d'excecution + Stopwatch sw = new Stopwatch(); + sw.Start(); + WebClient wc = new WebClient(); + wc.DownloadString(url); + sw.Stop(); + Console.WriteLine(sw.ElapsedMilliseconds + " ms"); + } + } + + //Calcule la moyenne le temps requis pour charger un fichier en paramètre + public static void avg(String url, String nb){ + Console.WriteLine("avg"); + int n = 0; + try{ + n = Convert.ToInt32(nb); + }catch(FormatException ex){ + Console.WriteLine("Erreur d'argument"); + return; + } + double moyenne = 0; + for(int i = 0; i < n; i++){ + //Sert à calculer le temps d'excecution + Stopwatch sw = new Stopwatch(); + sw.Start(); + WebClient wc = new WebClient(); + wc.DownloadString(url); + sw.Stop(); + moyenne += sw.ElapsedMilliseconds; + } + moyenne = moyenne /n; + Console.WriteLine("Moyenne : " + moyenne + " ms"); + } + } +} \ No newline at end of file diff --git a/Students/Lucas-Girardin/nget-v1/nget-v1/Properties/AssemblyInfo.cs b/Students/Lucas-Girardin/nget-v1/nget-v1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0bebfb6 --- /dev/null +++ b/Students/Lucas-Girardin/nget-v1/nget-v1/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-v1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget-v1")] +[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/Lucas-Girardin/nget-v1/nget-v1/app.config b/Students/Lucas-Girardin/nget-v1/nget-v1/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/Students/Lucas-Girardin/nget-v1/nget-v1/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/Lucas-Girardin/nget-v1/nget-v1/nget-v1.csproj b/Students/Lucas-Girardin/nget-v1/nget-v1/nget-v1.csproj new file mode 100644 index 0000000..9ddf0da --- /dev/null +++ b/Students/Lucas-Girardin/nget-v1/nget-v1/nget-v1.csproj @@ -0,0 +1,58 @@ + + + + {D57D3113-D59A-4D98-8019-B717E40C2901} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Exe + nget_v1 + nget-v1 + 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