1
0
Fork 0

Add Common project and AssemblyInfo

This commit is contained in:
sheychen 2016-10-30 15:15:27 +01:00
parent 4f52481439
commit c24ec3076f
19 changed files with 203 additions and 98 deletions

23
AssemblyInfoCommon.cs Normal file
View File

@ -0,0 +1,23 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
//Common AssemblyInfo
// 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: AssemblyCompany("sheychen")]
[assembly: AssemblyCopyright("Copyright © 2016")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Galactic_Colors_Control_Common
{
public static class Common
{
public enum dataType { message, data };
}
}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Galactic_Colors_Control_Common</RootNamespace>
<AssemblyName>Galactic Colors Control Common</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</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>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\AssemblyInfoCommon.cs">
<Link>Properties\AssemblyInfoCommon.cs</Link>
</Compile>
<Compile Include="Common.cs" />
<Compile Include="Properties\AssemblyInfo.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>

View File

@ -0,0 +1,21 @@
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("Galactic Colors Control Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Galactic Colors Control Common")]
[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("022a69ce-22b5-4934-be9f-a9c6df9557ed")]

View File

@ -44,6 +44,9 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\AssemblyInfoCommon.cs">
<Link>Properties\AssemblyInfoCommon.cs</Link>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

View File

@ -8,9 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Galactic Colors Control Console")] [assembly: AssemblyTitle("Galactic Colors Control Console")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sheychen")]
[assembly: AssemblyProduct("Galactic Colors Control Console")] [assembly: AssemblyProduct("Galactic Colors Control Console")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -21,16 +19,3 @@ using System.Runtime.InteropServices;
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("5d6a09d1-dcab-4fd8-b4e6-62d9f41ae8f0")] [assembly: Guid("5d6a09d1-dcab-4fd8-b4e6-62d9f41ae8f0")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]

View File

@ -41,6 +41,9 @@
<StartupObject /> <StartupObject />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\AssemblyInfoCommon.cs">
<Link>Properties\AssemblyInfoCommon.cs</Link>
</Compile>
<Compile Include="Game1.cs" /> <Compile Include="Game1.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -9,8 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Galactic Colors Control GUI")] [assembly: AssemblyProduct("Galactic Colors Control GUI")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("sheychen")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -21,16 +19,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("606d35be-02e8-4a7e-978e-04c2aca6ccd7")] [assembly: Guid("606d35be-02e8-4a7e-978e-04c2aca6ccd7")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using Galactic_Colors_Control_Common;
namespace Galactic_Colors_Control_Server.Commands namespace Galactic_Colors_Control_Server.Commands
{ {
@ -31,18 +32,18 @@ namespace Galactic_Colors_Control_Server.Commands
Program.clients[soc].status = 0; Program.clients[soc].status = 0;
//args[1] = args[1][0].ToString().ToUpper()[0] + args[1].Substring(1); //args[1] = args[1][0].ToString().ToUpper()[0] + args[1].Substring(1);
Program.clients[soc].pseudo = args[1]; Program.clients[soc].pseudo = args[1];
Utilities.Send(soc, "/connected", Utilities.dataType.message); Utilities.Send(soc, "/connected", Common.dataType.message);
Utilities.Broadcast(args[1] + " joined the server", Utilities.dataType.message); Utilities.Broadcast(args[1] + " joined the server", Common.dataType.message);
Logger.Write("Identified as " + Utilities.GetName(soc) + " form " + ((IPEndPoint)soc.LocalEndPoint).Address.ToString(), Logger.logType.info); Logger.Write("Identified as " + Utilities.GetName(soc) + " form " + ((IPEndPoint)soc.LocalEndPoint).Address.ToString(), Logger.logType.info);
} }
else else
{ {
Utilities.Send(soc, "/allreadytaken", Utilities.dataType.message); Utilities.Send(soc, "/allreadytaken", Common.dataType.message);
} }
} }
else else
{ {
Utilities.Send(soc, "You are allready " + Utilities.GetName(soc), Utilities.dataType.message); Utilities.Send(soc, "You are allready " + Utilities.GetName(soc), Common.dataType.message);
} }
} }
} }

View File

@ -1,4 +1,5 @@
using System; using Galactic_Colors_Control_Common;
using System;
using System.Net.Sockets; using System.Net.Sockets;
namespace Galactic_Colors_Control_Server.Commands namespace Galactic_Colors_Control_Server.Commands
@ -30,7 +31,7 @@ namespace Galactic_Colors_Control_Server.Commands
bool connected = Program.clients[soc].status != -1; bool connected = Program.clients[soc].status != -1;
soc.Close(); soc.Close();
Program.clients.Remove(soc); Program.clients.Remove(soc);
if (connected) { Utilities.Broadcast(username + " leave the server", Utilities.dataType.message); } if (connected) { Utilities.Broadcast(username + " leave the server", Common.dataType.message); }
Logger.Write("Size: " + Program.clients.Count + "/" + Program.config.size, Logger.logType.debug); Logger.Write("Size: " + Program.clients.Count + "/" + Program.config.size, Logger.logType.debug);
} }
} }

View File

@ -1,4 +1,5 @@
using System; using Galactic_Colors_Control_Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Sockets; using System.Net.Sockets;
@ -29,11 +30,11 @@ namespace Galactic_Colors_Control_Server.Commands
Logger.Write(args[1] + " was kick by server.", Logger.logType.info); Logger.Write(args[1] + " was kick by server.", Logger.logType.info);
if (args.Length > 2) if (args.Length > 2)
{ {
Utilities.Send(target, "/kick " + args[2], Utilities.dataType.message); Utilities.Send(target, "/kick " + args[2], Common.dataType.message);
Logger.Write("because" + args[1], Logger.logType.debug); Logger.Write("because" + args[1], Logger.logType.debug);
} }
else { else {
Utilities.Send(target, "/kick", Utilities.dataType.message); Utilities.Send(target, "/kick", Common.dataType.message);
} }
} }
else else

View File

@ -53,6 +53,9 @@
<Reference Include="System.XML" /> <Reference Include="System.XML" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\AssemblyInfoCommon.cs">
<Link>Properties\AssemblyInfoCommon.cs</Link>
</Compile>
<Compile Include="Commands\ClearCommand.cs" /> <Compile Include="Commands\ClearCommand.cs" />
<Compile Include="Commands\PingCommand.cs" /> <Compile Include="Commands\PingCommand.cs" />
<Compile Include="Commands\CloseCommand.cs" /> <Compile Include="Commands\CloseCommand.cs" />
@ -94,6 +97,12 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Galactic Colors Control Common\Galactic Colors Control Common.csproj">
<Project>{022a69ce-22b5-4934-be9f-a9c6df9557ed}</Project>
<Name>Galactic Colors Control Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,4 +1,5 @@
using System; using Galactic_Colors_Control_Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -116,14 +117,14 @@ namespace Galactic_Colors_Control_Server
else else
{ {
Logger.Write("Client can't join from " + ((IPEndPoint)socket.LocalEndPoint).Address.ToString() + " no more space", Logger.logType.warm); Logger.Write("Client can't join from " + ((IPEndPoint)socket.LocalEndPoint).Address.ToString() + " no more space", Logger.logType.warm);
Utilities.Send(socket, "/kick can't_join_no_more_space", Utilities.dataType.message); Utilities.Send(socket, "/kick can't_join_no_more_space", Common.dataType.message);
socket.Close(); socket.Close();
} }
} }
else else
{ {
Logger.Write("Client can't join from " + ((IPEndPoint)socket.LocalEndPoint).Address.ToString() + " server closed", Logger.logType.info); Logger.Write("Client can't join from " + ((IPEndPoint)socket.LocalEndPoint).Address.ToString() + " server closed", Logger.logType.info);
Utilities.Send(socket, "/kick can't_join_server_closed", Utilities.dataType.message); Utilities.Send(socket, "/kick can't_join_server_closed", Common.dataType.message);
socket.Close(); socket.Close();
} }
serverSocket.BeginAccept(AcceptCallback, null); serverSocket.BeginAccept(AcceptCallback, null);
@ -164,7 +165,7 @@ namespace Galactic_Colors_Control_Server
Logger.Write("Size: " + clients.Count + "/" + config.size, Logger.logType.debug); Logger.Write("Size: " + clients.Count + "/" + config.size, Logger.logType.debug);
current.Close(); // Don't shutdown because the socket may be disposed and its disconnected anyway. current.Close(); // Don't shutdown because the socket may be disposed and its disconnected anyway.
clients.Remove(current); clients.Remove(current);
if (connected) { Utilities.Broadcast(username + " leave the server", Utilities.dataType.message); } if (connected) { Utilities.Broadcast(username + " leave the server", Common.dataType.message); }
return; return;
} }
@ -175,17 +176,17 @@ namespace Galactic_Colors_Control_Server
byte[] type = new byte[4]; byte[] type = new byte[4];
type = data.Take(4).ToArray(); type = data.Take(4).ToArray();
type.Reverse(); type.Reverse();
Utilities.dataType dtype = (Utilities.dataType)BitConverter.ToInt32(type, 0); Common.dataType dtype = (Common.dataType)BitConverter.ToInt32(type, 0);
byte[] bytes = null; byte[] bytes = null;
bytes = data.Skip(4).ToArray(); bytes = data.Skip(4).ToArray();
switch (dtype) switch (dtype)
{ {
case Utilities.dataType.message: case Common.dataType.message:
string text = Encoding.ASCII.GetString(bytes); string text = Encoding.ASCII.GetString(bytes);
ExecuteMessage(text, current); ExecuteMessage(text, current);
break; break;
case Utilities.dataType.data: case Common.dataType.data:
Console.WriteLine("data"); Console.WriteLine("data");
break; break;
@ -230,12 +231,12 @@ namespace Galactic_Colors_Control_Server
{ {
if (!Utilities.IsConnect(soc)) if (!Utilities.IsConnect(soc))
{ {
Utilities.Send(soc, "Only identified clients can talk.", Utilities.dataType.message); Utilities.Send(soc, "Only identified clients can talk.", Common.dataType.message);
} }
else else
{ {
Logger.Write(Utilities.GetName(soc) + " : " + text, Logger.logType.info); Logger.Write(Utilities.GetName(soc) + " : " + text, Logger.logType.info);
Utilities.Broadcast(Utilities.GetName(soc) + " : " + text, Utilities.dataType.message); Utilities.Broadcast(Utilities.GetName(soc) + " : " + text, Common.dataType.message);
} }
} }
} }

View File

@ -8,9 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Galactic Colors Control Server")] [assembly: AssemblyTitle("Galactic Colors Control Server")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sheychen")]
[assembly: AssemblyProduct("Galactic Colors Control Server")] [assembly: AssemblyProduct("Galactic Colors Control Server")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -21,16 +19,3 @@ using System.Runtime.InteropServices;
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("9e3af4e1-88c6-4139-a15c-b4f633e80612")] [assembly: Guid("9e3af4e1-88c6-4139-a15c-b4f633e80612")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]

View File

@ -1,4 +1,5 @@
using System; using Galactic_Colors_Control_Common;
using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -9,8 +10,6 @@ namespace Galactic_Colors_Control_Server
{ {
class Utilities class Utilities
{ {
public enum dataType { message, data };
/// <summary> /// <summary>
/// Check if socket is connect /// Check if socket is connect
/// </summary> /// </summary>
@ -91,7 +90,7 @@ namespace Galactic_Colors_Control_Server
/// <param name="soc">Target socket</param> /// <param name="soc">Target socket</param>
/// <param name="data">Data to send</param> /// <param name="data">Data to send</param>
/// <param name="dtype">Type of data</param> /// <param name="dtype">Type of data</param>
public static void Send(Socket soc, object data, dataType dtype) public static void Send(Socket soc, object data, Common.dataType dtype)
{ {
/* /*
Format: Format:
@ -103,11 +102,11 @@ namespace Galactic_Colors_Control_Server
byte[] bytes = null; byte[] bytes = null;
switch (dtype) switch (dtype)
{ {
case dataType.message: case Common.dataType.message:
bytes = Encoding.ASCII.GetBytes((string)data); bytes = Encoding.ASCII.GetBytes((string)data);
break; break;
case dataType.data: case Common.dataType.data:
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
@ -131,7 +130,7 @@ namespace Galactic_Colors_Control_Server
/// </summary> /// </summary>
/// <param name="data">Data to send</param> /// <param name="data">Data to send</param>
/// <param name="dtype">Type of data</param> /// <param name="dtype">Type of data</param>
public static void Broadcast(object data, dataType dtype) public static void Broadcast(object data, Common.dataType dtype)
{ {
foreach (Socket soc in Program.clients.Keys) foreach (Socket soc in Program.clients.Keys)
{ {
@ -153,7 +152,7 @@ namespace Galactic_Colors_Control_Server
} }
else else
{ {
Send(soc, message, dataType.message); Send(soc, message, Common.dataType.message);
} }
} }
} }

View File

@ -4,8 +4,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.24720.0 VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control Server", "Galactic Colors Control Server\Galactic Colors Control Server.csproj", "{9E3AF4E1-88C6-4139-A15C-B4F633E80612}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control Server", "Galactic Colors Control Server\Galactic Colors Control Server.csproj", "{9E3AF4E1-88C6-4139-A15C-B4F633E80612}"
ProjectSection(ProjectDependencies) = postProject
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED} = {022A69CE-22B5-4934-BE9F-A9C6DF9557ED}
EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control", "Galactic Colors Control\Galactic Colors Control.csproj", "{93582CE8-C8C8-4E19-908B-D671ECBADE25}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control", "Galactic Colors Control\Galactic Colors Control.csproj", "{93582CE8-C8C8-4E19-908B-D671ECBADE25}"
ProjectSection(ProjectDependencies) = postProject
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED} = {022A69CE-22B5-4934-BE9F-A9C6DF9557ED}
EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control GUI", "Galactic Colors Control GUI\Galactic Colors Control GUI.csproj", "{F6CDDF1B-5A57-4A84-B57C-749FFF9AE031}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control GUI", "Galactic Colors Control GUI\Galactic Colors Control GUI.csproj", "{F6CDDF1B-5A57-4A84-B57C-749FFF9AE031}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
@ -14,6 +20,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control GUI
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control Console", "Galactic Colors Control Console\Galactic Colors Control Console.csproj", "{5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control Console", "Galactic Colors Control Console\Galactic Colors Control Console.csproj", "{5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Galactic Colors Control Common", "Galactic Colors Control Common\Galactic Colors Control Common.csproj", "{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{75A0ADCB-CB9B-48DA-AF82-C58F2105848B}"
ProjectSection(SolutionItems) = preProject
AssemblyInfoCommon.cs = AssemblyInfoCommon.cs
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -54,6 +67,14 @@ Global
{5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|Any CPU.Build.0 = Release|Any CPU {5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|Any CPU.Build.0 = Release|Any CPU
{5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|x86.ActiveCfg = Release|Any CPU {5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|x86.ActiveCfg = Release|Any CPU
{5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|x86.Build.0 = Release|Any CPU {5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0}.Release|x86.Build.0 = Release|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Debug|x86.ActiveCfg = Debug|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Debug|x86.Build.0 = Debug|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Release|Any CPU.Build.0 = Release|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Release|x86.ActiveCfg = Release|Any CPU
{022A69CE-22B5-4934-BE9F-A9C6DF9557ED}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -56,6 +56,9 @@
<Reference Include="System" /> <Reference Include="System" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\AssemblyInfoCommon.cs">
<Link>Properties\AssemblyInfoCommon.cs</Link>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@ -74,6 +77,12 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Galactic Colors Control Common\Galactic Colors Control Common.csproj">
<Project>{022a69ce-22b5-4934-be9f-a9c6df9557ed}</Project>
<Name>Galactic Colors Control Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,4 +1,5 @@
using System; using Galactic_Colors_Control_Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -23,8 +24,6 @@ namespace Galactic_Colors_Control
public bool isRunning { get { return _run; } } public bool isRunning { get { return _run; } }
private enum dataType { message, data };
public List<string> Output = new List<string>(); public List<string> Output = new List<string>();
private Thread RecieveThread; private Thread RecieveThread;
@ -130,7 +129,7 @@ namespace Galactic_Colors_Control
/// </summary> /// </summary>
public void ExitHost() public void ExitHost()
{ {
Send("/exit", dataType.message); // Tell the server we are exiting Send("/exit", Common.dataType.message); // Tell the server we are exiting
_run = false; _run = false;
RecieveThread.Join(); RecieveThread.Join();
ClientSocket.Shutdown(SocketShutdown.Both); ClientSocket.Shutdown(SocketShutdown.Both);
@ -156,7 +155,7 @@ namespace Galactic_Colors_Control
break; break;
default: default:
Send(request, dataType.message); Send(request, Common.dataType.message);
break; break;
} }
} }
@ -178,18 +177,18 @@ namespace Galactic_Colors_Control
} }
} }
private void Send(object data, dataType dtype) private void Send(object data, Common.dataType dtype)
{ {
byte[] type = new byte[4]; byte[] type = new byte[4];
type = BitConverter.GetBytes((int)dtype); type = BitConverter.GetBytes((int)dtype);
byte[] bytes = null; byte[] bytes = null;
switch (dtype) switch (dtype)
{ {
case dataType.message: case Common.dataType.message:
bytes = Encoding.ASCII.GetBytes((string)data); bytes = Encoding.ASCII.GetBytes((string)data);
break; break;
case dataType.data: case Common.dataType.data:
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
@ -238,12 +237,12 @@ namespace Galactic_Colors_Control
byte[] type = new byte[4]; byte[] type = new byte[4];
type = data.Take(4).ToArray(); type = data.Take(4).ToArray();
type.Reverse(); type.Reverse();
dataType dtype = (dataType)BitConverter.ToInt32(type, 0); Common.dataType dtype = (Common.dataType)BitConverter.ToInt32(type, 0);
byte[] bytes = null; byte[] bytes = null;
bytes = data.Skip(4).ToArray(); bytes = data.Skip(4).ToArray();
switch (dtype) switch (dtype)
{ {
case dataType.message: case Common.dataType.message:
string text = Encoding.ASCII.GetString(bytes); string text = Encoding.ASCII.GetString(bytes);
if (text[0] == '/') if (text[0] == '/')
{ {
@ -283,7 +282,7 @@ namespace Galactic_Colors_Control
} }
break; break;
case dataType.data: case Common.dataType.data:
Console.WriteLine("data"); Console.WriteLine("data");
break; break;
} }

View File

@ -8,9 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Galactic Colors Control")] [assembly: AssemblyTitle("Galactic Colors Control")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sheychen")]
[assembly: AssemblyProduct("Galactic Colors Control")] [assembly: AssemblyProduct("Galactic Colors Control")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -20,17 +18,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("93582ce8-c8c8-4e19-908b-d671ecbade25")] [assembly: Guid("93582ce8-c8c8-4e19-908b-d671ecbade25")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]