Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions NGET/NGET.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{5743BDA2-A34E-4402-8C53-6EA2B7AC9693}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<RootNamespace>NGET</RootNamespace>
<AssemblyName>NGET</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
18 changes: 18 additions & 0 deletions NGET/NGET.sln
Original file line number Diff line number Diff line change
@@ -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
87 changes: 87 additions & 0 deletions NGET/Program.cs
Original file line number Diff line number Diff line change
@@ -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;i<repeats;i++){
s=Stopwatch.StartNew();
client.DownloadString(Loadurl);
s.Stop();
duration[i] = s.ElapsedMilliseconds;
if(avg){
long overallTime = 0;
for(i=0;i<duration.Length;i++){
overallTime += duration[i];
}
long average = overallTime / duration.Length;
Console.WriteLine(average + " ms");
}
else{
Console.WriteLine("Chargement n°"+(i+1)+" : "+duration[i]+" ms");
}
}
}

public static void Main(string[] args)
{
if(args.Length>0 && 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);
}
}
}
}
}
31 changes: 31 additions & 0 deletions NGET/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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.*")]
6 changes: 6 additions & 0 deletions NGET/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>