From edc741cf742dde38fb6fcfc0b93e07927d4315e8 Mon Sep 17 00:00:00 2001 From: RawSingh Date: Tue, 7 Apr 2015 15:17:37 +0200 Subject: [PATCH] v1 --- NGET/NGET.csproj | 58 ++++++++++++++++++++++ NGET/NGET.sln | 18 +++++++ NGET/Program.cs | 87 +++++++++++++++++++++++++++++++++ NGET/Properties/AssemblyInfo.cs | 31 ++++++++++++ NGET/app.config | 6 +++ 5 files changed, 200 insertions(+) create mode 100644 NGET/NGET.csproj create mode 100644 NGET/NGET.sln create mode 100644 NGET/Program.cs create mode 100644 NGET/Properties/AssemblyInfo.cs create mode 100644 NGET/app.config diff --git a/NGET/NGET.csproj b/NGET/NGET.csproj new file mode 100644 index 0000000..2612d70 --- /dev/null +++ b/NGET/NGET.csproj @@ -0,0 +1,58 @@ + + + + {5743BDA2-A34E-4402-8C53-6EA2B7AC9693} + {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/NGET/NGET.sln b/NGET/NGET.sln new file mode 100644 index 0000000..fcf9636 --- /dev/null +++ b/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", "{5743BDA2-A34E-4402-8C53-6EA2B7AC9693}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5743BDA2-A34E-4402-8C53-6EA2B7AC9693}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5743BDA2-A34E-4402-8C53-6EA2B7AC9693}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5743BDA2-A34E-4402-8C53-6EA2B7AC9693}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5743BDA2-A34E-4402-8C53-6EA2B7AC9693}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/NGET/Program.cs b/NGET/Program.cs new file mode 100644 index 0000000..a035103 --- /dev/null +++ b/NGET/Program.cs @@ -0,0 +1,87 @@ +/* + * Created by SharpDevelop. + * User: Rawinderjeet + * Date: 07/04/2015 + * Time: 12:03 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Diagnostics; +using System.Net; + +namespace NGET +{ + class Program + { + public static string url; + public static WebClient client; + + public Program(String url_link){ + url=url_link; + client = new WebClient (); + } + + public static string read(){ + string codeHtml = client.DownloadString(url); + return codeHtml; + } + + public static void write(string fileContent, string path){ + try{ + System.IO.File.WriteAllText(path, fileContent); + Console.WriteLine("Sauvegarde effectuée"); + } + catch(Exception e){ + Console.WriteLine(e); + } + + } + public static void times(int repeats, string Loadurl, bool avg){ + Stopwatch s; + long[] duration = new long[repeats]; + for (int i=0;i0 && args[1] == "-url"){ + new Program(args[2]); + if(args[0] == "get"){ + string fileContent = read(); + if(args.Length>3 && args[3] == "-save"){ + write(fileContent, args[4]); + } + else{ + Console.WriteLine(fileContent); + } + } + + else if(args[0] == "test" && args[3] == "-times"){ + int val = Convert.ToInt32(args[4]); + bool avg = false; + if(args.Length>5 && args[5] == "-avg"){ + avg = true; + } + times(val, args[2], avg); + } + } + } + } +} \ No newline at end of file diff --git a/NGET/Properties/AssemblyInfo.cs b/NGET/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cd77c87 --- /dev/null +++ b/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/NGET/app.config b/NGET/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/NGET/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file