diff --git a/README.md b/README.md index 4ceb1eb..d910cc6 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) + +FLAMANT Grégory-William \ No newline at end of file diff --git a/Students/flamant-gregory/nget-v1/nget/nget.sln b/Students/flamant-gregory/nget-v1/nget/nget.sln new file mode 100644 index 0000000..51ac4d8 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget", "nget\nget.csproj", "{2BE05532-1D3A-4338-AEAC-A3BDA4684F75}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2BE05532-1D3A-4338-AEAC-A3BDA4684F75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BE05532-1D3A-4338-AEAC-A3BDA4684F75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BE05532-1D3A-4338-AEAC-A3BDA4684F75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BE05532-1D3A-4338-AEAC-A3BDA4684F75}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Students/flamant-gregory/nget-v1/nget/nget/App.config b/Students/flamant-gregory/nget-v1/nget/nget/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Students/flamant-gregory/nget-v1/nget/nget/Menu.cs b/Students/flamant-gregory/nget-v1/nget/nget/Menu.cs new file mode 100644 index 0000000..3efc9a7 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/Menu.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace nget +{ + //Classe qui affiche les options à l'utilisateur mode console + class Menu + { + + } +} diff --git a/Students/flamant-gregory/nget-v1/nget/nget/MenuTraitement.cs b/Students/flamant-gregory/nget-v1/nget/nget/MenuTraitement.cs new file mode 100644 index 0000000..7d91f6b --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/MenuTraitement.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace nget +{ + //Traitement du choix/arguments de l'utilisateur + class MenuTraitement + { + //Arguments de l'utilisateur + string argument; + string[] arguments; + + public MenuTraitement(string[] args) + { + this.argument = string.Join(" ", args); + this.arguments = args; + matchRegle(); + } + + private void matchRegle() + { + Regles regles = new Regles(); + MatchCollection matche; + int ind = 0; + + foreach (Regex regle in regles.LstRegles) + { + matche = regle.Matches(this.argument); + Console.WriteLine("\nTest de la règle : " + ind); + if (matche.Count > 0) + { + doTraitement(ind); + break; + } + Console.WriteLine("Règle ne match pas.\n" + ind); + ind++; + } + } + + private void doTraitement(int traitement) + { + try + { + switch (traitement) + { + case 0: + try + { + using (System.Net.WebClient client = new WebClient()) + { + char[] separator = { '\"' }; + this.arguments[2] = this.arguments[2].Split(separator).ToString(); + string fileContent = client.DownloadString(this.arguments[2]); + Console.WriteLine(fileContent); + } + } + catch (Exception) + { + Console.WriteLine("Impossible d'accéder au site..."); + } + + break; + case 1: + + break; + case 2: + break; + case 3: + break; + default: + break; + } + } + catch (Exception) + { + Console.WriteLine("Une erreur est survenue..."); + } + + } + } +} diff --git a/Students/flamant-gregory/nget-v1/nget/nget/Program.cs b/Students/flamant-gregory/nget-v1/nget/nget/Program.cs new file mode 100644 index 0000000..ab7bcb2 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/Program.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace nget +{ + //Point d'entrée du programme + class Program + { + static void Main(string[] args) + { + new MenuTraitement(args); + Console.Read(); + } + } +} diff --git a/Students/flamant-gregory/nget-v1/nget/nget/Properties/AssemblyInfo.cs b/Students/flamant-gregory/nget-v1/nget/nget/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bb1a40a --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/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")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nget")] +[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("e854eaf4-3f8e-496b-8158-79fb17df67fb")] + +// 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/flamant-gregory/nget-v1/nget/nget/Regles.cs b/Students/flamant-gregory/nget-v1/nget/nget/Regles.cs new file mode 100644 index 0000000..668b410 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/Regles.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace nget +{ + class Regles + { + //Impossible d'utiliser var ça ne fonctionne pas... + List lstRegles = new List(); + + public Regles() + { + //Règle une + string pattern = @"get\\s-url\\s""[A-z|0-9|\\:|\\/]*"""; + lstRegles.Add(new Regex(pattern, RegexOptions.IgnoreCase)); + } + + public List LstRegles + { + get { return lstRegles; } + } + } +} diff --git a/Students/flamant-gregory/nget-v1/nget/nget/nget.csproj b/Students/flamant-gregory/nget-v1/nget/nget/nget.csproj new file mode 100644 index 0000000..3877dc4 --- /dev/null +++ b/Students/flamant-gregory/nget-v1/nget/nget/nget.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {2BE05532-1D3A-4338-AEAC-A3BDA4684F75} + 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