diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/Students/pequin-mathieu/nget-v1/nget-v1.sln b/Students/pequin-mathieu/nget-v1/nget-v1.sln new file mode 100644 index 0000000..5548396 --- /dev/null +++ b/Students/pequin-mathieu/nget-v1/nget-v1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30110.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget-v1", "nget-v1\nget-v1.csproj", "{BEFCB489-3458-4442-8499-8CCE19D99379}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BEFCB489-3458-4442-8499-8CCE19D99379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BEFCB489-3458-4442-8499-8CCE19D99379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEFCB489-3458-4442-8499-8CCE19D99379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BEFCB489-3458-4442-8499-8CCE19D99379}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Students/pequin-mathieu/nget-v1/nget-v1/App.config b/Students/pequin-mathieu/nget-v1/nget-v1/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Students/pequin-mathieu/nget-v1/nget-v1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/pequin-mathieu/nget-v1/nget-v1/Program.cs b/Students/pequin-mathieu/nget-v1/nget-v1/Program.cs new file mode 100644 index 0000000..bb93720 --- /dev/null +++ b/Students/pequin-mathieu/nget-v1/nget-v1/Program.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +namespace nget +{ + class Program + { + static void Main(string[] args) + { + + if(args.Length < 3) + { + Console.WriteLine("Paramètres insuffisants"); + } + else + { + if(args[0].Equals("get") || args[0].Equals("test")) + { + if (args[1].Equals("-url")) + { + if (Uri.IsWellFormedUriString(args[2], UriKind.Absolute)) + { + string urlContent = ""; + + if (args[0].Equals("test") && args.Length >= 5) + { + if (args[3].Equals("-times")) + { + var times = new double[int.Parse(args[4])]; + for (int i = 0; i < int.Parse(args[4]);i++) + { + var watch = System.Diagnostics.Stopwatch.StartNew(); + doGetURLResource(args[2]); + watch.Stop(); + times[i] = watch.ElapsedMilliseconds; + Console.WriteLine(String.Format("Executed request in {0}",watch.ElapsedMilliseconds)); + + } + } + + } + + else{ + urlContent = doGetURLResource(args[2]); + Console.WriteLine(urlContent); + + } + + + if (args.Length == 5 && args[3].Equals("-save")) + { + Console.WriteLine(String.Format("Enregistrement du contenu dans le fichier {0}", args[4])); + saveUrlContent(urlContent, args[4]); + + } + + } + } + } + } + + + Console.ReadLine(); + } + + public static string doGetURLResource(string UrlString) + { + Console.WriteLine("L'URL saisie est valide"); + Console.WriteLine("Récupération du contenu..."); + using(System.Net.WebClient client = new System.Net.WebClient()) + { + return client.DownloadString(UrlString); + } + + } + + public static async void saveUrlContent(string content, string SavePath) + { + using(System.IO.FileStream outputfile = new System.IO.FileStream(SavePath, System.IO.FileMode.Create)) + { + using (System.IO.StreamWriter file = new System.IO.StreamWriter(outputfile, Encoding.UTF8)) + { + await file.WriteAsync(content.ToString()); + } + } + + + } + + + + } + + + +} diff --git a/Students/pequin-mathieu/nget-v1/nget-v1/Properties/AssemblyInfo.cs b/Students/pequin-mathieu/nget-v1/nget-v1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4c97c10 --- /dev/null +++ b/Students/pequin-mathieu/nget-v1/nget-v1/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-v1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget-v1")] +[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("be4526d1-da3a-4d0f-b928-aa7d5544f8a0")] + +// 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/pequin-mathieu/nget-v1/nget-v1/nget-v1.csproj b/Students/pequin-mathieu/nget-v1/nget-v1/nget-v1.csproj new file mode 100644 index 0000000..fdcbab3 --- /dev/null +++ b/Students/pequin-mathieu/nget-v1/nget-v1/nget-v1.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {BEFCB489-3458-4442-8499-8CCE19D99379} + 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