From: <br...@us...> - 2008-06-15 09:47:26
|
Revision: 250 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=250&view=rev Author: brus07 Date: 2008-06-15 02:47:32 -0700 (Sun, 15 Jun 2008) Log Message: ----------- Added "SocketGatePlugin" to solution Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/Properties/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketServerPlugin.cs Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 09:36:58 UTC (rev 249) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 09:47:32 UTC (rev 250) @@ -21,6 +21,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebGatePlugin", "Plugins\MediatorPlugins\WebGatePlugin\WebGatePlugin.csproj", "{20B192BC-FD4D-4ED5-90F5-B5994F995238}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketGatePlugin", "Plugins\MediatorPlugins\SocketGatePlugin\SocketGatePlugin.csproj", "{7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -55,6 +57,10 @@ {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Debug|Any CPU.Build.0 = Debug|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Release|Any CPU.ActiveCfg = Release|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Release|Any CPU.Build.0 = Release|Any CPU + {7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -67,5 +73,6 @@ {A855D392-4817-4408-80CE-61D8C8E77322} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} {20B192BC-FD4D-4ED5-90F5-B5994F995238} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} + {7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} EndGlobalSection EndGlobal Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/Properties/AssemblyInfo.cs 2008-06-15 09:47:32 UTC (rev 250) @@ -0,0 +1,35 @@ +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("SocketGatePlugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("SocketGatePlugin")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[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("035b7387-891a-4394-9278-fa1e8394bc20")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketGatePlugin.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketGatePlugin.csproj 2008-06-15 09:47:32 UTC (rev 250) @@ -0,0 +1,50 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{7F5F7FFF-C09D-49A0-8CBF-5A53A9FFCC86}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>SocketGatePlugin</RootNamespace> + <AssemblyName>SocketGatePlugin</AssemblyName> + </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" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\PluginsFramework\PluginsFramework.csproj"> + <Project>{69FB4176-F298-4AF7-B714-B6758AA9A58E}</Project> + <Name>PluginsFramework</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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 Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketServerPlugin.cs (from rev 247, ACMServer/trunk/ACMServer/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketServerPlugin.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/SocketServerPlugin.cs 2008-06-15 09:47:32 UTC (rev 250) @@ -0,0 +1,59 @@ +using System; +using AcmContester.Mediator.Library.Plugins; +using AcmContester.Library.Connector; +using AcmContester.Mediator.Library.Data; + +namespace AcmContester.Mediator.Library.Plugins.SocketGate +{ + /// <summary> + /// Pattern: Singleton + /// </summary> + class SocketServerPlugin : BaseMediatorPlugin + { + private static SocketServerPlugin instance = new SocketServerPlugin(); + + private SocketServer server = new SocketServer(); + private DataMediator dataContainer = new DataMediator(); + + private SocketServerPlugin() + { + server.Start(); + server.onDataArrived += DataArrived; + } + + public static SocketServerPlugin GetInstance() + { + return instance; + } + + public override void Send(string message) + { + WorkingData("SocketServerPlugin::Send(" + message + ")"); + if (server.CountClients() > 0) + if (dataContainer.Add(new Submit(message))) + server.Send(message); + } + + protected override void DataArrived(string message) + { + WorkingData("SocketServerPlugin::DataArrived(" + message + ")"); + dataContainer.Return(new Result(message)); + base.DataArrived(message); + } + + internal int CountClients() + { + if (server == null) + return 0; + return server.CountClients(); + } + + internal void Stop() + { + WorkingData("SocketServerPlugin::Stop()"); + if (server != null) + server.Stop(); + server = null; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |