Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
IUT
s32_TRON
Commits
6a939fae
Commit
6a939fae
authored
6 years ago
by
teyermann
Browse files
Options
Download
Plain Diff
conflits
parents
028faecf
ad9e37e7
Changes
86
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
869 additions
and
874 deletions
+869
-874
Tron/TronClient/TronClient/Properties/Settings.settings
Tron/TronClient/TronClient/Properties/Settings.settings
+7
-7
Tron/TronClient/TronClient/Tron.cs
Tron/TronClient/TronClient/Tron.cs
+194
-194
Tron/TronClient/TronClient/TronClient.csproj
Tron/TronClient/TronClient/TronClient.csproj
+105
-105
Tron/TronClient/TronClient/obj/Debug/TronClient.csproj.CoreCompileInputs.cache
...lient/obj/Debug/TronClient.csproj.CoreCompileInputs.cache
+0
-1
Tron/TronClient/TronClient/obj/Debug/TronClient.csprojAssemblyReference.cache
...Client/obj/Debug/TronClient.csprojAssemblyReference.cache
+0
-0
Tron/TronClient/TronClient/obj/Release/TronClient.csproj.CoreCompileInputs.cache
...ent/obj/Release/TronClient.csproj.CoreCompileInputs.cache
+0
-1
Tron/TronServeur/TronServeur.sln
Tron/TronServeur/TronServeur.sln
+20
-20
Tron/TronServeur/TronServeur/Program.cs
Tron/TronServeur/TronServeur/Program.cs
+61
-61
Tron/TronServeur/TronServeur/Properties/AssemblyInfo.cs
Tron/TronServeur/TronServeur/Properties/AssemblyInfo.cs
+36
-36
Tron/TronServeur/TronServeur/Tron.cs
Tron/TronServeur/TronServeur/Tron.cs
+194
-194
Tron/TronServeur/TronServeur/TronServeur.csproj
Tron/TronServeur/TronServeur/TronServeur.csproj
+66
-66
Tron/TronServeur/TronServeur/obj/Debug/TronServeur.csproj.CoreCompileInputs.cache
...veur/obj/Debug/TronServeur.csproj.CoreCompileInputs.cache
+0
-1
Tron/TronServeur/TronServeur/obj/Debug/TronServeur.csprojAssemblyReference.cache
...rveur/obj/Debug/TronServeur.csprojAssemblyReference.cache
+0
-0
Tron/TronServeur/TronServeur/obj/Release/TronServeur.csproj.CoreCompileInputs.cache
...ur/obj/Release/TronServeur.csproj.CoreCompileInputs.cache
+0
-1
Tron/TronServeur/TronServeur/obj/Release/TronServeur.csprojAssemblyReference.cache
...eur/obj/Release/TronServeur.csprojAssemblyReference.cache
+0
-0
exemples/TCP/clientTcp/clientTcp.sln
exemples/TCP/clientTcp/clientTcp.sln
+20
-20
exemples/TCP/clientTcp/clientTcp/ClientTcp.cs
exemples/TCP/clientTcp/clientTcp/ClientTcp.cs
+74
-74
exemples/TCP/clientTcp/clientTcp/Properties/AssemblyInfo.cs
exemples/TCP/clientTcp/clientTcp/Properties/AssemblyInfo.cs
+36
-36
exemples/TCP/clientTcp/clientTcp/clientTcp.csproj
exemples/TCP/clientTcp/clientTcp/clientTcp.csproj
+56
-56
exemples/TCP/clientTcp/clientTcp/obj/x86/Debug/clientTcp.csproj.CoreCompileInputs.cache
...cp/obj/x86/Debug/clientTcp.csproj.CoreCompileInputs.cache
+0
-1
No files found.
Tron/TronClient/TronClient/Properties/Settings.settings
View file @
6a939fae
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile
xmlns=
"http://schemas.microsoft.com/VisualStudio/2004/01/settings"
CurrentProfile=
"(Default)"
>
<Profiles>
<Profile
Name=
"(Default)"
/>
</Profiles>
<Settings
/>
</SettingsFile>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile
xmlns=
"http://schemas.microsoft.com/VisualStudio/2004/01/settings"
CurrentProfile=
"(Default)"
>
<Profiles>
<Profile
Name=
"(Default)"
/>
</Profiles>
<Settings
/>
</SettingsFile>
This diff is collapsed.
Click to expand it.
Tron/TronClient/TronClient/Tron.cs
View file @
6a939fae
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Tron
{
public
class
Tron
{
private
byte
taille
;
// taille du terrain
private
byte
nJoueurs
;
// nombre de joueurs
private
byte
monNum
;
// numéro du joueur courrant
protected
byte
[]
directions
;
// 1=haut, 2=bas, 3=gauche, 4=droite, 5=perdu, 6=gagne
protected
int
[,]
marque
;
// qui est passé où
protected
int
[]
posX
,
posY
;
// positions courrante des joueurs
protected
byte
oldDirection
;
// ancienne position du joueur courrant
protected
int
nVivants
=
0
;
// nombre de joueurs encore vivant
// Constructeur à utiliser côté serveur
public
Tron
(
byte
myNJoueurs
,
byte
myTaille
)
:
this
(
myTaille
,
myNJoueurs
,
0
)
{
}
// Constructeur à utiliser côté client
public
Tron
(
byte
myTaille
,
byte
myNJoueurs
,
byte
myMonNum
)
{
taille
=
myTaille
;
nJoueurs
=
myNJoueurs
;
monNum
=
myMonNum
;
posX
=
new
int
[
nJoueurs
];
posY
=
new
int
[
nJoueurs
];
directions
=
new
byte
[
nJoueurs
];
marque
=
new
int
[
taille
,
taille
];
oldDirection
=
0
;
Init
();
}
public
byte
getTaille
()
{
return
taille
;
}
public
byte
getNJoueurs
()
{
return
nJoueurs
;
}
public
byte
getMonNum
()
{
return
monNum
;
}
public
int
getPosX
(
int
i
)
{
return
posX
[
i
];
}
public
int
getPosY
(
int
i
)
{
return
posY
[
i
];
}
public
byte
getDirection
()
{
return
directions
[
monNum
];
}
public
byte
[]
getDirections
()
{
return
directions
;
}
public
void
setDirections
(
byte
[]
d
)
{
directions
=
d
;
}
// initialisation du terrain
public
void
Init
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
directions
[
i
]
=
(
byte
)(
3
-
(
i
%
2
));
posX
[
i
]
=
taille
/
4
*
(
1
+
2
*
(
i
%
2
));
if
(
nJoueurs
%
2
==
1
)
posY
[
i
]
=
taille
/
(
nJoueurs
+
1
)
*
(
i
+
1
);
else
posY
[
i
]
=
taille
/
(
nJoueurs
/
2
+
1
)
*
((
int
)(
i
/
2
)
+
1
);
Console
.
WriteLine
(
posX
[
i
]
+
","
+
posY
[
i
]);
}
for
(
int
i
=
0
;
i
<
taille
;
i
++)
{
for
(
int
j
=
0
;
j
<
taille
;
j
++)
{
marque
[
i
,
j
]
=
-
1
;
}
}
}
// deplacement des joueurs
// MAJ des PosX et posY en fonction de directions
public
void
Deplacement
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
switch
(
directions
[
i
])
{
case
0
:
posY
[
i
]--;
if
(
posY
[
i
]
<
0
)
posY
[
i
]
=
taille
-
1
;
break
;
case
1
:
posY
[
i
]++;
if
(
posY
[
i
]
>=
taille
)
posY
[
i
]
=
0
;
break
;
case
2
:
posX
[
i
]--;
if
(
posX
[
i
]
<
0
)
posX
[
i
]
=
taille
-
1
;
break
;
case
3
:
posX
[
i
]++;
if
(
posX
[
i
]
>=
taille
)
posX
[
i
]
=
0
;
break
;
}
}
}
// Detection des collisions
// MAJ de directions en fonction des collisions
// Appelle Deplacement()
public
void
Collision
()
{
Collision
(
directions
);
}
public
void
Collision
(
byte
[]
myDirections
)
{
directions
=
myDirections
;
nVivants
=
0
;
int
vivant
=
-
1
;
Deplacement
();
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
if
(
marque
[
posX
[
i
],
posY
[
i
]]
!=
-
1
)
{
directions
[
i
]
=
4
;
Console
.
WriteLine
(
"fail "
+
i
);
}
else
{
for
(
int
j
=
i
+
1
;
j
<
nJoueurs
;
j
++)
{
if
(
posX
[
i
]
==
posX
[
j
]
&&
posY
[
i
]
==
posY
[
j
])
{
Console
.
WriteLine
(
"fail "
+
i
+
" "
+
j
);
directions
[
i
]
=
4
;
directions
[
j
]
=
4
;
}
}
marque
[
posX
[
i
],
posY
[
i
]]
=
i
;
}
if
(
directions
[
i
]
!=
4
)
{
nVivants
++;
vivant
=
i
;
}
}
if
(
nVivants
==
1
)
directions
[
vivant
]
=
5
;
}
// modifie la direction du joueur courrant
public
void
GoUp
()
{
directions
[
monNum
]
=
0
;
}
public
void
GoDown
()
{
directions
[
monNum
]
=
1
;
}
public
void
GoLeft
()
{
directions
[
monNum
]
=
2
;
}
public
void
GoRight
()
{
directions
[
monNum
]
=
3
;
}
//retourne vrai si le joueur courrant est mort
public
Boolean
IsDead
()
{
return
(
directions
[
monNum
]
==
4
);
}
//retourne vrai si le joueur courrant est gagnant
public
Boolean
IsWinner
()
{
return
(
directions
[
monNum
]
==
5
);
}
//retourne vrai si la partie est finie
public
Boolean
IsFinished
()
{
nVivants
=
0
;
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
if
(
directions
[
i
]
<
4
)
nVivants
++;
return
(
nVivants
<
2
);
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Tron
{
public
class
Tron
{
private
byte
taille
;
// taille du terrain
private
byte
nJoueurs
;
// nombre de joueurs
private
byte
monNum
;
// numéro du joueur courrant
protected
byte
[]
directions
;
// 1=haut, 2=bas, 3=gauche, 4=droite, 5=perdu, 6=gagne
protected
int
[,]
marque
;
// qui est passé où
protected
int
[]
posX
,
posY
;
// positions courrante des joueurs
protected
byte
oldDirection
;
// ancienne position du joueur courrant
protected
int
nVivants
=
0
;
// nombre de joueurs encore vivant
// Constructeur à utiliser côté serveur
public
Tron
(
byte
myNJoueurs
,
byte
myTaille
)
:
this
(
myTaille
,
myNJoueurs
,
0
)
{
}
// Constructeur à utiliser côté client
public
Tron
(
byte
myTaille
,
byte
myNJoueurs
,
byte
myMonNum
)
{
taille
=
myTaille
;
nJoueurs
=
myNJoueurs
;
monNum
=
myMonNum
;
posX
=
new
int
[
nJoueurs
];
posY
=
new
int
[
nJoueurs
];
directions
=
new
byte
[
nJoueurs
];
marque
=
new
int
[
taille
,
taille
];
oldDirection
=
0
;
Init
();
}
public
byte
getTaille
()
{
return
taille
;
}
public
byte
getNJoueurs
()
{
return
nJoueurs
;
}
public
byte
getMonNum
()
{
return
monNum
;
}
public
int
getPosX
(
int
i
)
{
return
posX
[
i
];
}
public
int
getPosY
(
int
i
)
{
return
posY
[
i
];
}
public
byte
getDirection
()
{
return
directions
[
monNum
];
}
public
byte
[]
getDirections
()
{
return
directions
;
}
public
void
setDirections
(
byte
[]
d
)
{
directions
=
d
;
}
// initialisation du terrain
public
void
Init
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
directions
[
i
]
=
(
byte
)(
3
-
(
i
%
2
));
posX
[
i
]
=
taille
/
4
*
(
1
+
2
*
(
i
%
2
));
if
(
nJoueurs
%
2
==
1
)
posY
[
i
]
=
taille
/
(
nJoueurs
+
1
)
*
(
i
+
1
);
else
posY
[
i
]
=
taille
/
(
nJoueurs
/
2
+
1
)
*
((
int
)(
i
/
2
)
+
1
);
Console
.
WriteLine
(
posX
[
i
]
+
","
+
posY
[
i
]);
}
for
(
int
i
=
0
;
i
<
taille
;
i
++)
{
for
(
int
j
=
0
;
j
<
taille
;
j
++)
{
marque
[
i
,
j
]
=
-
1
;
}
}
}
// deplacement des joueurs
// MAJ des PosX et posY en fonction de directions
public
void
Deplacement
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
switch
(
directions
[
i
])
{
case
0
:
posY
[
i
]--;
if
(
posY
[
i
]
<
0
)
posY
[
i
]
=
taille
-
1
;
break
;
case
1
:
posY
[
i
]++;
if
(
posY
[
i
]
>=
taille
)
posY
[
i
]
=
0
;
break
;
case
2
:
posX
[
i
]--;
if
(
posX
[
i
]
<
0
)
posX
[
i
]
=
taille
-
1
;
break
;
case
3
:
posX
[
i
]++;
if
(
posX
[
i
]
>=
taille
)
posX
[
i
]
=
0
;
break
;
}
}
}
// Detection des collisions
// MAJ de directions en fonction des collisions
// Appelle Deplacement()
public
void
Collision
()
{
Collision
(
directions
);
}
public
void
Collision
(
byte
[]
myDirections
)
{
directions
=
myDirections
;
nVivants
=
0
;
int
vivant
=
-
1
;
Deplacement
();
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
if
(
marque
[
posX
[
i
],
posY
[
i
]]
!=
-
1
)
{
directions
[
i
]
=
4
;
Console
.
WriteLine
(
"fail "
+
i
);
}
else
{
for
(
int
j
=
i
+
1
;
j
<
nJoueurs
;
j
++)
{
if
(
posX
[
i
]
==
posX
[
j
]
&&
posY
[
i
]
==
posY
[
j
])
{
Console
.
WriteLine
(
"fail "
+
i
+
" "
+
j
);
directions
[
i
]
=
4
;
directions
[
j
]
=
4
;
}
}
marque
[
posX
[
i
],
posY
[
i
]]
=
i
;
}
if
(
directions
[
i
]
!=
4
)
{
nVivants
++;
vivant
=
i
;
}
}
if
(
nVivants
==
1
)
directions
[
vivant
]
=
5
;
}
// modifie la direction du joueur courrant
public
void
GoUp
()
{
directions
[
monNum
]
=
0
;
}
public
void
GoDown
()
{
directions
[
monNum
]
=
1
;
}
public
void
GoLeft
()
{
directions
[
monNum
]
=
2
;
}
public
void
GoRight
()
{
directions
[
monNum
]
=
3
;
}
//retourne vrai si le joueur courrant est mort
public
Boolean
IsDead
()
{
return
(
directions
[
monNum
]
==
4
);
}
//retourne vrai si le joueur courrant est gagnant
public
Boolean
IsWinner
()
{
return
(
directions
[
monNum
]
==
5
);
}
//retourne vrai si la partie est finie
public
Boolean
IsFinished
()
{
nVivants
=
0
;
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
if
(
directions
[
i
]
<
4
)
nVivants
++;
return
(
nVivants
<
2
);
}
}
}
This diff is collapsed.
Click to expand it.
Tron/TronClient/TronClient/TronClient.csproj
View file @
6a939fae
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{6EF53F4A-0583-431C-ADEF-2353E489C9BA}
</ProjectGuid>
<OutputType>
WinExe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
TronClient
</RootNamespace>
<AssemblyName>
TronClient
</AssemblyName>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>
3.5
</OldToolsVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Xml.Linq"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data.DataSetExtensions"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Deployment"
/>
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.Windows.Forms"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Client.cs"
/>
<Compile
Include=
"FormLobby.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"FormLobby.Designer.cs"
>
<DependentUpon>
FormLobby.cs
</DependentUpon>
</Compile>
<Compile
Include=
"FormTron.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"FormTron.Designer.cs"
>
<DependentUpon>
FormTron.cs
</DependentUpon>
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<EmbeddedResource
Include=
"FormLobby.resx"
>
<DependentUpon>
FormLobby.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"FormTron.resx"
>
<DependentUpon>
FormTron.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
Resources.Designer.cs
</LastGenOutput>
<SubType>
Designer
</SubType>
</EmbeddedResource>
<Compile
Include=
"Properties\Resources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Resources.resx
</DependentUpon>
<DesignTime>
True
</DesignTime>
</Compile>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
</None>
<Compile
Include=
"Properties\Settings.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Settings.settings
</DependentUpon>
<DesignTimeSharedInput>
True
</DesignTimeSharedInput>
</Compile>
<Compile
Include=
"Tron.cs"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{6EF53F4A-0583-431C-ADEF-2353E489C9BA}
</ProjectGuid>
<OutputType>
WinExe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
TronClient
</RootNamespace>
<AssemblyName>
TronClient
</AssemblyName>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>
3.5
</OldToolsVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Xml.Linq"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data.DataSetExtensions"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Deployment"
/>
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.Windows.Forms"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Client.cs"
/>
<Compile
Include=
"FormLobby.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"FormLobby.Designer.cs"
>
<DependentUpon>
FormLobby.cs
</DependentUpon>
</Compile>
<Compile
Include=
"FormTron.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"FormTron.Designer.cs"
>
<DependentUpon>
FormTron.cs
</DependentUpon>
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<EmbeddedResource
Include=
"FormLobby.resx"
>
<DependentUpon>
FormLobby.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"FormTron.resx"
>
<DependentUpon>
FormTron.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
Resources.Designer.cs
</LastGenOutput>
<SubType>
Designer
</SubType>
</EmbeddedResource>
<Compile
Include=
"Properties\Resources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Resources.resx
</DependentUpon>
<DesignTime>
True
</DesignTime>
</Compile>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
</None>
<Compile
Include=
"Properties\Settings.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Settings.settings
</DependentUpon>
<DesignTimeSharedInput>
True
</DesignTimeSharedInput>
</Compile>
<Compile
Include=
"Tron.cs"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Tron/TronClient/TronClient/obj/Debug/TronClient.csproj.CoreCompileInputs.cache
deleted
100644 → 0
View file @
028faecf
a5c4da78f5cd63177f216f4ea40ccc6fc87d4328
This diff is collapsed.
Click to expand it.
Tron/TronClient/TronClient/obj/Debug/TronClient.csprojAssemblyReference.cache
deleted
100644 → 0
View file @
028faecf
File deleted
This diff is collapsed.
Click to expand it.
Tron/TronClient/TronClient/obj/Release/TronClient.csproj.CoreCompileInputs.cache
deleted
100644 → 0
View file @
028faecf
a5c4da78f5cd63177f216f4ea40ccc6fc87d4328
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur.sln
View file @
6a939fae
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TronServeur", "TronServeur\TronServeur.csproj", "{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TronServeur", "TronServeur\TronServeur.csproj", "{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/Program.cs
View file @
6a939fae
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.IO
;
using
System.Threading
;
namespace
TronServeur
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
Tron
.
Tron
myTron
;
// Moteur du jeu
byte
nJoueurs
=
2
;
// Nombre de joueurs
byte
frequence
=
10
;
// Temps du tour de jeu (en dixieme de s)
byte
taille
=
60
;
// Taille du terrain
// ************************************* Intitialisation partie
System
.
Console
.
WriteLine
(
"Initialisation"
);
// TODO Creation de la socket d'écoute TCP
// TODO Creation du tableau des sockets connectées
// Creation du moteur de jeu
myTron
=
new
Tron
.
Tron
(
nJoueurs
,
taille
);
// TODO Bind et listen
// TODO Acceptation des clients
// TODO Envoie des paramètres
// ************************************* Routine à chaque tour
System
.
Console
.
WriteLine
(
"Routine"
);
// Tant que la partie n'est pas finie
while
(!
myTron
.
IsFinished
())
{
// TODO Réception de la direction de chaque joueur
// TODO Calcul collision : myTron.Collision(byte[] <toutes les directions>);
// TODO Envoie des directions de tous les joueurs à tous les clients
}
// ************************************* Conclusion
System
.
Console
.
WriteLine
(
"Conclusion"
);
// TODO Fermeture des sockets connectées
// TODO Fermeture socket d'écoute
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.IO
;
using
System.Threading
;
namespace
TronServeur
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
Tron
.
Tron
myTron
;
// Moteur du jeu
byte
nJoueurs
=
2
;
// Nombre de joueurs
byte
frequence
=
10
;
// Temps du tour de jeu (en dixieme de s)
byte
taille
=
60
;
// Taille du terrain
// ************************************* Intitialisation partie
System
.
Console
.
WriteLine
(
"Initialisation"
);
// TODO Creation de la socket d'écoute TCP
// TODO Creation du tableau des sockets connectées
// Creation du moteur de jeu
myTron
=
new
Tron
.
Tron
(
nJoueurs
,
taille
);
// TODO Bind et listen
// TODO Acceptation des clients
// TODO Envoie des paramètres
// ************************************* Routine à chaque tour
System
.
Console
.
WriteLine
(
"Routine"
);
// Tant que la partie n'est pas finie
while
(!
myTron
.
IsFinished
())
{
// TODO Réception de la direction de chaque joueur
// TODO Calcul collision : myTron.Collision(byte[] <toutes les directions>);
// TODO Envoie des directions de tous les joueurs à tous les clients
}
// ************************************* Conclusion
System
.
Console
.
WriteLine
(
"Conclusion"
);
// TODO Fermeture des sockets connectées
// TODO Fermeture socket d'écoute
}
}
}
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/Properties/AssemblyInfo.cs
View file @
6a939fae
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// 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
(
"TronServeur"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
"Microsoft"
)]
[
assembly
:
AssemblyProduct
(
"TronServeur"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © Microsoft 2010"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[
assembly
:
ComVisible
(
false
)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[
assembly
:
Guid
(
"56b93117-2a7e-4bd0-afa9-931eda1df077"
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// 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
(
"TronServeur"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
"Microsoft"
)]
[
assembly
:
AssemblyProduct
(
"TronServeur"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © Microsoft 2010"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[
assembly
:
ComVisible
(
false
)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[
assembly
:
Guid
(
"56b93117-2a7e-4bd0-afa9-931eda1df077"
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/Tron.cs
View file @
6a939fae
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Tron
{
public
class
Tron
{
private
byte
taille
;
// taille du terrain
private
byte
nJoueurs
;
// nombre de joueurs
private
byte
monNum
;
// numéro du joueur courrant
protected
byte
[]
directions
;
// 1=haut, 2=bas, 3=gauche, 4=droite, 5=perdu, 6=gagne
protected
int
[,]
marque
;
// qui est passé où
protected
int
[]
posX
,
posY
;
// positions courrante des joueurs
protected
byte
oldDirection
;
// ancienne position du joueur courrant
protected
int
nVivants
=
0
;
// nombre de joueurs encore vivant
// Constructeur à utiliser côté serveur
public
Tron
(
byte
myNJoueurs
,
byte
myTaille
)
:
this
(
myTaille
,
myNJoueurs
,
0
)
{
}
// Constructeur à utiliser côté client
public
Tron
(
byte
myTaille
,
byte
myNJoueurs
,
byte
myMonNum
)
{
taille
=
myTaille
;
nJoueurs
=
myNJoueurs
;
monNum
=
myMonNum
;
posX
=
new
int
[
nJoueurs
];
posY
=
new
int
[
nJoueurs
];
directions
=
new
byte
[
nJoueurs
];
marque
=
new
int
[
taille
,
taille
];
oldDirection
=
0
;
Init
();
}
public
byte
getTaille
()
{
return
taille
;
}
public
byte
getNJoueurs
()
{
return
nJoueurs
;
}
public
byte
getMonNum
()
{
return
monNum
;
}
public
int
getPosX
(
int
i
)
{
return
posX
[
i
];
}
public
int
getPosY
(
int
i
)
{
return
posY
[
i
];
}
public
byte
getDirection
()
{
return
directions
[
monNum
];
}
public
byte
[]
getDirections
()
{
return
directions
;
}
public
void
setDirections
(
byte
[]
d
)
{
directions
=
d
;
}
// initialisation du terrain
public
void
Init
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
directions
[
i
]
=
(
byte
)(
3
-
(
i
%
2
));
posX
[
i
]
=
taille
/
4
*
(
1
+
2
*
(
i
%
2
));
if
(
nJoueurs
%
2
==
1
)
posY
[
i
]
=
taille
/
(
nJoueurs
+
1
)
*
(
i
+
1
);
else
posY
[
i
]
=
taille
/
(
nJoueurs
/
2
+
1
)
*
((
int
)(
i
/
2
)
+
1
);
Console
.
WriteLine
(
posX
[
i
]
+
","
+
posY
[
i
]);
}
for
(
int
i
=
0
;
i
<
taille
;
i
++)
{
for
(
int
j
=
0
;
j
<
taille
;
j
++)
{
marque
[
i
,
j
]
=
-
1
;
}
}
}
// deplacement des joueurs
// MAJ des PosX et posY en fonction de directions
public
void
Deplacement
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
switch
(
directions
[
i
])
{
case
0
:
posY
[
i
]--;
if
(
posY
[
i
]
<
0
)
posY
[
i
]
=
taille
-
1
;
break
;
case
1
:
posY
[
i
]++;
if
(
posY
[
i
]
>=
taille
)
posY
[
i
]
=
0
;
break
;
case
2
:
posX
[
i
]--;
if
(
posX
[
i
]
<
0
)
posX
[
i
]
=
taille
-
1
;
break
;
case
3
:
posX
[
i
]++;
if
(
posX
[
i
]
>=
taille
)
posX
[
i
]
=
0
;
break
;
}
}
}
// Detection des collisions
// MAJ de directions en fonction des collisions
// Appelle Deplacement()
public
void
Collision
()
{
Collision
(
directions
);
}
public
void
Collision
(
byte
[]
myDirections
)
{
directions
=
myDirections
;
nVivants
=
0
;
int
vivant
=
-
1
;
Deplacement
();
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
if
(
marque
[
posX
[
i
],
posY
[
i
]]
!=
-
1
)
{
directions
[
i
]
=
4
;
Console
.
WriteLine
(
"fail "
+
i
);
}
else
{
for
(
int
j
=
i
+
1
;
j
<
nJoueurs
;
j
++)
{
if
(
posX
[
i
]
==
posX
[
j
]
&&
posY
[
i
]
==
posY
[
j
])
{
Console
.
WriteLine
(
"fail "
+
i
+
" "
+
j
);
directions
[
i
]
=
4
;
directions
[
j
]
=
4
;
}
}
marque
[
posX
[
i
],
posY
[
i
]]
=
i
;
}
if
(
directions
[
i
]
!=
4
)
{
nVivants
++;
vivant
=
i
;
}
}
if
(
nVivants
==
1
)
directions
[
vivant
]
=
5
;
}
// modifie la direction du joueur courrant
public
void
GoUp
()
{
directions
[
monNum
]
=
0
;
}
public
void
GoDown
()
{
directions
[
monNum
]
=
1
;
}
public
void
GoLeft
()
{
directions
[
monNum
]
=
2
;
}
public
void
GoRight
()
{
directions
[
monNum
]
=
3
;
}
//retourne vrai si le joueur courrant est mort
public
Boolean
IsDead
()
{
return
(
directions
[
monNum
]
==
4
);
}
//retourne vrai si le joueur courrant est gagnant
public
Boolean
IsWinner
()
{
return
(
directions
[
monNum
]
==
5
);
}
//retourne vrai si la partie est finie
public
Boolean
IsFinished
()
{
nVivants
=
0
;
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
if
(
directions
[
i
]
<
4
)
nVivants
++;
return
(
nVivants
<
2
);
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Tron
{
public
class
Tron
{
private
byte
taille
;
// taille du terrain
private
byte
nJoueurs
;
// nombre de joueurs
private
byte
monNum
;
// numéro du joueur courrant
protected
byte
[]
directions
;
// 1=haut, 2=bas, 3=gauche, 4=droite, 5=perdu, 6=gagne
protected
int
[,]
marque
;
// qui est passé où
protected
int
[]
posX
,
posY
;
// positions courrante des joueurs
protected
byte
oldDirection
;
// ancienne position du joueur courrant
protected
int
nVivants
=
0
;
// nombre de joueurs encore vivant
// Constructeur à utiliser côté serveur
public
Tron
(
byte
myNJoueurs
,
byte
myTaille
)
:
this
(
myTaille
,
myNJoueurs
,
0
)
{
}
// Constructeur à utiliser côté client
public
Tron
(
byte
myTaille
,
byte
myNJoueurs
,
byte
myMonNum
)
{
taille
=
myTaille
;
nJoueurs
=
myNJoueurs
;
monNum
=
myMonNum
;
posX
=
new
int
[
nJoueurs
];
posY
=
new
int
[
nJoueurs
];
directions
=
new
byte
[
nJoueurs
];
marque
=
new
int
[
taille
,
taille
];
oldDirection
=
0
;
Init
();
}
public
byte
getTaille
()
{
return
taille
;
}
public
byte
getNJoueurs
()
{
return
nJoueurs
;
}
public
byte
getMonNum
()
{
return
monNum
;
}
public
int
getPosX
(
int
i
)
{
return
posX
[
i
];
}
public
int
getPosY
(
int
i
)
{
return
posY
[
i
];
}
public
byte
getDirection
()
{
return
directions
[
monNum
];
}
public
byte
[]
getDirections
()
{
return
directions
;
}
public
void
setDirections
(
byte
[]
d
)
{
directions
=
d
;
}
// initialisation du terrain
public
void
Init
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
directions
[
i
]
=
(
byte
)(
3
-
(
i
%
2
));
posX
[
i
]
=
taille
/
4
*
(
1
+
2
*
(
i
%
2
));
if
(
nJoueurs
%
2
==
1
)
posY
[
i
]
=
taille
/
(
nJoueurs
+
1
)
*
(
i
+
1
);
else
posY
[
i
]
=
taille
/
(
nJoueurs
/
2
+
1
)
*
((
int
)(
i
/
2
)
+
1
);
Console
.
WriteLine
(
posX
[
i
]
+
","
+
posY
[
i
]);
}
for
(
int
i
=
0
;
i
<
taille
;
i
++)
{
for
(
int
j
=
0
;
j
<
taille
;
j
++)
{
marque
[
i
,
j
]
=
-
1
;
}
}
}
// deplacement des joueurs
// MAJ des PosX et posY en fonction de directions
public
void
Deplacement
()
{
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
switch
(
directions
[
i
])
{
case
0
:
posY
[
i
]--;
if
(
posY
[
i
]
<
0
)
posY
[
i
]
=
taille
-
1
;
break
;
case
1
:
posY
[
i
]++;
if
(
posY
[
i
]
>=
taille
)
posY
[
i
]
=
0
;
break
;
case
2
:
posX
[
i
]--;
if
(
posX
[
i
]
<
0
)
posX
[
i
]
=
taille
-
1
;
break
;
case
3
:
posX
[
i
]++;
if
(
posX
[
i
]
>=
taille
)
posX
[
i
]
=
0
;
break
;
}
}
}
// Detection des collisions
// MAJ de directions en fonction des collisions
// Appelle Deplacement()
public
void
Collision
()
{
Collision
(
directions
);
}
public
void
Collision
(
byte
[]
myDirections
)
{
directions
=
myDirections
;
nVivants
=
0
;
int
vivant
=
-
1
;
Deplacement
();
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
{
if
(
marque
[
posX
[
i
],
posY
[
i
]]
!=
-
1
)
{
directions
[
i
]
=
4
;
Console
.
WriteLine
(
"fail "
+
i
);
}
else
{
for
(
int
j
=
i
+
1
;
j
<
nJoueurs
;
j
++)
{
if
(
posX
[
i
]
==
posX
[
j
]
&&
posY
[
i
]
==
posY
[
j
])
{
Console
.
WriteLine
(
"fail "
+
i
+
" "
+
j
);
directions
[
i
]
=
4
;
directions
[
j
]
=
4
;
}
}
marque
[
posX
[
i
],
posY
[
i
]]
=
i
;
}
if
(
directions
[
i
]
!=
4
)
{
nVivants
++;
vivant
=
i
;
}
}
if
(
nVivants
==
1
)
directions
[
vivant
]
=
5
;
}
// modifie la direction du joueur courrant
public
void
GoUp
()
{
directions
[
monNum
]
=
0
;
}
public
void
GoDown
()
{
directions
[
monNum
]
=
1
;
}
public
void
GoLeft
()
{
directions
[
monNum
]
=
2
;
}
public
void
GoRight
()
{
directions
[
monNum
]
=
3
;
}
//retourne vrai si le joueur courrant est mort
public
Boolean
IsDead
()
{
return
(
directions
[
monNum
]
==
4
);
}
//retourne vrai si le joueur courrant est gagnant
public
Boolean
IsWinner
()
{
return
(
directions
[
monNum
]
==
5
);
}
//retourne vrai si la partie est finie
public
Boolean
IsFinished
()
{
nVivants
=
0
;
for
(
int
i
=
0
;
i
<
nJoueurs
;
i
++)
if
(
directions
[
i
]
<
4
)
nVivants
++;
return
(
nVivants
<
2
);
}
}
}
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/TronServeur.csproj
View file @
6a939fae
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
TronServeur
</RootNamespace>
<AssemblyName>
TronServeur
</AssemblyName>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>
3.5
</OldToolsVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Xml.Linq"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data.DataSetExtensions"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Tron.cs"
>
<SubType>
Code
</SubType>
</Compile>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{AC5792F8-1C3E-43F8-A992-33D1C0FCD4DB}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
TronServeur
</RootNamespace>
<AssemblyName>
TronServeur
</AssemblyName>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>
3.5
</OldToolsVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Xml.Linq"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data.DataSetExtensions"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Tron.cs"
>
<SubType>
Code
</SubType>
</Compile>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/obj/Debug/TronServeur.csproj.CoreCompileInputs.cache
deleted
100644 → 0
View file @
028faecf
81888b5c3742dc45614edde256510e2192d8d076
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/obj/Debug/TronServeur.csprojAssemblyReference.cache
deleted
100644 → 0
View file @
028faecf
File deleted
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/obj/Release/TronServeur.csproj.CoreCompileInputs.cache
deleted
100644 → 0
View file @
028faecf
81888b5c3742dc45614edde256510e2192d8d076
This diff is collapsed.
Click to expand it.
Tron/TronServeur/TronServeur/obj/Release/TronServeur.csprojAssemblyReference.cache
deleted
100644 → 0
View file @
028faecf
File deleted
This diff is collapsed.
Click to expand it.
exemples/TCP/clientTcp/clientTcp.sln
View file @
6a939fae
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "clientTcp", "clientTcp\clientTcp.csproj", "{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Debug|x86.ActiveCfg = Debug|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Debug|x86.Build.0 = Debug|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Release|x86.ActiveCfg = Release|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "clientTcp", "clientTcp\clientTcp.csproj", "{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Debug|x86.ActiveCfg = Debug|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Debug|x86.Build.0 = Debug|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Release|x86.ActiveCfg = Release|x86
{E4BC778B-1A54-4D27-8963-E1C7D1B1FC0A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
This diff is collapsed.
Click to expand it.
exemples/TCP/clientTcp/clientTcp/ClientTcp.cs
View file @
6a939fae
using
System
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.IO
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
ClientTcp
{
class
ClientTcp
{
static
void
Main
(
string
[]
args
)
{
try
{
//************************************************************** Initialisation
string
serverIP
=
"0.0.0.0"
;
int
serverPort
=
00000
;
// Creation de la socket d'écoute TCP
Socket
clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
Console
.
WriteLine
(
"Tentative de connexion..."
);
// Liaison de la socket au point de communication
clientSocket
.
Bind
(
new
IPEndPoint
(
IPAddress
.
Any
,
22222
));
// Creation du EndPoint serveur
IPEndPoint
serverEP
=
new
IPEndPoint
(
IPAddress
.
Parse
(
serverIP
),
serverPort
);
// Connexion au serveur
clientSocket
.
Connect
(
serverEP
);
Console
.
WriteLine
(
"Client connecté..."
);
// Lecture message au clavier
Console
.
Write
(
"? "
);
String
msg
=
Console
.
ReadLine
();
//************************************************************** Communications
// Encodage de la String en buffer de bytes/ASCII
byte
[]
buffer
=
System
.
Text
.
Encoding
.
ASCII
.
GetBytes
(
msg
);
// Envoie du message au serveur
int
nBytes
=
clientSocket
.
Send
(
buffer
,
0
,
buffer
.
Length
,
SocketFlags
.
None
);
Console
.
WriteLine
(
"Nouveau message envoye vers "
+
clientSocket
.
RemoteEndPoint
+
" ("
+
nBytes
+
" octets)"
+
": \""
+
msg
+
"\""
);
//************************************************************** Conclusion
// Fermeture socket
Console
.
WriteLine
(
"Fermeture Socket..."
);
clientSocket
.
Close
();
}
catch
(
SocketException
E
)
{
Console
.
WriteLine
(
E
.
Message
);
Console
.
ReadKey
();
}
Console
.
ReadKey
();
}
}
}
using
System
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.IO
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
ClientTcp
{
class
ClientTcp
{
static
void
Main
(
string
[]
args
)
{
try
{
//************************************************************** Initialisation
string
serverIP
=
"0.0.0.0"
;
int
serverPort
=
00000
;
// Creation de la socket d'écoute TCP
Socket
clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
Console
.
WriteLine
(
"Tentative de connexion..."
);
// Liaison de la socket au point de communication
clientSocket
.
Bind
(
new
IPEndPoint
(
IPAddress
.
Any
,
22222
));
// Creation du EndPoint serveur
IPEndPoint
serverEP
=
new
IPEndPoint
(
IPAddress
.
Parse
(
serverIP
),
serverPort
);
// Connexion au serveur
clientSocket
.
Connect
(
serverEP
);
Console
.
WriteLine
(
"Client connecté..."
);
// Lecture message au clavier
Console
.
Write
(
"? "
);
String
msg
=
Console
.
ReadLine
();
//************************************************************** Communications
// Encodage de la String en buffer de bytes/ASCII
byte
[]
buffer
=
System
.
Text
.
Encoding
.
ASCII
.
GetBytes
(
msg
);
// Envoie du message au serveur
int
nBytes
=
clientSocket
.
Send
(
buffer
,
0
,
buffer
.
Length
,
SocketFlags
.
None
);
Console
.
WriteLine
(
"Nouveau message envoye vers "
+
clientSocket
.
RemoteEndPoint
+
" ("
+
nBytes
+
" octets)"
+
": \""
+
msg
+
"\""
);
//************************************************************** Conclusion
// Fermeture socket
Console
.
WriteLine
(
"Fermeture Socket..."
);
clientSocket
.
Close
();
}
catch
(
SocketException
E
)
{
Console
.
WriteLine
(
E
.
Message
);
Console
.
ReadKey
();
}
Console
.
ReadKey
();
}
}
}
This diff is collapsed.
Click to expand it.
exemples/TCP/clientTcp/clientTcp/Properties/AssemblyInfo.cs
View file @
6a939fae
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
(
"clientTcp"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
"Microsoft"
)]
[
assembly
:
AssemblyProduct
(
"clientTcp"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © Microsoft 2011"
)]
[
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
(
"c363b34d-908d-4cb4-9204-092b339296ca"
)]
// 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"
)]
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
(
"clientTcp"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
"Microsoft"
)]
[
assembly
:
AssemblyProduct
(
"clientTcp"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © Microsoft 2011"
)]
[
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
(
"c363b34d-908d-4cb4-9204-092b339296ca"
)]
// 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"
)]
This diff is collapsed.
Click to expand it.
exemples/TCP/clientTcp/clientTcp/clientTcp.csproj
View file @
6a939fae
This diff is collapsed.
Click to expand it.
exemples/TCP/clientTcp/clientTcp/obj/x86/Debug/clientTcp.csproj.CoreCompileInputs.cache
deleted
100644 → 0
View file @
028faecf
71856e4561cb10bd346690c0a755ac7cfbf09154
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment