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


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

Lucas Girardin <[email protected]>
22 changes: 22 additions & 0 deletions Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nget-v2", "nget-v1\nget-v2.csproj", "{D57D3113-D59A-4D98-8019-B717E40C2901}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
13 changes: 13 additions & 0 deletions Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Commande.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace nget_v1
{
public abstract class Commande
{
public Dictionary<string, string> args = new Dictionary<string,string>();
public abstract void execute();
}
}
45 changes: 45 additions & 0 deletions Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/CommandeGet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace nget_v1
{
public class CommandeGet : Commande
{
WebClient wc = null;

override
public void execute()
{
if (args.Keys.Contains("-url"))
{
if (args.Keys.Contains("-save"))
{
save(args["-url"], args["-save"]);
}
else
{
download(args["-url"]);
}
}
}

//Affiche le fichier passé en paramètre sur la console
public void download(String url)
{
Console.WriteLine("Download");
wc = new WebClient();
Console.WriteLine(wc.DownloadString(url));
}

//Enregistre le fichier passé en paramètre dans un fichier passé en second paramètre
public void save(String url, String path)
{
Console.WriteLine("Save");
wc = new WebClient();
wc.DownloadFile(url, path);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;

namespace nget_v1
{
public class CommandeTest : Commande
{
Stopwatch sw = null;
WebClient wc = null;

override
public void execute()
{
if (args.Keys.Contains("-url"))
{
if (args.Keys.Contains("-times"))
{
if (args.Keys.Contains("-avg"))
{
avg(args["-url"], args["-times"]);
}
else
{
time(args["-url"], args["-times"]);
}
}

}
}

//Calcule plusieur fois le temps requis pour charger un fichier en paramètre
public void time(String url, String nb)
{
Console.WriteLine("Time");
int n = 0;
try
{
n = Convert.ToInt32(nb);
}
catch (FormatException ex)
{
Console.WriteLine("Erreur d'argument");
return;
}
for (int i = 0; i < n; i++)
{
sw = new Stopwatch();
sw.Start();
wc = new WebClient();
wc.DownloadString(url);
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds + " ms");
}
}

//Calcule la moyenne le temps requis pour charger un fichier en paramètre
public void avg(String url, String nb)
{
Console.WriteLine("avg");
int n = 0;
try
{
n = Convert.ToInt32(nb);
}
catch (FormatException ex)
{
Console.WriteLine("Erreur d'argument");
return;
}
double moyenne = 0;
for (int i = 0; i < n; i++)
{
sw = new Stopwatch();
sw.Start();
wc = new WebClient();
wc.DownloadString(url);
sw.Stop();
moyenne += sw.ElapsedMilliseconds;
}
moyenne = moyenne / n;
Console.WriteLine("Moyenne : " + moyenne + " ms");
}
}
}
70 changes: 70 additions & 0 deletions Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Created by SharpDevelop.
* User: Lucas Girardin et Kevin Suy
* Date: 01/06/2015
* Time: 17:45
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Diagnostics;
using System.Net;

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

try
{
Instanciation.Execute(args);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("Appuyez sur n'improte quel touche pour fermer");
Console.ReadKey();
}



}

public class Instanciation
{
public static void Execute(string[] args)
{
Commande c = null;
if (args[0].Equals("get"))
{
c = new CommandeGet();
for (int i = 1; i < args.Length; i += 2)
{
c.args.Add(args[i], args[i + 1]);
}
}
if (args[0].Equals("test"))
{
c = new CommandeTest();
for (int i = 1; i < args.Length; i++)
{
if (args[i].Equals("-avg"))
{
c.args.Add(args[i], "");
}
else
{
c.args.Add(args[i], args[i + 1]);
i++;
}
}

}

c.execute();
}
}
}
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-v1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("nget-v1")]
[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.*")]
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>
61 changes: 61 additions & 0 deletions Students/Lucas-Girardin - Kevin Suy/nget-v2/nget-v1/nget-v2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{D57D3113-D59A-4D98-8019-B717E40C2901}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<RootNamespace>nget_v1</RootNamespace>
<AssemblyName>nget-v1</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="Commande.cs" />
<Compile Include="CommandeGet.cs" />
<Compile Include="CommandeTest.cs" />
<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/Lucas-Girardin/nget-v1/nget-v1.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-v1", "nget-v1\nget-v1.csproj", "{D57D3113-D59A-4D98-8019-B717E40C2901}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D57D3113-D59A-4D98-8019-B717E40C2901}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading