|
From: <br...@us...> - 2008-06-19 14:43:41
|
Revision: 266
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=266&view=rev
Author: brus07
Date: 2008-06-19 07:43:49 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Create new project for DataModule and moved one to this project
Modified Paths:
--------------
ACMServer/trunk/ACMServer/ACMMediator.sln
ACMServer/trunk/ACMServer/ACMTester.sln
ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs
ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj
Added Paths:
-----------
ACMServer/trunk/ACMServer/Library/Data/
ACMServer/trunk/ACMServer/Library/Data/Data.csproj
ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs
ACMServer/trunk/ACMServer/Library/Data/Properties/
ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs
ACMServer/trunk/ACMServer/Library/Data/Result.cs
ACMServer/trunk/ACMServer/Library/Data/Submit.cs
Removed Paths:
-------------
ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/
Modified: ACMServer/trunk/ACMServer/ACMMediator.sln
===================================================================
--- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:24:30 UTC (rev 265)
+++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:43:49 UTC (rev 266)
@@ -23,6 +23,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketServerGatePlugin", "Plugins\MediatorPlugins\SocketServerGatePlugin\SocketServerGatePlugin.csproj", "{9462E3BD-67AD-4887-BF4C-8B6A25048941}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -61,6 +63,10 @@
{9462E3BD-67AD-4887-BF4C-8B6A25048941}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9462E3BD-67AD-4887-BF4C-8B6A25048941}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9462E3BD-67AD-4887-BF4C-8B6A25048941}.Release|Any CPU.Build.0 = Release|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -68,6 +74,7 @@
GlobalSection(NestedProjects) = preSolution
{211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890}
{A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890}
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890}
{E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
{69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
{A855D392-4817-4408-80CE-61D8C8E77322} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
Modified: ACMServer/trunk/ACMServer/ACMTester.sln
===================================================================
--- ACMServer/trunk/ACMServer/ACMTester.sln 2008-06-19 14:24:30 UTC (rev 265)
+++ ACMServer/trunk/ACMServer/ACMTester.sln 2008-06-19 14:43:49 UTC (rev 266)
@@ -11,6 +11,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker\Checker.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@
{052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU
{052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.ActiveCfg = Release|Any CPU
{052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.Build.0 = Release|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -40,5 +46,6 @@
GlobalSection(NestedProjects) = preSolution
{211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0}
{A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0}
+ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0}
EndGlobalSection
EndGlobal
Property changes on: ACMServer/trunk/ACMServer/Library/Data
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: ACMServer/trunk/ACMServer/Library/Data/Data.csproj
===================================================================
--- ACMServer/trunk/ACMServer/Library/Data/Data.csproj (rev 0)
+++ ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 14:43:49 UTC (rev 266)
@@ -0,0 +1,53 @@
+<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>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Data</RootNamespace>
+ <AssemblyName>Data</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="DataMediator.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Result.cs" />
+ <Compile Include="Submit.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj">
+ <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project>
+ <Name>LibraryExtention</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/Library/Data/DataMediator.cs (from rev 262, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs)
===================================================================
--- ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs 2008-06-19 14:43:49 UTC (rev 266)
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+
+namespace AcmContester.Library.LibraryExtention.Data
+{
+ public class DataMediator
+ {
+ const int secondToLive = 60;
+
+ Dictionary<int, DateTime> d = new Dictionary<int, DateTime>();
+
+ /// <summary>
+ /// \xDF\xEA\xF9\xEE \xF1\xE0\xE1\xEC\xB3\xF2 \xF3 \xF7\xE5\xF0\xE7\xB3 \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xFC\xF1\xFF \xE1\xB3\xEB\xFC\xF8\xE5 \xED\xB3\xE6 secondToLive \xF1\xE5\xEA\xF3\xED\xE4, \xF2\xEE \xE2\xB3\xED \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xE8\xE4\xE0\xEB\xFF\xBA\xF2\xFC\xF1\xFF \xE7 \xED\xE5\xBF
+ /// </summary>
+ private void DeleteOld()
+ {
+ DateTime now = DateTime.Now;
+ ArrayList keysToDelete = new ArrayList();
+ foreach(KeyValuePair<int,DateTime> elem in d)
+ {
+ TimeSpan ts = now - elem.Value;
+ if (ts.TotalSeconds > secondToLive)
+ {
+ keysToDelete.Add(elem.Key);
+ }
+ }
+ foreach (int key in keysToDelete)
+ {
+ d.Remove(key);
+ }
+ }
+
+ private bool Contains(int id)
+ {
+ return d.ContainsKey(id);
+ }
+
+ public bool Add(Submit data)
+ {
+ DeleteOld();
+ if (Contains(data.GetHashCode()) == false)
+ {
+ d.Add(data.GetHashCode(), DateTime.Now);
+ return true;
+ }
+ return false;
+ }
+
+ public void Return(Result data)
+ {
+ DeleteOld();
+ if (Contains(data.Submit.GetHashCode()) == true)
+ {
+ d.Remove(data.Submit.GetHashCode());
+ }
+ }
+ }
+}
Added: ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs
===================================================================
--- ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs 2008-06-19 14:43:49 UTC (rev 266)
@@ -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("Data")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Home")]
+[assembly: AssemblyProduct("Data")]
+[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("f7c27001-7067-40b6-b145-a1dfe887b41d")]
+
+// 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.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Copied: ACMServer/trunk/ACMServer/Library/Data/Result.cs (from rev 262, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs)
===================================================================
--- ACMServer/trunk/ACMServer/Library/Data/Result.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-19 14:43:49 UTC (rev 266)
@@ -0,0 +1,34 @@
+using System;
+using AcmContester.AcmLibraryExtention.XML;
+
+namespace AcmContester.Library.LibraryExtention.Data
+{
+ public class Result
+ {
+ Submit submit;
+
+ string temp;
+
+ public Result(string message)
+ {
+ //TODO
+ temp = message.Substring(0, message.IndexOf('$'));
+ string s = message.Substring(message.IndexOf('$') + 1);
+ submit = new Submit(s);
+ }
+
+ public Submit Submit
+ {
+ get
+ {
+ return submit;
+ }
+ }
+
+ public override string ToString()
+ {
+ //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML
+ return temp;
+ }
+ }
+}
Copied: ACMServer/trunk/ACMServer/Library/Data/Submit.cs (from rev 264, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs)
===================================================================
--- ACMServer/trunk/ACMServer/Library/Data/Submit.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 14:43:49 UTC (rev 266)
@@ -0,0 +1,53 @@
+using System;
+using AcmContester.AcmLibraryExtention.XML;
+using System.IO;
+
+namespace AcmContester.Library.LibraryExtention.Data
+{
+ public class Submit
+ {
+ int id;
+ string temp;
+
+ public Submit(string message)
+ {
+ //TODO
+ message = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"+
+@"<submitList>
+ <submit>
+ <id>123</id>
+ <sourceCode>asd asd asd asd</sourceCode>
+ <language>2</language>
+ </submit>
+ <submit>
+ <id>123</id>
+ <sourceCode>asd asd asd asd</sourceCode>
+ <language>2</language>
+ </submit>
+ <submit>
+ <id>123</id>
+ <sourceCode>asd asd asd asd</sourceCode>
+ <language>0</language>
+ </submit>
+</submitList>
+";
+ TextReader reader = new StreamReader("submit.xsd");
+ string schema = reader.ReadToEnd();
+ string xml = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList");
+ bool good = Xml.ValidateXmlWithSchema(xml, schema);
+ id = Convert.ToInt32(message.Substring(0,message.IndexOf('$')));
+ temp = message.Substring(message.IndexOf('$')+1);
+ }
+
+ //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML
+ public override string ToString()
+ {
+ return temp;
+ }
+
+ public override int GetHashCode()
+ {
+ return id;
+ }
+ }
+}
Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-19 14:24:30 UTC (rev 265)
+++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-19 14:43:49 UTC (rev 266)
@@ -1,6 +1,6 @@
using System;
using AcmContester.Library.Connector;
-using AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data;
+using AcmContester.Library.LibraryExtention.Data;
namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin
{
Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-19 14:24:30 UTC (rev 265)
+++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-19 14:43:49 UTC (rev 266)
@@ -31,9 +31,6 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Data\DataMediator.cs" />
- <Compile Include="Data\Result.cs" />
- <Compile Include="Data\Submit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SocketServerGate.cs" />
<Compile Include="SocketServerGatePlugin.cs" />
@@ -43,6 +40,10 @@
<Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project>
<Name>Connector</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Library\Data\Data.csproj">
+ <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project>
+ <Name>Data</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Library\LibraryExtention\LibraryExtention.csproj">
<Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project>
<Name>LibraryExtention</Name>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|