diff --git a/readme.fr.md b/readme.fr.md index 225c65b..0a33a47 100644 --- a/readme.fr.md +++ b/readme.fr.md @@ -31,7 +31,10 @@ Voici l'ensemble des options disponibles dans l'application: ## Etape 1 -1. Forkez ce repository +Nom : Cathelineau +Florian : Florian + +1. Forkez ce repository FAIT ! 1. Créez un répertoire `Students\nom-prenom\nget-v1` dans votre repository projet github. diff --git a/students/cathelineau-florian/cleancode-webget-tool.sln b/students/cathelineau-florian/cleancode-webget-tool.sln new file mode 100644 index 0000000..e18eca0 --- /dev/null +++ b/students/cathelineau-florian/cleancode-webget-tool.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "myWebGetTool", "myWebGetTool\myWebGetTool.csproj", "{8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/students/cathelineau-florian/cleancode-webget-tool.vcxproj b/students/cathelineau-florian/cleancode-webget-tool.vcxproj new file mode 100644 index 0000000..992b620 --- /dev/null +++ b/students/cathelineau-florian/cleancode-webget-tool.vcxproj @@ -0,0 +1,78 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C8067A96-FDF9-4BCA-B5DA-866ED3023EE6} + Win32Proj + + + + Application + true + v120 + + + Application + false + v120 + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + + + + + + + + \ No newline at end of file diff --git a/students/cathelineau-florian/cleancode-webget-tool.vcxproj.filters b/students/cathelineau-florian/cleancode-webget-tool.vcxproj.filters new file mode 100644 index 0000000..c04a89b --- /dev/null +++ b/students/cathelineau-florian/cleancode-webget-tool.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + \ No newline at end of file diff --git a/students/cathelineau-florian/myWebGetTool/App.config b/students/cathelineau-florian/myWebGetTool/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/students/cathelineau-florian/myWebGetTool/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/students/cathelineau-florian/myWebGetTool/MyWebGetTools.cs b/students/cathelineau-florian/myWebGetTool/MyWebGetTools.cs new file mode 100644 index 0000000..a8c66f3 --- /dev/null +++ b/students/cathelineau-florian/myWebGetTool/MyWebGetTools.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; + +namespace myWebGetTool +{ + class MyWebGetTools + { + private string[] arguments { get; set; } + public string commandType { get; set; } + public string errorMessage { get; set; } + public string[] optionsAvailable { get; set; } + public Dictionary options { get; set; } + //public File file { get; set; } + + public MyWebGetTools(string[] args) + { + this.arguments = args; + this.options = new Dictionary(); + foreach (string a in args) + Console.WriteLine(a); + + } + + public void run() + { + if (this.verifyArguments() == true) + { + Console.WriteLine(this.getUrlContent(this.options["url"])); + } + } + + public StreamReader getUrlContent(string url) + { + try + { + WebRequest req = WebRequest.Create(url); + Stream objStream = req.GetResponse().GetResponseStream(); + StreamReader sr = new StreamReader(objStream); + objStream.Dispose(); + sr.Dispose(); + return sr; + + + } + catch (Exception ex) + { + throw ex; + } + } + + public Boolean verifyArguments() + { + + //test + //Console.WriteLine(arguments[0]); + + // 1st Arg : commandType (Get or Test) + if (arguments[0] == "test" || arguments[0] == "get") + { + this.commandType = arguments[0]; + } + else + { + errorMessage = "Argument 1 invalid"; + printError(); + return false; + } + + Console.WriteLine("PREMIER TEST PASSE"); + + //2nd and 3rd args must be urls + if (arguments[1] == "-url")// && arguments[2].Substring(0, 7) == "http://") + { + this.options.Add("url", arguments[2]); + } + else + return false; + + Console.WriteLine("DEUXIEME TEST PASSE"); + /* + for (int i = 3; i < arguments.Length; i++) + { + if ((i + 1) < arguments.Length && isKeyValid(arguments[i]) == true) + { + this.options.Add(arguments[i], arguments[i + 1]); + } + } + */ + return true; + } + + private Boolean isKeyValid(String key) + { + foreach(String opt in this.optionsAvailable){ + if(opt == key){ + return true; + } + } + return false; + } + + public void printError() + { + Console.WriteLine("Error : " + this.errorMessage); + this.errorMessage = ""; + } + + public void writeFile(Stream s) + { + + } + } +} diff --git a/students/cathelineau-florian/myWebGetTool/Program.cs b/students/cathelineau-florian/myWebGetTool/Program.cs new file mode 100644 index 0000000..dec10d9 --- /dev/null +++ b/students/cathelineau-florian/myWebGetTool/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace myWebGetTool +{ + class Program + { + static void Main(string[] args) + { + MyWebGetTools myTool = new MyWebGetTools(args); + myTool.run(); + } + + + } +} diff --git a/students/cathelineau-florian/myWebGetTool/Properties/AssemblyInfo.cs b/students/cathelineau-florian/myWebGetTool/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..99de502 --- /dev/null +++ b/students/cathelineau-florian/myWebGetTool/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("myWebGetTool")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("myWebGetTool")] +[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("efe4950e-38f6-44a0-acdb-76ce2bc889d9")] + +// 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/cathelineau-florian/myWebGetTool/myWebGetTool.csproj b/students/cathelineau-florian/myWebGetTool/myWebGetTool.csproj new file mode 100644 index 0000000..63f2ee3 --- /dev/null +++ b/students/cathelineau-florian/myWebGetTool/myWebGetTool.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {8805D55F-D1AC-45AC-9BA7-0E2FE6F5295E} + Exe + Properties + myWebGetTool + myWebGetTool + 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