From: <br...@us...> - 2008-06-10 21:29:31
|
Revision: 240 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=240&view=rev Author: brus07 Date: 2008-06-10 14:29:39 -0700 (Tue, 10 Jun 2008) Log Message: ----------- Update function, in which run Checker, and add logging in this function. Modified Paths: -------------- ACMServer/trunk/ACMServer/Checker/Checker.csproj ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-10 21:24:11 UTC (rev 239) +++ ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-10 21:29:39 UTC (rev 240) @@ -59,4 +59,8 @@ <Target Name="AfterBuild"> </Target> --> + <PropertyGroup> + <PostBuildEvent> + </PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-10 21:24:11 UTC (rev 239) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-10 21:29:39 UTC (rev 240) @@ -52,8 +52,20 @@ } private void DataArrived(string message) { + string result = ""; textBox1.Text += "\r\n" + message; - string result = Checker.Checker.GetResult(message); + try + { + + result = Checker.Checker.GetResult(message); + } + catch (Exception ex) + { + Log log = Log.GetLog(); + log.Loging("Form1::DataArrived: Error: " + ex.Message, Log.Priority.ERR); + log.Loging("Form1::DataArrived: Error: " + ex.StackTrace, Log.Priority.ERR); + return; + } textBox1.Text += "\r\n\t-> " + result; socket.Send(result.ToString() + "$" + message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-10 22:41:45
|
Revision: 242 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=242&view=rev Author: brus07 Date: 2008-06-10 15:41:51 -0700 (Tue, 10 Jun 2008) Log Message: ----------- Added module for work with Plugin. This version don't work correct, but for stat is good. Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Added Paths: ----------- ACMServer/trunk/ACMServer/Plugin/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Properties/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugin/PluginsFramework/ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginsFramework.csproj ACMServer/trunk/ACMServer/Plugin/PluginsFramework/Properties/ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugin/testRun/ ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs ACMServer/trunk/ACMServer/Plugin/testRun/Properties/ ACMServer/trunk/ACMServer/Plugin/testRun/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugin/testRun/testRun.csproj Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-10 21:33:12 UTC (rev 241) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-10 22:41:51 UTC (rev 242) @@ -9,6 +9,16 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryExtention", "Library\LibraryExtention\LibraryExtention.csproj", "{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{D80861F5-3751-4D49-884B-1A10FE1BCB07}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsFramework", "Plugin\PluginsFramework\PluginsFramework.csproj", "{69FB4176-F298-4AF7-B714-B6758AA9A58E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MediatorPlugins", "MediatorPlugins", "{E4F4B91E-CC25-410B-B53A-E2507EFA4FCB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin1", "Plugin\MediatorPlugins\Plugin1\Plugin1.csproj", "{B75187D7-2032-44F3-AC12-20804C7229AC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugin\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +37,18 @@ {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.Build.0 = Release|Any CPU + {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.Build.0 = Release|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.Build.0 = Release|Any CPU + {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -34,5 +56,9 @@ GlobalSection(NestedProjects) = preSolution {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} + {69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} + {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} + {A855D392-4817-4408-80CE-61D8C8E77322} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} + {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} EndGlobalSection EndGlobal Property changes on: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1 ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,13 @@ +using System; +using AcmContester.Plugins.PluginsFramework; + +namespace Plugin1 +{ + public class Class1: BaseMediatorPlugin + { + public override void Send(string message) + { + throw new Exception("The method or operation is not implemented."); + } + } +} Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,51 @@ +<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>{B75187D7-2032-44F3-AC12-20804C7229AC}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Plugin1</RootNamespace> + <AssemblyName>Plugin1</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="Class1.cs" /> + <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 Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Properties/AssemblyInfo.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -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("Plugin1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("Plugin1")] +[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("884ef2ba-83e8-4216-aeff-fcf599685fe9")] + +// 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")] Property changes on: ACMServer/trunk/ACMServer/Plugin/PluginsFramework ___________________________________________________________________ Name: svn:ignore + bin obj PluginsFramework.csproj.user Added: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,9 @@ +using System; + +namespace AcmContester.Plugins.PluginsFramework +{ + public abstract class BaseMediatorPlugin + { + public abstract void Send(string message); + } +} Copied: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs (from rev 241, ACMServer/trunk/tasks/Load_from_dll/taskDll/PluginLoader.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.IO; + +namespace AcmContester.Plugins.PluginsFramework +{ + public static class PluginsLoader<T> where T : class + { + /// <summary> + /// Try to load all the instances of type T in all the DLLs, + /// found at path + /// </summary> + /// <param name="path">Path where to find appropriate DLLs</param> + /// <returns>List of all instaces found</returns> + public static List<T> Load(string path) + { + List<T> plugins = new List<T>(); + if (!Directory.Exists(path)) + throw new ArgumentException("Specified path does not exists!"); + string[] allFiles = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); + foreach (string file in allFiles) + { + ScanAndLoad(file, plugins); + } + return plugins; + } + + /// <summary> + /// Load all instances of type T in specified file and + /// add them to provided list + /// </summary> + /// <param name="filename">Which file to scan</param> + /// <param name="lst">Where to add found objects</param> + private static void ScanAndLoad(string filename, List<T> lst) + { + Assembly assembly = Assembly.LoadFrom(filename); + if (assembly != null) + { + Type[] types = assembly.GetExportedTypes(); + + foreach (Type t in types) + { + try + { + if (t.IsClass && !t.IsAbstract && (t.GetInterface(typeof(T).FullName) != null || t.GetMember(typeof(T).FullName) != null)) + lst.Add((T)Activator.CreateInstance(t)); + } + catch (System.Reflection.TargetInvocationException ex) + { + throw ex; + } + catch (Exception ex) + { + throw ex; + } + } + } + } + } +} Added: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginsFramework.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginsFramework.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginsFramework.csproj 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,46 @@ +<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>{69FB4176-F298-4AF7-B714-B6758AA9A58E}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PluginsFramework</RootNamespace> + <AssemblyName>PluginsFramework</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="BaseMediatorPlugin.cs" /> + <Compile Include="PluginLoader.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </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 Added: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/Properties/AssemblyInfo.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -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("PluginsFramework")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("PluginsFramework")] +[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("aa9fb204-2ead-4c86-8300-759dbd0bb07e")] + +// 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")] Property changes on: ACMServer/trunk/ACMServer/Plugin/testRun ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,20 @@ +using System; +using AcmContester.Plugins.PluginsFramework; +using System.Collections.Generic; + +namespace testRun +{ + class Program + { + static void Main(string[] args) + { + List<BaseMediatorPlugin> plugins = PluginsLoader<BaseMediatorPlugin>.Load("Dll"); + + foreach (BaseMediatorPlugin cp in plugins) + { + cp.Send("aaa"); + } + + } + } +} Added: ACMServer/trunk/ACMServer/Plugin/testRun/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/testRun/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/testRun/Properties/AssemblyInfo.cs 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,33 @@ +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("testRun")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("testRun")] +[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("2c65da36-7eee-474f-ba38-097e346b2839")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/ACMServer/Plugin/testRun/testRun.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugin/testRun/testRun.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/testRun/testRun.csproj 2008-06-10 22:41:51 UTC (rev 242) @@ -0,0 +1,52 @@ +<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>{A855D392-4817-4408-80CE-61D8C8E77322}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>testRun</RootNamespace> + <AssemblyName>testRun</AssemblyName> + <SignManifests>false</SignManifests> + </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="Program.cs" /> + <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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-11 09:15:41
|
Revision: 244 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=244&view=rev Author: brus07 Date: 2008-06-11 02:15:49 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Added new plugin project. Load plugin from folder Dll, and file extension *.dllx Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class2.cs ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/Properties/ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-11 09:15:49 UTC (rev 244) @@ -19,6 +19,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugin\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebGatePlugin", "Plugin\MediatorPlugins\WebGatePlugin\WebGatePlugin.csproj", "{20B192BC-FD4D-4ED5-90F5-B5994F995238}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,6 +51,10 @@ {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.Build.0 = Debug|Any CPU {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.ActiveCfg = Release|Any CPU {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.Build.0 = Release|Any CPU + {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -60,5 +66,6 @@ {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {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} EndGlobalSection EndGlobal Modified: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class1.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -7,7 +7,9 @@ { public override void Send(string message) { - throw new Exception("The method or operation is not implemented."); + Console.WriteLine("Plugin1::Class1::Send(" + message + ");"); + Console.WriteLine("The method or operation is not implemented."); + //throw new Exception("The method or operation is not implemented."); } } } Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class2.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class2.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Class2.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Plugin1 +{ + public class Class2 + { + public void Send(string message) + { + Console.WriteLine("Plugin1::Class2::Send(" + message + ");"); + Console.WriteLine("The method or operation is not implemented."); + //throw new Exception("The method or operation is not implemented."); + } + } +} Modified: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/Plugin1/Plugin1.csproj 2008-06-11 09:15:49 UTC (rev 244) @@ -32,6 +32,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Class1.cs" /> + <Compile Include="Class2.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> Property changes on: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin ___________________________________________________________________ Name: svn:ignore + bin obj WebGatePlugin.csproj.user Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/Properties/AssemblyInfo.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -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("WebGatePlugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("WebGatePlugin")] +[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("4c84bd0e-8704-4e0e-94b4-d35256692a05")] + +// 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/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs (from rev 238, ACMServer/trunk/ACMServer/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -0,0 +1,33 @@ +using System; +using AcmContester.Plugins.PluginsFramework; +using AcmContester.Library.Connector; + +namespace AcmContester.Plugins.MediatorPlugins.WebGatePlugin +{ + /// <summary> + /// Pattern: Singleton + /// </summary> + public class WebGatePlugin: BaseMediatorPlugin + { + //private static WebGatePlugin instance = new WebGatePlugin(); + + private WebConnector connector = new WebConnector(); + + public WebGatePlugin() + { + connector.onDataArrived += DataArrived; + } + + public static WebGatePlugin GetInstance() + { + return null; + //return instance; + } + + public override void Send(string message) + { + WorkingData("WebGatePlugin::Send(" + message + ")"); + connector.Send(message); + } + } +} Added: ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj 2008-06-11 09:15:49 UTC (rev 244) @@ -0,0 +1,55 @@ +<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>{20B192BC-FD4D-4ED5-90F5-B5994F995238}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>WebGatePlugin</RootNamespace> + <AssemblyName>WebGatePlugin</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" /> + <Compile Include="WebGatePlugin.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> + <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> + <Name>Connector</Name> + </ProjectReference> + <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 Deleted: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -1,9 +0,0 @@ -using System; - -namespace AcmContester.Plugins.PluginsFramework -{ - public abstract class BaseMediatorPlugin - { - public abstract void Send(string message); - } -} Copied: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs (from rev 238, ACMServer/trunk/ACMServer/Mediator/Library/Plugins/BaseMediatorPlugin.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/BaseMediatorPlugin.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -0,0 +1,28 @@ +using System; + +namespace AcmContester.Plugins.PluginsFramework +{ + public abstract class BaseMediatorPlugin + { + public delegate void DataArrived_EventHandler(string message); + public event DataArrived_EventHandler onDataArrived; + + public delegate void WorkingData_EventHandler(string message); + public event WorkingData_EventHandler onWorkingData; + + public abstract void Send(string message); + + protected virtual void DataArrived(string message) + { + WorkingData("BaseMediatorPlugin::DataArrived(" + message + ")"); + if (onDataArrived != null) + onDataArrived(message); + } + + protected virtual void WorkingData(string message) + { + if (onWorkingData != null) + onWorkingData(message); + } + } +} Modified: ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/Plugin/PluginsFramework/PluginLoader.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -18,7 +18,7 @@ List<T> plugins = new List<T>(); if (!Directory.Exists(path)) throw new ArgumentException("Specified path does not exists!"); - string[] allFiles = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); + string[] allFiles = Directory.GetFiles(path, "*.dllx", SearchOption.TopDirectoryOnly); foreach (string file in allFiles) { ScanAndLoad(file, plugins); @@ -43,16 +43,25 @@ { try { - if (t.IsClass && !t.IsAbstract && (t.GetInterface(typeof(T).FullName) != null || t.GetMember(typeof(T).FullName) != null)) - lst.Add((T)Activator.CreateInstance(t)); + if (t.IsClass && !t.IsAbstract) + if (t.GetInterface(typeof(T).FullName) != null || t.GetMember(typeof(T).FullName) != null) + lst.Add((T)Activator.CreateInstance(t)); } catch (System.Reflection.TargetInvocationException ex) { - throw ex; + //throw ex; } + catch (System.MissingMethodException ex) + { + //throw ex; + } + catch (System.InvalidCastException ex) + { + //throw ex; + } catch (Exception ex) { - throw ex; + //throw ex; } } } Modified: ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs 2008-06-11 07:03:37 UTC (rev 243) +++ ACMServer/trunk/ACMServer/Plugin/testRun/Program.cs 2008-06-11 09:15:49 UTC (rev 244) @@ -2,12 +2,18 @@ using AcmContester.Plugins.PluginsFramework; using System.Collections.Generic; +using System.Security; +using System.Reflection; + + namespace testRun { + class Program { static void Main(string[] args) { + //BaseMediatorPlugin wgp = new AcmContester.Plugins.MediatorPlugins.WebGatePlugin.WebGatePlugin(); List<BaseMediatorPlugin> plugins = PluginsLoader<BaseMediatorPlugin>.Load("Dll"); foreach (BaseMediatorPlugin cp in plugins) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-11 21:39:05
|
Revision: 246 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=246&view=rev Author: brus07 Date: 2008-06-11 14:39:07 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Rename folder from "Plugin" to "Plugins" Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/ Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugin/ Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-11 14:17:19 UTC (rev 245) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-11 21:39:07 UTC (rev 246) @@ -11,16 +11,16 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{D80861F5-3751-4D49-884B-1A10FE1BCB07}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsFramework", "Plugin\PluginsFramework\PluginsFramework.csproj", "{69FB4176-F298-4AF7-B714-B6758AA9A58E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MediatorPlugins", "MediatorPlugins", "{E4F4B91E-CC25-410B-B53A-E2507EFA4FCB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin1", "Plugin\MediatorPlugins\Plugin1\Plugin1.csproj", "{B75187D7-2032-44F3-AC12-20804C7229AC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin1", "Plugins\MediatorPlugins\Plugin1\Plugin1.csproj", "{B75187D7-2032-44F3-AC12-20804C7229AC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugin\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsFramework", "Plugins\PluginsFramework\PluginsFramework.csproj", "{69FB4176-F298-4AF7-B714-B6758AA9A58E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebGatePlugin", "Plugin\MediatorPlugins\WebGatePlugin\WebGatePlugin.csproj", "{20B192BC-FD4D-4ED5-90F5-B5994F995238}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugins\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebGatePlugin", "Plugins\MediatorPlugins\WebGatePlugin\WebGatePlugin.csproj", "{20B192BC-FD4D-4ED5-90F5-B5994F995238}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,14 +39,14 @@ {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.Build.0 = Release|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.Build.0 = Release|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.Build.0 = Debug|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.ActiveCfg = Release|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.Build.0 = Release|Any CPU - {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B75187D7-2032-44F3-AC12-20804C7229AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B75187D7-2032-44F3-AC12-20804C7229AC}.Release|Any CPU.Build.0 = Release|Any CPU {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.Build.0 = Debug|Any CPU {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -62,8 +62,8 @@ GlobalSection(NestedProjects) = preSolution {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {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} - {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {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} Copied: ACMServer/trunk/ACMServer/Plugins (from rev 245, ACMServer/trunk/ACMServer/Plugin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <br...@us...> - 2008-06-15 10:30:42
|
Revision: 251 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=251&view=rev Author: brus07 Date: 2008-06-15 03:30:51 -0700 (Sun, 15 Jun 2008) Log Message: ----------- Revert to 249 commit Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketGatePlugin/ Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 09:47:32 UTC (rev 250) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 10:30:51 UTC (rev 251) @@ -21,8 +21,6 @@ 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 @@ -57,10 +55,6 @@ {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 @@ -73,6 +67,5 @@ {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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-15 11:03:29
|
Revision: 252 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=252&view=rev Author: brus07 Date: 2008-06-15 04:03:25 -0700 (Sun, 15 Jun 2008) Log Message: ----------- Added "SocketServerGatePlugin" to solution Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 10:30:51 UTC (rev 251) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-15 11:03:25 UTC (rev 252) @@ -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}") = "SocketServerGatePlugin", "Plugins\MediatorPlugins\SocketServerGatePlugin\SocketServerGatePlugin.csproj", "{9462E3BD-67AD-4887-BF4C-8B6A25048941}" +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 + {9462E3BD-67AD-4887-BF4C-8B6A25048941}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 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} + {9462E3BD-67AD-4887-BF4C-8B6A25048941} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} EndGlobalSection EndGlobal Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/AssemblyInfo.cs 2008-06-15 11:03:25 UTC (rev 252) @@ -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("SocketServerGatePlugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("SocketServerGatePlugin")] +[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("6e26be94-4dfb-4de5-8e3e-d36267c1748b")] + +// 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")] Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs (from rev 250, ACMServer/trunk/ACMServer/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-15 11:03:25 UTC (rev 252) @@ -0,0 +1,41 @@ +using System; +using AcmContester.Library.Connector; + +namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin +{ + /// <summary> + /// Pattern: Singleton + /// </summary> + class SocketServerGate : SocketServer + { + private static SocketServerGate instance = new SocketServerGate(); + + public delegate void DataArrivedDelegate(string s); + public event DataArrivedDelegate onDataArrived; + + + private SocketServerGate() + { + base.Start(); + base.onDataArrived += DataArrived; + } + + public static SocketServerGate GetInstance() + { + return instance; + } + + public void Send(string message) + { + //dataContainer.Add(new Submit(message)); + base.Send(message); + } + + protected void DataArrived(string message) + { + //dataContainer.Return(new Result(message)); + if (onDataArrived != null) + onDataArrived(message); + } + } +} Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs (from rev 250, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-15 11:03:25 UTC (rev 252) @@ -0,0 +1,22 @@ +using System; +using AcmContester.Plugins.PluginsFramework; + +namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin +{ + public class SocketServerGatePlugin: BaseMediatorPlugin + { + SocketServerGate socketServerGate; + + public SocketServerGatePlugin() + { + socketServerGate = SocketServerGate.GetInstance(); + socketServerGate.onDataArrived += DataArrived; + } + + public override void Send(string message) + { + WorkingData("WebGatePlugin::Send(" + message + ")"); + socketServerGate.Send(message); + } + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-15 11:03:25 UTC (rev 252) @@ -0,0 +1,56 @@ +<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>{9462E3BD-67AD-4887-BF4C-8B6A25048941}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>SocketServerGatePlugin</RootNamespace> + <AssemblyName>SocketServerGatePlugin</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" /> + <Compile Include="SocketServerGate.cs" /> + <Compile Include="SocketServerGatePlugin.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> + <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> + <Name>Connector</Name> + </ProjectReference> + <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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-15 18:39:05
|
Revision: 256 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=256&view=rev Author: brus07 Date: 2008-06-15 11:39:11 -0700 (Sun, 15 Jun 2008) Log Message: ----------- Move and implement "Data" into "Plugins" module Modified Paths: -------------- ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs ACMServer/trunk/ACMServer/Mediator/Mediator.csproj ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs ACMServer/trunk/ACMServer/Plugins/testRun/Program.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Mediator/Library/Data/ ACMServer/trunk/ACMServer/Mediator/Library/Plugins/ Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -7,8 +7,6 @@ using System.Windows.Forms; using AcmContester.Library.Connector; using System.Net.Sockets; -using AcmContester.Mediator.Library.Plugins; -using AcmContester.Mediator.Library.Plugins.SocketGate; using System.IO; namespace Mediator @@ -62,9 +60,9 @@ private void Disconnnect() { - AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); - SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); - b2.Stop(); + //AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); + //SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); + //b2.Stop(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) @@ -75,13 +73,14 @@ private void timer1_Tick(object sender, EventArgs e) { string mes = "CountOfClients: "; - + /* AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); if (b2 != null) mes += b2.CountClients().ToString(); else mes += "0"; + */ toolStripStatusLabel1.Text = mes; } Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -1,6 +1,6 @@ using System; using System.Collections; -using AcmContester.Mediator.Library.Plugins; +using AcmContester.Plugins.PluginsFramework; namespace AcmContester.Mediator.Library { @@ -11,6 +11,7 @@ public void LoadLists() { + /* //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE2\xE8\xF2\xFF\xE3\xF3\xE2\xE0\xF2\xE8 \xE4\xE0\xED\xB3 \xB3\xE7 \xEF\xE0\xEF\xEE\xEA \xF3 \xFF\xEA\xE8\xE9\xF5 \xEC\xE0\xFE\xF2\xFC \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xE8\xF1\xFF \xE2\xB3\xE4\xEF\xEE\xE2\xB3\xE4\xED\xB3 dll \xE4\xEE \xEA\xEE\xE6\xED\xEE\xE3\xEE \xEF\xEB\xE0\xE3\xB3\xED\xF3 AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin webCreater = new AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin(); BaseMediatorPlugin b1 = webCreater.GetInstance(); @@ -23,6 +24,7 @@ b2.onDataArrived += DataArrivedFromTesterList; b2.onWorkingData += WorkingData; testerSideList.Add(b2); + */ } public delegate void WorkingData_EventHandler(string message); Modified: ACMServer/trunk/ACMServer/Mediator/Mediator.csproj =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Mediator.csproj 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Mediator/Mediator.csproj 2008-06-15 18:39:11 UTC (rev 256) @@ -42,15 +42,7 @@ <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> - <Compile Include="Library\Data\DataMediator.cs" /> - <Compile Include="Library\Data\Result.cs" /> - <Compile Include="Library\Data\Submit.cs" /> <Compile Include="Library\MediatorKernel.cs" /> - <Compile Include="Library\Plugins\BaseMediatorPlugin.cs" /> - <Compile Include="Library\Plugins\SocketGate\CreaterMediatorPlugin.cs" /> - <Compile Include="Library\Plugins\SocketGate\SocketServerPlugin.cs" /> - <Compile Include="Library\Plugins\WebGate\CreaterMediatorPlugin.cs" /> - <Compile Include="Library\Plugins\WebGate\WebGatePlugin.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <EmbeddedResource Include="Form1.resx"> @@ -86,6 +78,10 @@ <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> <Name>LibraryExtention</Name> </ProjectReference> + <ProjectReference Include="..\Plugins\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. Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs (from rev 254, ACMServer/trunk/ACMServer/Mediator/Library/Data/DataMediator.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Collections; + +namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data +{ + 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()); + } + } + } +} Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs (from rev 254, ACMServer/trunk/ACMServer/Mediator/Library/Data/Result.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -0,0 +1,36 @@ +using System; +using AcmContester.AcmLibraryExtention; + +namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data +{ + class Result + { + Xml data; + + 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/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs (from rev 254, ACMServer/trunk/ACMServer/Mediator/Library/Data/Submit.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -0,0 +1,39 @@ +using System; +using AcmContester.AcmLibraryExtention; + +namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data +{ + class Submit + { + Xml data; + + int id; + string temp; + + public Submit(string message) + { + //TODO + 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() + { + //HACK: + /* + int result = 0; + for (int i = 0; i < temp.Length; i++) + { + result *= 991; + result += (int)temp[i]; + }*/ + return id; + } + } +} Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -1,5 +1,6 @@ using System; using AcmContester.Library.Connector; +using AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data; namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin { @@ -13,10 +14,11 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; + DataMediator dataContainer = new DataMediator(); private SocketServerGate() { - base.Start(); + //base.Start(); base.onDataArrived += DataArrived; } @@ -27,13 +29,15 @@ public void Send(string message) { - //dataContainer.Add(new Submit(message)); - base.Send(message); + if (dataContainer.Add(new Submit(message)) == true) + { + base.Send(message); + } } protected void DataArrived(string message) { - //dataContainer.Return(new Result(message)); + dataContainer.Return(new Result(message)); if (onDataArrived != null) onDataArrived(message); } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -10,13 +10,18 @@ public SocketServerGatePlugin() { socketServerGate = SocketServerGate.GetInstance(); - socketServerGate.onDataArrived += DataArrived; + //socketServerGate.onDataArrived += DataArrived; } public override void Send(string message) { + if (message == "stop") + { + socketServerGate.Stop(); + return; + } WorkingData("WebGatePlugin::Send(" + message + ")"); - socketServerGate.Send(message); + //socketServerGate.Send(message); } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-15 18:39:11 UTC (rev 256) @@ -31,6 +31,9 @@ <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" /> @@ -40,6 +43,10 @@ <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> <Name>Connector</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Library\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> <ProjectReference Include="..\..\PluginsFramework\PluginsFramework.csproj"> <Project>{69FB4176-F298-4AF7-B714-B6758AA9A58E}</Project> <Name>PluginsFramework</Name> Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -37,6 +37,11 @@ /// <param name="lst">Where to add found objects</param> private static void ScanAndLoad(string filename, List<T> lst) { + if (File.Exists(filename) == false) + { + //throw new Exception("!!!!!!!!!!"); + return; + } Assembly assembly = Assembly.LoadFrom(filename); if (assembly != null) { Modified: ACMServer/trunk/ACMServer/Plugins/testRun/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/testRun/Program.cs 2008-06-15 16:28:12 UTC (rev 255) +++ ACMServer/trunk/ACMServer/Plugins/testRun/Program.cs 2008-06-15 18:39:11 UTC (rev 256) @@ -18,8 +18,9 @@ foreach (BaseMediatorPlugin cp in plugins) { - cp.Send("aaa"); + cp.Send(@"129$program hello; uses windows; var a,b:integer; begin read(a,b); write(a+b); end."); } + plugins = plugins; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-16 07:27:16
|
Revision: 258 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=258&view=rev Author: brus07 Date: 2008-06-16 00:26:48 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Connect Plugins module to Mediator. Fixed bug in dataContainer, with added message to queue without send. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -62,8 +62,17 @@ void Send2(string message) { - string res = (message.Split('$'))[0]; - string id = (message.Split('$'))[1]; + string res = ""; + string id = ""; + try + { + res = (message.Split('$'))[0]; + id = (message.Split('$'))[1]; + } + catch (Exception) + { + return; + } HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -22,10 +22,11 @@ } string fullLog = ""; + AcmContester.Mediator.Library.MediatorKernel kernel; private void button2_Click(object sender, EventArgs e) { - AcmContester.Mediator.Library.MediatorKernel kernel = new AcmContester.Mediator.Library.MediatorKernel(); + kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.onWorkingData += WorkingData; kernel.LoadLists(); } @@ -60,9 +61,8 @@ private void Disconnnect() { - //AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); - //SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); - //b2.Stop(); + kernel.SendToAll("stop"); + } private void Form1_FormClosing(object sender, FormClosingEventArgs e) Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -1,30 +1,30 @@ using System; using System.Collections; using AcmContester.Plugins.PluginsFramework; +using System.Collections.Generic; namespace AcmContester.Mediator.Library { class MediatorKernel { - ArrayList clientSideList = new ArrayList(); - ArrayList testerSideList = new ArrayList(); + List<BaseMediatorPlugin> clientSideList; + List<BaseMediatorPlugin> testerSideList; public void LoadLists() { - /* - //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE2\xE8\xF2\xFF\xE3\xF3\xE2\xE0\xF2\xE8 \xE4\xE0\xED\xB3 \xB3\xE7 \xEF\xE0\xEF\xEE\xEA \xF3 \xFF\xEA\xE8\xE9\xF5 \xEC\xE0\xFE\xF2\xFC \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xE8\xF1\xFF \xE2\xB3\xE4\xEF\xEE\xE2\xB3\xE4\xED\xB3 dll \xE4\xEE \xEA\xEE\xE6\xED\xEE\xE3\xEE \xEF\xEB\xE0\xE3\xB3\xED\xF3 - AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin webCreater = new AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin(); - BaseMediatorPlugin b1 = webCreater.GetInstance(); - b1.onDataArrived += DataArrivedFromClentList; - b1.onWorkingData += WorkingData; - clientSideList.Add(b1); + clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); + foreach (BaseMediatorPlugin plugin in clientSideList) + { + plugin.onDataArrived += DataArrivedFromClientList; + plugin.onWorkingData += WorkingData; + } - AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); - BaseMediatorPlugin b2 = socketCreater.GetInstance(); - b2.onDataArrived += DataArrivedFromTesterList; - b2.onWorkingData += WorkingData; - testerSideList.Add(b2); - */ + testerSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Tester"); + foreach (BaseMediatorPlugin plugin in testerSideList) + { + plugin.onDataArrived += DataArrivedFromTesterList; + plugin.onWorkingData += WorkingData; + } } public delegate void WorkingData_EventHandler(string message); @@ -35,7 +35,7 @@ onWorkingData(message); } - private void DataArrivedFromClentList(string message) + private void DataArrivedFromClientList(string message) { for (int index = 0; index < testerSideList.Count; index++) { @@ -49,5 +49,11 @@ ((BaseMediatorPlugin)clientSideList[index]).Send(message); } } + + public void SendToAll(string message) + { + DataArrivedFromClientList(message); + DataArrivedFromTesterList(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -18,7 +18,7 @@ private SocketServerGate() { - //base.Start(); + base.Start(); base.onDataArrived += DataArrived; } @@ -29,9 +29,12 @@ public void Send(string message) { - if (dataContainer.Add(new Submit(message)) == true) + if (base.CountClients() > 0) { - base.Send(message); + if (dataContainer.Add(new Submit(message)) == true) + { + base.Send(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -10,7 +10,7 @@ public SocketServerGatePlugin() { socketServerGate = SocketServerGate.GetInstance(); - //socketServerGate.onDataArrived += DataArrived; + socketServerGate.onDataArrived += DataArrived; } public override void Send(string message) @@ -21,7 +21,8 @@ return; } WorkingData("WebGatePlugin::Send(" + message + ")"); - //socketServerGate.Send(message); + WorkingData("WebGatePlugin::Send CountClients = "+ socketServerGate.CountClients().ToString()); + socketServerGate.Send(message); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-18 14:29:06
|
Revision: 264 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=264&view=rev Author: brus07 Date: 2008-06-18 07:29:02 -0700 (Wed, 18 Jun 2008) Log Message: ----------- Attempt to used XmlDocument in Submit, but now it don't work. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-18 13:22:31 UTC (rev 263) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-18 14:29:02 UTC (rev 264) @@ -1,14 +1,14 @@ using System; using System.Collections; +using System.Xml; namespace AcmContester.AcmLibraryExtention { public class Xml { - string data; + XmlDocument document = new XmlDocument(); string name; - Xml[] elements; public string Name { @@ -20,25 +20,23 @@ public Xml(string str) { - data = str; - + document.LoadXml(str); + //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); } public override string ToString() { - return data; + return document.OuterXml; } public Xml[] GetElements() { - /* - ArrayList arr = new ArrayList(); - Xml[] result = new Xml[arr.Count]; - for (int index = 0; index < arr.Count; index++) + XmlNodeList nodes = document.ChildNodes; + Xml[] result = new Xml[nodes.Count]; + for (int index = 0; index < nodes.Count; index++) { - result[index] = (Xml)arr[index]; + result[index] = new Xml(nodes[index].OuterXml); } - */ - return elements; + return result; } } -} \ No newline at end of file +} Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs 2008-06-18 13:22:31 UTC (rev 263) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs 2008-06-18 14:29:02 UTC (rev 264) @@ -3,7 +3,7 @@ namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data { - class Submit + public class Submit { Xml data; @@ -13,6 +13,7 @@ public Submit(string message) { //TODO + //data = new Xml(message); id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); temp = message.Substring(message.IndexOf('$')+1); } @@ -25,14 +26,6 @@ public override int GetHashCode() { - //HACK: - /* - int result = 0; - for (int i = 0; i < temp.Length; i++) - { - result *= 991; - result += (int)temp[i]; - }*/ return id; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <br...@us...> - 2008-06-19 15:16:08
|
Revision: 267 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=267&view=rev Author: brus07 Date: 2008-06-19 08:15:40 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Deleted not used testRun project Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugins/testRun/ Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:43:49 UTC (rev 266) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 15:15:40 UTC (rev 267) @@ -17,8 +17,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsFramework", "Plugins\PluginsFramework\PluginsFramework.csproj", "{69FB4176-F298-4AF7-B714-B6758AA9A58E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugins\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" -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}") = "SocketServerGatePlugin", "Plugins\MediatorPlugins\SocketServerGatePlugin\SocketServerGatePlugin.csproj", "{9462E3BD-67AD-4887-BF4C-8B6A25048941}" @@ -51,10 +49,6 @@ {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.Build.0 = Debug|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.ActiveCfg = Release|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.Build.0 = Release|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.Build.0 = Release|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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 @@ -77,7 +71,6 @@ {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} {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} {20B192BC-FD4D-4ED5-90F5-B5994F995238} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} {9462E3BD-67AD-4887-BF4C-8B6A25048941} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-19 23:03:16
|
Revision: 268 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=268&view=rev Author: brus07 Date: 2008-06-19 16:03:23 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Added test solution for testing Data. Working whit XML for Submit/Result. Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln ACMServer/trunk/ACMServer/Library/Data/Data.csproj ACMServer/trunk/ACMServer/Library/Data/Submit.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs ACMServer/trunk/ACMServer/Library/testData/ ACMServer/trunk/ACMServer/Library/testData/Program.cs ACMServer/trunk/ACMServer/Library/testData/Properties/ ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/testData/submitList.xml ACMServer/trunk/ACMServer/Library/testData/submitList.xsd ACMServer/trunk/ACMServer/Library/testData/testData.csproj Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 23:03:23 UTC (rev 268) @@ -23,6 +23,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testData", "Library\testData\testData.csproj", "{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -61,6 +63,10 @@ {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 + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -69,6 +75,7 @@ {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} + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5} = {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} {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} Modified: ACMServer/trunk/ACMServer/Library/Data/Data.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 23:03:23 UTC (rev 268) @@ -29,12 +29,14 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.XML" /> </ItemGroup> <ItemGroup> <Compile Include="DataMediator.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Result.cs" /> <Compile Include="Submit.cs" /> + <Compile Include="SubmitList.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj"> Modified: ACMServer/trunk/ACMServer/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -7,36 +7,21 @@ public class Submit { int id; + string sourceCode; + int language; + 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"); + TextReader reader = new StreamReader("submitList.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); + bool good = Xml.ValidateXmlWithSchema(message, schema); + if (good == false) + throw new Exception("Submit: ValidateXmlWithSchema - error"); + //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 Added: ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,8 @@ +using System; + +namespace Data +{ + class SubmitList + { + } +} Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -38,8 +38,19 @@ { //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); XmlDocument document = new XmlDocument(); - document.LoadXml(fullXml); - return document.SelectSingleNode("descendant::" + xmlPath).OuterXml; + string result = null; + try + { + document.LoadXml(fullXml); + XmlNode node = document.SelectSingleNode("descendant::" + xmlPath); + if (node != null) + result = node.OuterXml; + } + catch (XmlException ex) + { + throw ex; + } + return result; } public static bool ValidateXmlWithSchema(string xml, string schema) Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -20,8 +20,9 @@ public bool Validate(string xmlSchema) { XmlSchema schema = new XmlSchema(); - XmlSchema.Read(new StringReader(xmlSchema), ValidationCallBack); + schema = XmlSchema.Read(new StringReader(xmlSchema), ValidationXmlSchemaCallBack); + // Create the XmlSchemaSet class. XmlSchemaSet schemas = new XmlSchemaSet(); @@ -32,7 +33,7 @@ XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Schema; settings.Schemas = schemas; - settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); + settings.ValidationEventHandler += new ValidationEventHandler(ValidationXmlCallBack); // Create the XmlReader object. XmlReader reader = XmlReader.Create(new StringReader(xmlDocument), settings); @@ -45,16 +46,15 @@ return validity; } - // Happen validation errors. - private void ValidationCallBack1(object sender, ValidationEventArgs e) + // Happen validation errors when read XmlSchema + private void ValidationXmlSchemaCallBack(object sender, ValidationEventArgs e) { throw new XmlSchemaException(e.Message); } - // Happen validation errors. - private void ValidationCallBack(object sender, ValidationEventArgs e) + // Happen validation errors when read Xml + private void ValidationXmlCallBack(object sender, ValidationEventArgs e) { - //Console.WriteLine("Validation Error: {0}", e.Message); validity = false; } } Property changes on: ACMServer/trunk/ACMServer/Library/testData ___________________________________________________________________ Name: svn:ignore + bin obj testData.csproj.user Added: ACMServer/trunk/ACMServer/Library/testData/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Program.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/Program.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,20 @@ +using System; +using AcmContester.Library.LibraryExtention.Data; +using System.IO; +using AcmContester.AcmLibraryExtention.XML; + +namespace testData +{ + class Program + { + static void Main(string[] args) + { + string message = (new StreamReader("submitList.xml")).ReadToEnd(); + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); + if (message != null && message != "") + { + Submit submit = new Submit(message); + } + } + } +} Added: ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,33 @@ +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("testData")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("testData")] +[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("5359de90-a5a3-44e7-87e0-ce0156aa22eb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/ACMServer/Library/testData/submitList.xml =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/submitList.xml (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/submitList.xml 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,18 @@ +<?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>1</language> + </submit> +</submitList> Added: ACMServer/trunk/ACMServer/Library/testData/submitList.xsd =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/submitList.xsd (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/submitList.xsd 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<xs:schema id="XMLSchema1" elementFormDefault="qualified" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:complexType name="submitType"> + <xs:sequence maxOccurs="1"> + <!-- потрібно щоб ці записи могли слідувати у довільному порядку --> + <xs:element name="id" type="xs:positiveInteger"/> + <xs:element name="sourceCode" type="xs:string" /> + <xs:element name="language"> + <!-- обмеження для ID мови програмування --> + <xs:simpleType> + <xs:restriction base="xs:positiveInteger"> + <xs:maxInclusive value="100" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:element name="submitList"> + <xs:complexType> + <xs:sequence> + <xs:sequence> + <xs:element name="submit" type="submitType" maxOccurs="unbounded" minOccurs="0" /> + </xs:sequence> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> \ No newline at end of file Added: ACMServer/trunk/ACMServer/Library/testData/testData.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/testData.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/testData.csproj 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,66 @@ +<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>{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>testData</RootNamespace> + <AssemblyName>testData</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="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> + <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="submitList.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> + <ItemGroup> + <None Include="submitList.xsd"> + <SubType>Designer</SubType> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-22 08:33:23
|
Revision: 271 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=271&view=rev Author: brus07 Date: 2008-06-21 04:48:54 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Submit and Result serialization XML format. This feature is using when sending information between modules. Modified Paths: -------------- ACMServer/trunk/ACMServer/Checker/Checker.csproj ACMServer/trunk/ACMServer/Checker/Class1.cs ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Library/Data/Result.cs ACMServer/trunk/ACMServer/Library/Data/Submit.cs ACMServer/trunk/ACMServer/Library/testData/data.xsd ACMServer/trunk/ACMServer/Library/testData/data.xsx ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-21 11:48:54 UTC (rev 271) @@ -46,6 +46,10 @@ </Content> </ItemGroup> <ItemGroup> + <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> Modified: ACMServer/trunk/ACMServer/Checker/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -4,6 +4,7 @@ using SourceTest; using System.IO; using AcmContester.Library.LibraryExtention; +using AcmContester.Library.LibraryExtention.Data; namespace Checker { @@ -28,8 +29,11 @@ log.Loging(message, Log.Priority.INFO); log.Loging("", Log.Priority.INFO); - string code = message.Substring(message.IndexOf('$')+1); - string id = message.Substring(0, message.IndexOf('$')); + //TODO: + Submit submit = Submit.CreateFromXml(message); + string code = submit.sourceCode; + string id = submit.id.ToString(); + TSource c = new TSource(); StreamReader s = new StreamReader("InData.txt", Encoding.Default); String compiler = s.ReadLine(); @@ -67,9 +71,14 @@ if (c.Summary.compres.res != (TCompRes)0 ) { - return TSource.CompileResultToString(c.Summary.compres.res); + Result resulta = new Result(submit); + resulta.res = TSource.CompileResultToString(c.Summary.compres.res); + return resulta.ToStringX(); } - return TSource.TestResultToString(c.Summary.res.res); + //TODO: + Result result = new Result(submit); + result.res = TSource.TestResultToString(c.Summary.res.res); + return result.ToStringX(); } public static int GetResult1(string code) { Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-06-21 11:48:54 UTC (rev 271) @@ -51,6 +51,12 @@ <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</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. Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -4,6 +4,7 @@ using System.Net; using System.IO; using System.Text; +using AcmContester.Library.LibraryExtention.Data; namespace AcmContester.Library.Connector.Getter { @@ -25,49 +26,25 @@ public void Send(string message) { checkAddress(); - Send2(message); + SendX(message); } public object GetInfoFromSite() { checkAddress(); - return GetInfoFromSite2(); + return GetInfoFromSiteX(); } - /* - void Send1(string message) + void SendX(string message) { - WebBrowser webBrowser = new WebBrowser(); - webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); - } - - Mutex mut = new Mutex(); - string document = ""; - object GetInfoFromSite1() - { - WebBrowser webBrowser = new WebBrowser(); - webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); - mut.WaitOne(); - return document; - } - - void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) - { - document = ((WebBrowser)sender).DocumentText; - mut.ReleaseMutex(); - } - */ - - void Send2(string message) - { string res = ""; string id = ""; try { - res = (message.Split('$'))[0]; - id = (message.Split('$'))[1]; + //TODO: + Result result = Result.CreateFromXml(message); + res = result.res; + id = result.Submit.id.ToString(); } catch (Exception) { @@ -78,7 +55,7 @@ WebResponse myResponse = myRequest.GetResponse(); myResponse.Close(); } - string GetInfoFromSite2() + string GetInfoFromSiteX() { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/get.php"); myRequest.Method = "GET"; Modified: ACMServer/trunk/ACMServer/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -8,7 +8,18 @@ public class Result { [XmlElement("submit", typeof(Submit))] - public Submit submit; + public Submit Submit + { + get + { + return submit; + } + set + { + submit = value; + } + } + private Submit submit; [XmlElement("res", typeof(string))] public string res; [XmlElement("result", typeof(int))] @@ -24,14 +35,10 @@ { } - public Submit Submit + public Result(Submit ssubmit) { - get - { - return submit; - } + submit = ssubmit; } - public Result(string message) { //TODO Modified: ACMServer/trunk/ACMServer/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -29,10 +29,25 @@ sourceCode = message.Substring(message.IndexOf('$')+1); } + public static Submit CreateFromXml(string message) + { + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submit"); + if (message == null || message == "") + return null; + string schema = Reader.ReadString("data.xsd"); + if (Xml.ValidateXmlWithSchema(message, schema) == false) + return null; + + Submit newList = XmlSerializer<Submit>.Load(message); + return newList; + } + //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 sourceCode; + //string result = sourceCode; + string result = XmlSerializer<Submit>.Serialization(this); + return result; } public override int GetHashCode() Modified: ACMServer/trunk/ACMServer/Library/testData/data.xsd =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsd 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsd 2008-06-21 11:48:54 UTC (rev 271) @@ -8,7 +8,7 @@ <xs:element name="language"> <!-- обмеження для ID мови програмування --> <xs:simpleType> - <xs:restriction base="xs:positiveInteger"> + <xs:restriction base="xs:int"> <xs:maxInclusive value="100" /> </xs:restriction> </xs:simpleType> @@ -26,13 +26,15 @@ </xs:element> <xs:complexType name="resultType"> <xs:sequence> - <xs:element name="submit" type="submitType" /> <xs:element name="res" type="xs:string" /> <xs:element name="result" type="xs:int" /> <xs:element name="usedTime" type="xs:double" /> <xs:element name="usedMemory" type="xs:double" /> + <xs:element name="submit" type="submitType" /> </xs:sequence> </xs:complexType> <xs:element name="result" type="resultType"> </xs:element> + <xs:element name="submit" type="submitType"> + </xs:element> </xs:schema> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Library/testData/data.xsx =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsx 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsx 2008-06-21 11:48:54 UTC (rev 271) @@ -1,26 +1,29 @@ <?xml version="1.0" encoding="utf-8"?> <!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.--> <XSDDesignerLayout Style="LeftRight" layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100"> - <submitType_XmlComplexType left="1317" top="1254" width="5292" height="2831" selected="0" zOrder="0" index="0" expanded="1"> - <language_XmlElement left="7243" top="2312" width="5292" height="714" selected="0" zOrder="1" index="2" expanded="1"> - <_x0028_language_x0029__XmlSimpleType left="13169" top="1254" width="5292" height="2831" selected="0" zOrder="4" index="0" expanded="1" /> + <submitType_XmlComplexType left="1317" top="1254" width="5292" height="2831" selected="0" zOrder="1" index="0" expanded="1"> + <language_XmlElement left="7243" top="2312" width="5292" height="714" selected="0" zOrder="2" index="2" expanded="1"> + <_x0028_language_x0029__XmlSimpleType left="13169" top="1254" width="5292" height="2831" selected="0" zOrder="5" index="0" expanded="1" /> </language_XmlElement> </submitType_XmlComplexType> - <submitList_XmlElement left="1317" top="4593" width="5292" height="2831" selected="0" zOrder="7" index="1" expanded="1"> - <_x0028_group1_x0029__XmlSequence left="7243" top="4593" width="5292" height="2831" selected="0" zOrder="9" index="0" expanded="1"> - <submit_XmlElement left="13169" top="4593" width="5292" height="2831" selected="0" zOrder="12" index="0" expanded="1"> - <language_XmlElement left="19095" top="5585" width="5292" height="714" selected="0" zOrder="32" index="2" expanded="0" /> + <submitList_XmlElement left="1317" top="4593" width="5292" height="2831" selected="0" zOrder="8" index="1" expanded="1"> + <_x0028_group1_x0029__XmlSequence left="7243" top="4593" width="5292" height="2831" selected="0" zOrder="10" index="0" expanded="1"> + <submit_XmlElement left="13169" top="4593" width="5292" height="2831" selected="0" zOrder="13" index="0" expanded="1"> + <language_XmlElement left="19095" top="5651" width="5292" height="714" selected="0" zOrder="16" index="2" expanded="0" /> </submit_XmlElement> </_x0028_group1_x0029__XmlSequence> </submitList_XmlElement> - <resultType_XmlComplexType left="1317" top="7932" width="5292" height="2831" selected="0" zOrder="14" index="2" expanded="1"> - <submit_XmlElement left="7243" top="7932" width="5292" height="2831" selected="0" zOrder="16" index="0" expanded="1"> - <language_XmlElement left="13169" top="8924" width="5292" height="714" selected="0" zOrder="28" index="2" expanded="0" /> + <resultType_XmlComplexType left="1317" top="7932" width="5292" height="2831" selected="0" zOrder="19" index="2" expanded="1"> + <submit_XmlElement left="7243" top="7932" width="5292" height="2831" selected="0" zOrder="21" index="0" expanded="1"> + <language_XmlElement left="13169" top="8990" width="5292" height="714" selected="0" zOrder="24" index="2" expanded="0" /> </submit_XmlElement> </resultType_XmlComplexType> - <result_XmlElement left="1317" top="11271" width="5292" height="2831" selected="0" zOrder="18" index="3" expanded="1"> - <submit_XmlElement left="7243" top="11271" width="5292" height="2831" selected="0" zOrder="21" index="0" expanded="1"> - <language_XmlElement left="13169" top="12263" width="5292" height="714" selected="0" zOrder="24" index="2" expanded="0" /> + <result_XmlElement left="1317" top="11271" width="5292" height="2831" selected="0" zOrder="27" index="3" expanded="1"> + <submit_XmlElement left="7243" top="11271" width="5292" height="2831" selected="0" zOrder="29" index="0" expanded="1"> + <language_XmlElement left="13169" top="12329" width="5292" height="714" selected="0" zOrder="32" index="2" expanded="0" /> </submit_XmlElement> </result_XmlElement> + <submit_XmlElement left="2910" top="14393" width="5292" height="2831" selected="0" zOrder="35" index="4" expanded="1"> + <language_XmlElement left="8836" top="15385" width="5292" height="714" selected="0" zOrder="37" index="2" expanded="0" /> + </submit_XmlElement> </XSDDesignerLayout> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -11,8 +11,8 @@ { private static SocketServerGate instance = new SocketServerGate(); - public delegate void DataArrivedDelegate(string s); - public event DataArrivedDelegate onDataArrived; + public new delegate void DataArrivedDelegate(string s); + public new event DataArrivedDelegate onDataArrived; DataMediator dataContainer = new DataMediator(); @@ -27,22 +27,24 @@ return instance; } - public void Send(string message) + public new void Send(string message) { if (base.CountClients() > 0) { - if (dataContainer.Add(new Submit(message)) == true) + Submit submit = new Submit(message); + if (dataContainer.Add(submit) == true) { - base.Send(message); + base.Send(submit.ToString()); } } } protected void DataArrived(string message) { - dataContainer.Return(new Result(message)); + Result result = Result.CreateFromXml(message); + dataContainer.Return(result); if (onDataArrived != null) - onDataArrived(message); + onDataArrived(result.ToStringX()); } } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -80,7 +80,7 @@ fullLog += "\r\n\t->"; fullLog += result; } - socket.Send(result.ToString() + "$" + message); + socket.Send(result); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) @@ -103,8 +103,15 @@ private void Form1_Load(object sender, EventArgs e) { - StreamWriter sw = File.AppendText("testerlog.txt"); - Log log = Log.GetLog(sw, Log.Priority.EMPTY); + try + { + StreamWriter sw = File.AppendText("testerlog.txt"); + Log log = Log.GetLog(sw, Log.Priority.EMPTY); + } + catch (Exception) + { + fullLog += "\r\n\tLogFile can't open. Working without logging to LogFile."; + } } private void textBox1_TextChanged(object sender, EventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-26 22:43:12
|
Revision: 282 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=282&view=rev Author: brus07 Date: 2008-06-26 15:43:10 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Added to plugins UserControl. Loading each UserControl of plugin to Mediator MainForm. For example, can view and change web site address in WebGatePluginUserControl. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -13,6 +13,19 @@ //"http://127.0.0.1/d"; string fullPathToWebPages = ""; + public string FullPathToWebPages + { + get + { + checkAddress(); + return fullPathToWebPages; + } + set + { + fullPathToWebPages = value; + } + } + private void checkAddress() { if (fullPathToWebPages == "") @@ -25,7 +38,6 @@ public void Send(string message) { - checkAddress(); SendX(message); } Modified: ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -20,6 +20,19 @@ timer.Enabled = true; } + public string Address + { + //TODO: + get + { + return ((WebGetter)getter).FullPathToWebPages; + } + set + { + ((WebGetter)getter).FullPathToWebPages = value; + } + } + // Specify what you want to happen when the Elapsed event is // raised. private void OnTimedEvent(object source, ElapsedEventArgs e) Modified: ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -33,10 +33,13 @@ this.label1 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); this.SuspendLayout(); // // button2 @@ -53,7 +56,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 72); + this.label1.Location = new System.Drawing.Point(122, 17); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(23, 13); this.label1.TabIndex = 3; @@ -78,18 +81,9 @@ this.statusStrip1.TabIndex = 9; this.statusStrip1.Text = "statusStrip1"; // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 95); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(236, 20); - this.textBox1.TabIndex = 10; - this.textBox1.Text = "http://acm.lviv.ua/version3/table.php"; - // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(41, 69); + this.textBox2.Location = new System.Drawing.Point(151, 14); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(110, 20); @@ -97,14 +91,12 @@ // // textBox3 // - this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox3.Location = new System.Drawing.Point(12, 121); + this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox3.Location = new System.Drawing.Point(3, 3); this.textBox3.Multiline = true; this.textBox3.Name = "textBox3"; this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBox3.Size = new System.Drawing.Size(345, 171); + this.textBox3.Size = new System.Drawing.Size(343, 190); this.textBox3.TabIndex = 12; // // timerUpdateTextLog @@ -113,14 +105,36 @@ this.timerUpdateTextLog.Interval = 2000; this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Location = new System.Drawing.Point(12, 70); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(357, 222); + this.tabControl1.TabIndex = 13; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.textBox3); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(349, 196); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Main"; + this.tabPage1.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(369, 317); - this.Controls.Add(this.textBox3); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.button3); this.Controls.Add(this.label1); @@ -129,6 +143,9 @@ this.Text = "Gate"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -140,10 +157,11 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button3; private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Timer timerUpdateTextLog; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; } } Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -29,14 +29,33 @@ kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.onWorkingData += WorkingData; System.Threading.ThreadPool.QueueUserWorkItem(RunLoadDll); - //kernel.LoadLists(); } void RunLoadDll(Object ob) { + kernel.AddControl += new EventHandler<AcmContester.Mediator.Library.MediatorKernel.ControlEventArds>(kernel_AddControl); kernel.LoadLists(); } + delegate void AddControlCallback(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArds e); + void kernel_AddControl(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArds e) + { + if (this.tabControl1.InvokeRequired) + { + AddControlCallback d = new AddControlCallback(kernel_AddControl); + this.Invoke(d, new object[] { sender, e }); + } + else + { + Control control = e.Control; + control.Dock = DockStyle.Fill; + string name = e.Name; + TabPage page = new TabPage(name); + page.Controls.Add(control); + tabControl1.TabPages.Add(page); + } + } + private void WorkingData(string message) { string s = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": "; Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -2,6 +2,7 @@ using System.Collections; using AcmContester.Plugins.PluginsFramework; using System.Collections.Generic; +using System.Windows.Forms; namespace AcmContester.Mediator.Library { @@ -10,22 +11,67 @@ List<BaseMediatorPlugin> clientSideList; List<BaseMediatorPlugin> testerSideList; - public void LoadLists() + public Panel panel; + + internal sealed class ControlEventArds : EventArgs { - clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); - foreach (BaseMediatorPlugin plugin in clientSideList) + Control control; + string name; + public ControlEventArds(Control in_Control, string in_Name) { - plugin.onDataArrived += DataArrivedFromClientList; - plugin.onWorkingData += WorkingData; + control = in_Control; + name = in_Name; } + public Control Control + { + get + { + return control; + } + } + public string Name + { + get + { + return name; + } + } + + } + + public event EventHandler<ControlEventArds> AddControl; + + public void LoadLists() + { testerSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Tester"); foreach (BaseMediatorPlugin plugin in testerSideList) { plugin.onDataArrived += DataArrivedFromTesterList; plugin.onWorkingData += WorkingData; + if (plugin.Control != null) + { + this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + } } + clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); + foreach (BaseMediatorPlugin plugin in clientSideList) + { + plugin.onDataArrived += DataArrivedFromClientList; + plugin.onWorkingData += WorkingData; + if (plugin.Control != null) + { + this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + } + } } + private void OnAddControl(ControlEventArds e) + { + EventHandler<ControlEventArds> temp = AddControl; + if (temp != null) + temp(this, e); + } + public delegate void WorkingData_EventHandler(string message); public event WorkingData_EventHandler onWorkingData; private void WorkingData(string message) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,5 +1,6 @@ using System; using AcmContester.Plugins.PluginsFramework; +using SocketServerGatePlugin; namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin { @@ -11,6 +12,8 @@ { socketServerGate = SocketServerGate.GetInstance(); socketServerGate.onDataArrived += DataArrived; + + base.Control = new TestUserControl(); } public override void Send(string message) @@ -20,8 +23,8 @@ socketServerGate.Stop(); return; } - WorkingData("WebGatePlugin::Send(" + message + ")"); - WorkingData("WebGatePlugin::Send CountClients = "+ socketServerGate.CountClients().ToString()); + WorkingData("SocketServerGatePlugin::Send(" + message + ")"); + WorkingData("SocketServerGatePlugin::Send CountClients = " + socketServerGate.CountClients().ToString()); socketServerGate.Send(message); } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -29,11 +29,21 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SocketServerGate.cs" /> <Compile Include="SocketServerGatePlugin.cs" /> + <Compile Include="TestUserControl.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="TestUserControl.Designer.cs"> + <DependentUpon>TestUserControl.cs</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> @@ -53,6 +63,12 @@ <Name>PluginsFramework</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="TestUserControl.resx"> + <SubType>Designer</SubType> + <DependentUpon>TestUserControl.cs</DependentUpon> + </EmbeddedResource> + </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. Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,87 @@ +namespace SocketServerGatePlugin +{ + partial class TestUserControl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.setButton = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.clearButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // setButton + // + this.setButton.Location = new System.Drawing.Point(3, 3); + this.setButton.Name = "setButton"; + this.setButton.Size = new System.Drawing.Size(63, 23); + this.setButton.TabIndex = 0; + this.setButton.Text = "setButton"; + this.setButton.UseVisualStyleBackColor = true; + this.setButton.Click += new System.EventHandler(this.setButton_Click); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(3, 32); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox1.Size = new System.Drawing.Size(144, 115); + this.textBox1.TabIndex = 1; + // + // clearButton + // + this.clearButton.Location = new System.Drawing.Point(72, 3); + this.clearButton.Name = "clearButton"; + this.clearButton.Size = new System.Drawing.Size(75, 23); + this.clearButton.TabIndex = 2; + this.clearButton.Text = "clearButton"; + this.clearButton.UseVisualStyleBackColor = true; + this.clearButton.Click += new System.EventHandler(this.clearButton_Click); + // + // TestUserControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.clearButton); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.setButton); + this.Name = "TestUserControl"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button setButton; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button clearButton; + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace SocketServerGatePlugin +{ + public partial class TestUserControl : UserControl + { + public TestUserControl() + { + InitializeComponent(); + } + + private void clearButton_Click(object sender, EventArgs e) + { + textBox1.Text = ""; + } + + private void setButton_Click(object sender, EventArgs e) + { + textBox1.Text = "A"; + } + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,5 +1,6 @@ using System; using AcmContester.Plugins.PluginsFramework; +using WebGatePlugin; namespace AcmContester.Plugins.MediatorPlugins.WebGatePlugin { @@ -11,6 +12,8 @@ { webGate = WebGate.GetInstance(); webGate.onDataArrived += DataArrived; + + base.Control = new WebGatePluginUserControl(); } public override void Send(string message) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -30,12 +30,20 @@ <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebGate.cs" /> <Compile Include="WebGatePlugin.cs" /> + <Compile Include="WebGatePluginUserControl.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="WebGatePluginUserControl.Designer.cs"> + <DependentUpon>WebGatePluginUserControl.cs</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> @@ -47,6 +55,12 @@ <Name>PluginsFramework</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="WebGatePluginUserControl.resx"> + <SubType>Designer</SubType> + <DependentUpon>WebGatePluginUserControl.cs</DependentUpon> + </EmbeddedResource> + </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. Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,93 @@ +namespace WebGatePlugin +{ + partial class WebGatePluginUserControl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.textBox2 = new System.Windows.Forms.TextBox(); + this.setAddressButton = new System.Windows.Forms.Button(); + this.addressComboBox = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // textBox2 + // + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox2.Location = new System.Drawing.Point(3, 32); + this.textBox2.Multiline = true; + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(263, 193); + this.textBox2.TabIndex = 2; + // + // setAddressButton + // + this.setAddressButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.setAddressButton.Location = new System.Drawing.Point(191, 3); + this.setAddressButton.Name = "setAddressButton"; + this.setAddressButton.Size = new System.Drawing.Size(75, 23); + this.setAddressButton.TabIndex = 3; + this.setAddressButton.Text = "Set Address"; + this.setAddressButton.UseVisualStyleBackColor = true; + this.setAddressButton.Click += new System.EventHandler(this.setAddressButton_Click); + // + // addressComboBox + // + this.addressComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.addressComboBox.FormattingEnabled = true; + this.addressComboBox.Items.AddRange(new object[] { + "http://acm.lviv.ua/version3", + "http://127.0.0.1/d"}); + this.addressComboBox.Location = new System.Drawing.Point(3, 5); + this.addressComboBox.Name = "addressComboBox"; + this.addressComboBox.Size = new System.Drawing.Size(182, 21); + this.addressComboBox.TabIndex = 4; + this.addressComboBox.Text = "http://127.0.0.1/d"; + // + // WebGatePluginUserControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.addressComboBox); + this.Controls.Add(this.setAddressButton); + this.Controls.Add(this.textBox2); + this.Name = "WebGatePluginUserControl"; + this.Size = new System.Drawing.Size(269, 228); + this.Load += new System.EventHandler(this.WebGatePluginUserControl_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button setAddressButton; + private System.Windows.Forms.ComboBox addressComboBox; + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using AcmContester.Plugins.MediatorPlugins.WebGatePlugin; + +namespace WebGatePlugin +{ + public partial class WebGatePluginUserControl : UserControl + { + public WebGatePluginUserControl() + { + InitializeComponent(); + } + + private void setAddressButton_Click(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + lock (gate.Address) + gate.Address = addressComboBox.Text; + } + + private void WebGatePluginUserControl_Load(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + addressComboBox.Text = gate.Address; + } + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,4 +1,5 @@ using System; +using System.Windows.Forms; namespace AcmContester.Plugins.PluginsFramework { @@ -12,6 +13,20 @@ public abstract void Send(string message); + private UserControl control = null; + + public UserControl Control + { + get + { + return control; + } + protected set + { + control = value; + } + } + protected virtual void DataArrived(string message) { WorkingData("BaseMediatorPlugin::DataArrived(" + message + ")"); Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -29,6 +29,7 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Windows.Forms" /> </ItemGroup> <ItemGroup> <Compile Include="BaseMediatorPlugin.cs" /> Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -18,6 +18,9 @@ List<T> plugins = new List<T>(); if (!Directory.Exists(path)) throw new ArgumentException("Specified path does not exists!"); + //TODO: + if (Directory.Exists(path) == false) + return plugins; string[] allDirectories = Directory.GetDirectories(path); //string[] allFiles = Directory.GetFiles(path, "*.dllx", SearchOption.TopDirectoryOnly); foreach (string directory in allDirectories) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-27 09:38:54
|
Revision: 283 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=283&view=rev Author: brus07 Date: 2008-06-27 02:38:51 -0700 (Fri, 27 Jun 2008) Log Message: ----------- Replace updating logTextBox with timer to updating with special function from Windows.Form. Now scrolling to down only when change text in logTextBox. Modified Paths: -------------- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Form1.resx ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs ACMServer/trunk/ACMServer/Tester/Form1.cs ACMServer/trunk/ACMServer/Tester/Form1.resx Modified: ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-27 09:38:51 UTC (rev 283) @@ -28,14 +28,12 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); this.button2 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); - this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabControl1.SuspendLayout(); @@ -99,12 +97,6 @@ this.textBox3.Size = new System.Drawing.Size(343, 190); this.textBox3.TabIndex = 12; // - // timerUpdateTextLog - // - this.timerUpdateTextLog.Enabled = true; - this.timerUpdateTextLog.Interval = 2000; - this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); - // // tabControl1 // this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -159,7 +151,6 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; - private System.Windows.Forms.Timer timerUpdateTextLog; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; } Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-27 09:38:51 UTC (rev 283) @@ -21,7 +21,6 @@ textBox2.Text = s; } - string fullLog = ""; AcmContester.Mediator.Library.MediatorKernel kernel; private void button2_Click(object sender, EventArgs e) @@ -60,23 +59,24 @@ { string s = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": "; s += message; + UpdateTextLog(s + "\r\n"); + } - lock (fullLog) + delegate void UpdateTextLogCallback(string message); + private void UpdateTextLog(string message) + { + if (this.textBox3.InvokeRequired) { - fullLog += s; - fullLog += "\r\n"; + UpdateTextLogCallback d = new UpdateTextLogCallback(UpdateTextLog); + this.Invoke(d, new object[] { message }); } - } - private void UpdateTextLog() - { - lock (fullLog) + else { - //textBox3.SelectedText = fullLog; - textBox3.Text += fullLog; + textBox3.Text += message; textBox3.Select(textBox3.Text.Length, 0); textBox3.ScrollToCaret(); - fullLog = ""; } + } private void button3_Click(object sender, EventArgs e) @@ -100,10 +100,5 @@ { button2_Click(this, null); } - - private void timerUpdateTextLog_Tick(object sender, EventArgs e) - { - UpdateTextLog(); - } } } \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Mediator/Form1.resx =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.resx 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Mediator/Form1.resx 2008-06-27 09:38:51 UTC (rev 283) @@ -120,7 +120,4 @@ <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="timerUpdateTextLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>300, 17</value> - </metadata> </root> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-27 09:38:51 UTC (rev 283) @@ -38,7 +38,6 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -123,12 +122,6 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // timerUpdateTextLog - // - this.timerUpdateTextLog.Enabled = true; - this.timerUpdateTextLog.Interval = 400; - this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -163,7 +156,6 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private System.Windows.Forms.Timer timerUpdateTextLog; } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-27 09:38:51 UTC (rev 283) @@ -14,7 +14,7 @@ public partial class Form1 : Form { SocketClient socket; - string fullLog = ""; + public Form1() { InitializeComponent(); @@ -58,15 +58,10 @@ { string result = ""; - //textBox1.Text += "\r\n" + message; - lock (fullLog) - { - fullLog += "\r\n"; - fullLog += message; - } + UpdateTextLog("\r\n" + message); + try { - result = Checker.Checker.GetResult(message); } catch (Exception ex) @@ -77,15 +72,30 @@ return; } - //textBox1.Text += "\r\n\t-> " + result; - lock (fullLog) + UpdateTextLog("\r\n" + result); + socket.Send(result); + } + + + + delegate void UpdateTextLogCallback(string message); + private void UpdateTextLog(string message) + { + if (this.textBox1.InvokeRequired) { - fullLog += "\r\n\t->"; - fullLog += result; + UpdateTextLogCallback d = new UpdateTextLogCallback(UpdateTextLog); + this.Invoke(d, new object[] { message }); } - socket.Send(result); + else + { + textBox1.Text += message; + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + } + } + private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Disconnect(); @@ -113,7 +123,7 @@ } catch (Exception) { - fullLog += "\r\n\tLogFile can't open. Working without logging to LogFile."; + UpdateTextLog("\r\n\tLogFile can't open. Working without logging to LogFile."); } } @@ -123,22 +133,5 @@ textBox1.ScrollToCaret(); } - private void UpdateTextLog() - { - lock (fullLog) - { - //textBox3.SelectedText = fullLog; - textBox1.Text += fullLog; - textBox1.Select(textBox1.Text.Length, 0); - textBox1.ScrollToCaret(); - fullLog = ""; - } - } - - private void timerUpdateTextLog_Tick(object sender, EventArgs e) - { - UpdateTextLog(); - } - } } \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Tester/Form1.resx =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-26 22:43:10 UTC (rev 282) +++ ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-27 09:38:51 UTC (rev 283) @@ -123,7 +123,4 @@ <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>127, 17</value> </metadata> - <metadata name="timerUpdateTextLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>210, 17</value> - </metadata> </root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-16 10:23:01
|
Revision: 297 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=297&view=rev Author: brus07 Date: 2008-07-16 03:23:05 -0700 (Wed, 16 Jul 2008) Log Message: ----------- Add new protocol interface. Add some protocols (send, arrived, etc.). Using new protocol in SocketServer. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ArrivedDepthProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasySocketProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EmptyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/Protocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/SendDepthProtocol.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs Property Changed: ---------------- ACMServer/trunk/ACMServer/ Property changes on: ACMServer/trunk/ACMServer ___________________________________________________________________ Name: svn:ignore - *.suo *.Load + *.suo *.Load *.NoLoad Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-16 10:23:05 UTC (rev 297) @@ -43,8 +43,11 @@ <Compile Include="Getter\WebGetter.cs" /> <Compile Include="ISocket.cs" /> <Compile Include="SocketClient.cs" /> - <Compile Include="SocketProtocol\EasyProtocol.cs" /> - <Compile Include="SocketProtocol\IProtocol.cs" /> + <Compile Include="SocketProtocol\ArrivedDepthProtocol.cs" /> + <Compile Include="SocketProtocol\EasySocketProtocol.cs" /> + <Compile Include="SocketProtocol\SendDepthProtocol.cs" /> + <Compile Include="SocketProtocol\EmptyProtocol.cs" /> + <Compile Include="SocketProtocol\Protocol.cs" /> <Compile Include="SocketServer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebConnector.cs" /> Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -7,7 +7,6 @@ public class SocketClient: ISocket { EasyClient client; - IProtocol protocol = new EasyProtocol(); public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; @@ -43,12 +42,12 @@ } public void Send(string message) { - protocol.Send(message, client); + client.SendData(message); } private void DataArrived(object Data) { - protocol.DataArrived(Data.ToString(), this); + OnDataArrived(Data.ToString()); } public bool IsConnected() { Added: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ArrivedDepthProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ArrivedDepthProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ArrivedDepthProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -0,0 +1,21 @@ +using System; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + class ArrivedDepthProtocol: Protocol + { + public override void NextProcess(string message) + { + RunNextProcess(message); + } + + public delegate void DataArrivedDelegate(string s); + public event DataArrivedDelegate onDataArrived; + + public override void PrevProcess(string message) + { + if (onDataArrived != null) + onDataArrived(message); + } + } +} Deleted: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -1,29 +0,0 @@ -using System; -using JadBenAutho.EasySocket; - -namespace AcmContester.Library.Connector.SocketProtocol -{ - class EasyProtocol: IProtocol - { - - #region IProtocol Members - - public void DataArrived(string message, ISocket socket) - { - socket.OnDataArrived(message); - } - - public void Send(string message, EasyServer server, int targerClientIndex) - { - server.SendData(message, targerClientIndex); - } - - public void Send(string message, EasyClient client) - { - if (client.IsConnected == true) - client.SendData(message); - } - - #endregion - } -} Added: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasySocketProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasySocketProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasySocketProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -0,0 +1,32 @@ +using System; +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + class EasySocketProtocol: Protocol + { + EasyServer server; + public EasySocketProtocol(EasyServer inServer) + { + server = inServer; + } + + int clientIndex = 0; + public override void NextProcess(string message) + { + if (server.CountClients > 0) + { + if (clientIndex >= server.CountClients) + clientIndex = 0; + RunNextProcess(message); + //protocol.Send(message, server, clientIndex); + clientIndex++; + } + } + + public override void PrevProcess(string message) + { + RunPrevProcess(message); + } + } +} Added: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EmptyProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EmptyProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EmptyProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -0,0 +1,17 @@ +using System; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + class EmptyProtocol: Protocol + { + public override void NextProcess(string message) + { + RunNextProcess(message); + } + + public override void PrevProcess(string message) + { + RunPrevProcess(message); + } + } +} Deleted: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -1,11 +0,0 @@ -using JadBenAutho.EasySocket; - -namespace AcmContester.Library.Connector.SocketProtocol -{ - interface IProtocol - { - void DataArrived(string message, ISocket socket); - void Send(string message, EasyServer server, int targerClientIndex); - void Send(string message, EasyClient client); - } -} Added: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/Protocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/Protocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/Protocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -0,0 +1,33 @@ +using System; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + public abstract class Protocol + { + Protocol next; + Protocol prev; + + public void SetNextProtocol(Protocol protocol) + { + this.next = protocol; + } + + public void SetPrevProtocol(Protocol protocol) + { + this.prev = protocol; + } + public abstract void NextProcess(string message); + public abstract void PrevProcess(string message); + + protected void RunNextProcess(string message) + { + if (next != null) + next.NextProcess(message); + } + protected void RunPrevProcess(string message) + { + if (prev != null) + prev.PrevProcess(message); + } + } +} Added: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/SendDepthProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/SendDepthProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/SendDepthProtocol.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -0,0 +1,23 @@ +using System; +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + class SendDepthProtocol: Protocol + { + EasyServer server; + public SendDepthProtocol(EasyServer inServer) + { + server = inServer; + } + public override void NextProcess(string message) + { + server.SendData(message, 0); + } + + public override void PrevProcess(string message) + { + RunPrevProcess(message); + } + } +} Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -9,8 +9,6 @@ int port = 4120; EasyServer server; - IProtocol protocol = new EasyProtocol(); - public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; @@ -18,6 +16,8 @@ { server = new EasyServer(port, true); server.DataArrived += new DataArrived2Server_EventHandler(DataArrived); + + InitProtocol(); } public void Start() @@ -38,19 +38,12 @@ private void DataArrived(object Data, SocketStream DataSender) { - protocol.DataArrived(Data.ToString(), this); + arrivedHead.PrevProcess(Data.ToString()); } - int clientIndex = 0; public void Send(string message) { - if (server.CountClients > 0) - { - if (clientIndex >= server.CountClients) - clientIndex = 0; - protocol.Send(message, server, clientIndex); - clientIndex++; - } + sendHead.NextProcess(message); } public int CountClients() @@ -58,6 +51,37 @@ return server.CountClients; } + Protocol sendHead; + Protocol sendNext; + Protocol arrivedHead; + Protocol arrivedNext; + + private void InitProtocol() + { + Protocol sendProtocol = new SendDepthProtocol(server); + Protocol arrivedProtocol = new ArrivedDepthProtocol(); + ((ArrivedDepthProtocol)arrivedProtocol).onDataArrived += OnDataArrived; + sendHead = arrivedProtocol; + arrivedProtocol.SetNextProtocol(sendProtocol); + sendNext = sendProtocol; + + arrivedHead = sendProtocol; + sendProtocol.SetPrevProtocol(arrivedProtocol); + arrivedNext = arrivedProtocol; + + Protocol easySocketProtocol = new EasySocketProtocol(server); + AddProtocol(easySocketProtocol); + } + + public void AddProtocol(Protocol protocol) + { + protocol.SetNextProtocol(sendNext); + sendHead.SetNextProtocol(protocol); + + protocol.SetPrevProtocol(arrivedHead); + arrivedNext.SetPrevProtocol(protocol); + } + #region ISocket Members public void OnDataArrived(string message) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-07-11 11:35:15 UTC (rev 296) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-07-16 10:23:05 UTC (rev 297) @@ -29,25 +29,22 @@ public new void Send(string message) { - if (base.CountClients() > 0) + SubmitList submitList = SubmitList.CreateFromXml(message); + for (int index = 0; index < submitList.Items.Length; index++) { - SubmitList submitList = SubmitList.CreateFromXml(message); - for (int index = 0; index < submitList.Items.Length; index++) + if (dataContainer.Add(submitList.Items[index]) == true) { - if (dataContainer.Add(submitList.Items[index]) == true) - { - base.Send(submitList.Items[index].ToString()); - } + base.Send(submitList.Items[index].ToString()); } + } - OnLogMessage("SocketServerGate::Send(message)"); - string ids = ""; - for (int i = 0; i < submitList.Items.Length; i++) - { - ids += " " + submitList.Items[i].id.ToString(); - } - OnLogMessage("\t ID: " + ids); + OnLogMessage("SocketServerGate::Send(message)"); + string ids = ""; + for (int i = 0; i < submitList.Items.Length; i++) + { + ids += " " + submitList.Items[i].id.ToString(); } + OnLogMessage("\t ID: " + ids); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |