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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@


English readme not available at this time, it's only available in [french](readme.fr.md)


IMBART Emerich

[email protected]
115 changes: 115 additions & 0 deletions Students/IMBART-Emerich/nget-v1/nget/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Created by SharpDevelop.
* User: 626
* Date: 01/06/2015
* Time: 17:41
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;


namespace nget
{
class Program
{
public static void Main(string[] args)
{

if(args.Length == 3 && args[0] == "get" && args[1] == "-url") /* test requete de type ==> nget.exe get -url "http://abc" */
{
Console.WriteLine("Affichage du fichier \n\n ");
print(args[2]);
}
else if(args.Length == 5 && args[0] == "get" && args[1] == "-url" && args[3] == "-save") /* test requete de type ==> nget.exe get -url "http://abc" -save "c:\abc.json" */
{
Console.WriteLine("\n\nFichier : " + args[2] + " copié dans : \n" + args[4]);
download(args[2],args[4]);
}
else if(args.Length == 5 && args[0] == "test" && args[1] == "-url" && args[3] == "-times") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 */
{
int compteur;
try{
compteur = Convert.ToInt32(args[4]);
test(args[2],compteur,0);
}catch(Exception e){
Console.WriteLine(e.Message);
}
}
else if(args.Length == 6 && args[0] == "test" && args[1] == "-url" && args[3] == "-times" && args[5]=="-avg") /* test requete de type ==> nget.exe test -url "http://abc" -times 5 -avg */
{
int compteur;
try{
compteur = Convert.ToInt32(args[4]);
test(args[2],compteur,1);
}catch(Exception e){
Console.WriteLine(e.Message);
}
}

Console.ReadKey(true);
}

//Fonction de téléchargement de l'URL
private static void download(string URL, string path)
{
var wc = new System.Net.WebClient();
try{
wc.DownloadFile(URL, path);
}catch(System.Net.WebException e){
Console.WriteLine(e.Message);
}
}

//Fonction d'affichage de l'URL
private static void print(String URL)
{
var wc = new System.Net.WebClient();
try{
Console.WriteLine(wc.DownloadString(URL));
}catch(System.Net.WebException e){
Console.WriteLine(e.Message);
}

}

//fonciton de chargement de l'URL
private static void NoPrint(string URL)
{
var wc = new System.Net.WebClient();
wc.DownloadString(URL);
}

//Fonction de routage des tests de chargement
private static void test(string URL,int compteur, int mode)
{
long[] tab = new long[compteur];
long moyenne = 0;
Stopwatch sw = new Stopwatch(); // variable timer

for(int i = 0 ; i < compteur ; i++)
{
sw.Start();
if(mode == 0) // mode avec affichage
print(URL);
else
NoPrint(URL); // mode sans affichage

sw.Stop();
tab[i]=sw.ElapsedMilliseconds;
moyenne += tab[i];
sw = Stopwatch.StartNew(); // reset du timer
}

Console.Clear();
if(mode == 0)
for(int i = 0 ; i < compteur ; i++)
Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms");
else
Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms");
}
}
}
31 changes: 31 additions & 0 deletions Students/IMBART-Emerich/nget-v1/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 Students/IMBART-Emerich/nget-v1/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>
58 changes: 58 additions & 0 deletions Students/IMBART-Emerich/nget-v1/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>{4F423ADF-535C-4917-8B76-85CA115A59A1}</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 Students/IMBART-Emerich/nget-v1/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", "{4F423ADF-535C-4917-8B76-85CA115A59A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F423ADF-535C-4917-8B76-85CA115A59A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F423ADF-535C-4917-8B76-85CA115A59A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
120 changes: 120 additions & 0 deletions Students/IMBART-Emerich/nget-v2/nget/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* User: 626
* Date: 17/06/2015
* Time: 15:53
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;


namespace nget
{
class Program
{
private static List <string> listeDeCommande = new List<string>(new string[] { "get", "test"});
private static List <string> listeArgument;

public static void Main(string[] args)
{
listeArgument = new List<string>(args);

switch (listeDeCommande.IndexOf(args[0]) )
{
case 0 :
getMethode(args);
break;

case 1:
testMethode(args);
break;
}

Console.ReadKey(true);
}

private static void print(String URL, String path ="")
{
Console.WriteLine(path);
var wc = new System.Net.WebClient();
try{
if(path == "")
Console.WriteLine(wc.DownloadString(URL));
else
wc.DownloadFile(URL, path);
}catch(System.Net.WebException e){
Console.WriteLine(e.Message);
}
}

private static void NoPrint(string URL)
{
var wc = new System.Net.WebClient();
wc.DownloadString(URL);
}

private static void testSwitch(string URL,int compteur, int mode)
{
long[] tab = new long[compteur];
long moyenne = 0;
Stopwatch sw = new Stopwatch();

for(int i = 0 ; i < compteur ; i++)
{
sw.Start();
if(mode == 0)
print(URL);
else
NoPrint(URL);

sw.Stop();
tab[i]=sw.ElapsedMilliseconds;
moyenne += tab[i];
sw = Stopwatch.StartNew();
}

Console.Clear();
if(mode == 0)
for(int i = 0 ; i < compteur ; i++)
Console.WriteLine("Chargement : " + (i+1) + ": "+ tab[i] + "ms");
else
Console.WriteLine("Temps moyen de chargement " + moyenne/compteur +" ms");
}

private static void getMethode(string [] args)
{
int arg1,arg2;
string path ="";

arg1 = listeArgument.IndexOf("-url")+1;
arg2 = listeArgument.IndexOf("-save")+1;

if(arg2 > 1)
path = args[arg2];

print(args[arg1],path);
}

private static void testMethode(string [] args)
{
int compteur,mode = 0;

if (listeArgument.IndexOf("-avg") > 0)
mode = 1;

try
{
compteur = Convert.ToInt32(args[listeArgument.IndexOf("-times") + 1]);
testSwitch(args[listeArgument.IndexOf("-url") + 1], compteur, mode);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
31 changes: 31 additions & 0 deletions Students/IMBART-Emerich/nget-v2/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.*")]
Loading