You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(128) |
Jun
(97) |
Jul
(13) |
Aug
(40) |
Sep
(50) |
Oct
(27) |
Nov
(7) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(18) |
Feb
(47) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(32) |
Aug
|
Sep
(14) |
Oct
(22) |
Nov
|
Dec
|
From: <di...@us...> - 2008-08-06 20:54:53
|
Revision: 307 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=307&view=rev Author: dixond Date: 2008-08-06 20:54:59 +0000 (Wed, 06 Aug 2008) Log Message: ----------- ?\208?\159?\208?\181?\209?\128?\209?\136?\208?\176 ?\209?\128?\208?\190?\208?\177?\208?\190?\209?\135?\208?\176 ?\208?\178?\208?\181?\209?\128?\209?\129?\209?\150?\209?\143 ?\208?\186?\208?\187?\208?\176?\209?\129?\209?\131 Checker - ?\208?\186?\208?\187?\208?\176?\209?\129 ?\208?\180?\208?\187?\209?\143 ?\209?\128?\208?\190?\208?\177?\208?\190?\209?\130?\208?\184 ?\208?\183 ?\208?\178?\208?\176?\208?\187?\209?\150?\208?\180?\208?\176?\209?\130?\208?\190?\209?\128?\208?\190?\208?\188 ?\209?\131 ?\208?\178?\208?\184?\208?\179?\208?\187?\209?\143?\208?\180?\209?\150 ?\209?\129?\208?\186?\209?\128?\209?\150?\208?\191?\209?\130?\208?\176 ?\208?\189?\208?\176 ?\208?\188?\208?\190?\208?\178?\209?\150 Script.Net Added Paths: ----------- ACMServer/trunk/sharp tester/Checker/ ACMServer/trunk/sharp tester/Checker/Checker.cs ACMServer/trunk/sharp tester/Checker/Checker.csproj ACMServer/trunk/sharp tester/Checker/Checker.sln ACMServer/trunk/sharp tester/Checker/Checker.suo ACMServer/trunk/sharp tester/Checker/Properties/ ACMServer/trunk/sharp tester/Checker/Properties/AssemblyInfo.cs ACMServer/trunk/sharp tester/Checker/ReadMe!.txt ACMServer/trunk/sharp tester/Checker/bin/ ACMServer/trunk/sharp tester/Checker/bin/Debug/ ACMServer/trunk/sharp tester/Checker/bin/Debug/Checker.dll ACMServer/trunk/sharp tester/Checker/bin/Debug/Checker.pdb ACMServer/trunk/sharp tester/Checker/bin/Debug/MutanticFramework.dll ACMServer/trunk/sharp tester/Checker/bin/Debug/ScriptDotNet.dll ACMServer/trunk/sharp tester/Checker/obj/ ACMServer/trunk/sharp tester/Checker/obj/Checker.csproj.FileList.txt ACMServer/trunk/sharp tester/Checker/obj/Debug/ ACMServer/trunk/sharp tester/Checker/obj/Debug/Checker.dll ACMServer/trunk/sharp tester/Checker/obj/Debug/Checker.pdb ACMServer/trunk/sharp tester/Checker/obj/Debug/ResolveAssemblyReference.cache ACMServer/trunk/sharp tester/Checker/obj/Debug/TempPE/ ACMServer/trunk/sharp tester/Checker/scriptExample.txt Added: ACMServer/trunk/sharp tester/Checker/Checker.cs =================================================================== --- ACMServer/trunk/sharp tester/Checker/Checker.cs (rev 0) +++ ACMServer/trunk/sharp tester/Checker/Checker.cs 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +using ScriptDotNet; + +namespace Tester +{ + public enum CheckResult + { + AC, + WA, + PE, + OE + } + public class Checker + { + public string input; + public string output; + public string correctOutput; + public string scriptPath; + + public Checker() { } + + public Checker(string scriptPath,string input, string output, string correctOutput) + { + this.input = input; + this.output = output; + this.correctOutput = output; + this.scriptPath = scriptPath; + } + + public Checker(string scriptPath, string input, string output) + : this(scriptPath,input,output,"") { } + + public CheckResult Check() + { + Script scr = Script.Compile(File.ReadAllText(scriptPath)); + scr.AddBuildInObject(input); + scr.AddBuildInObject(output); + scr.AddBuildInObject(correctOutput); + scr.Execute(); + string result = scr.Lookup("result").ToString(); + return (CheckResult)Enum.Parse(typeof(CheckResult), result); + } + } +} Added: ACMServer/trunk/sharp tester/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/sharp tester/Checker/Checker.csproj (rev 0) +++ ACMServer/trunk/sharp tester/Checker/Checker.csproj 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,48 @@ +<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>{BAFD4E93-B37A-416F-807D-E2515ECB6498}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Checker</RootNamespace> + <AssemblyName>Checker</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="ScriptDotNet, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL" /> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Checker.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/sharp tester/Checker/Checker.sln =================================================================== --- ACMServer/trunk/sharp tester/Checker/Checker.sln (rev 0) +++ ACMServer/trunk/sharp tester/Checker/Checker.sln 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker.csproj", "{BAFD4E93-B37A-416F-807D-E2515ECB6498}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BAFD4E93-B37A-416F-807D-E2515ECB6498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAFD4E93-B37A-416F-807D-E2515ECB6498}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAFD4E93-B37A-416F-807D-E2515ECB6498}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAFD4E93-B37A-416F-807D-E2515ECB6498}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: ACMServer/trunk/sharp tester/Checker/Checker.suo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: ACMServer/trunk/sharp tester/Checker/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/sharp tester/Checker/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/sharp tester/Checker/Properties/AssemblyInfo.cs 2008-08-06 20:54:59 UTC (rev 307) @@ -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("Checker")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("Checker")] +[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("1d62a31f-a671-4aee-8370-ce3ceba8ae3b")] + +// 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")] Added: ACMServer/trunk/sharp tester/Checker/ReadMe!.txt =================================================================== --- ACMServer/trunk/sharp tester/Checker/ReadMe!.txt (rev 0) +++ ACMServer/trunk/sharp tester/Checker/ReadMe!.txt 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,15 @@ +>>>>>>>>>>>>>>\xD4\xEE\xF0\xEC\xE0\xF2 \xF1\xEA\xF0\xB3\xEF\xF2\xEE\xE2\xEE\xE3\xEE \xF4\xE0\xE9\xEB\xF3<<<<<<<<<<<<<< +\xD1\xEA\xF0\xB3\xEF\xF2\xE8 \xEF\xE8\xF8\xF3\xF2\xFC\xF1\xFF \xED\xE0 \xEC\xEE\xE2\xB3 Script.NET (\xF1\xE8\xED\xF2\xE0\xEA\xF1\xE8\xF1 \xEE\xEF\xE8\xF8\xF3 \xEF\xB3\xE7\xED\xB3\xF8\xE5) + +\xD1\xEA\xF0\xB3\xEF\xF2\xF3 \xE4\xEE\xF1\xF2\xF3\xEF\xED\xB3 \xED\xE0\xF1\xF2\xF3\xEF\xED\xB3 \xE7\xEC\xB3\xED\xED\xB3: +input - \xE2\xF5\xB3\xE4\xED\xE8\xE9 \xF2\xE5\xF1\xF2 (\xEC\xEE\xE6\xE5 \xE1\xF3\xF2\xE8 \xEF\xEE\xF0\xEE\xE6\xED\xB3\xE9) +output - \xE2\xE8\xF5\xB3\xE4 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 \xE4\xEB\xFF \xEF\xE5\xF0\xE5\xE2\xB3\xF0\xEA\xE8 +correctOutput - \xEA\xEE\xF0\xE5\xEA\xF2\xED\xE8\xE9 \xE2\xE8\xF5\xB3\xE4 (\xEC\xEE\xE6\xE5 \xE1\xF3\xF2\xE8 \xEF\xEE\xF0\xEE\xE6\xED\xB3\xE9) + +\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xE2\xE8\xEA\xEE\xED\xE0\xED\xED\xFF \xF1\xEA\xF0\xB3\xEF\xF2 \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xBA \xF3 \xE7\xEC\xB3\xED\xED\xF3 result +('WA','AC','PE','OE') +>>>>>>>>>>>>>>>>>>\xCF\xF0\xE8\xEA\xEB\xE0\xE4<<<<<<<<<<<<<<<<<<<<<<< + +if (output==correctOutput) +result='AC'; +else result='WA'; \ No newline at end of file Property changes on: ACMServer/trunk/sharp tester/Checker/bin/Debug/Checker.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: ACMServer/trunk/sharp tester/Checker/bin/Debug/Checker.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: ACMServer/trunk/sharp tester/Checker/bin/Debug/MutanticFramework.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: ACMServer/trunk/sharp tester/Checker/bin/Debug/ScriptDotNet.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: ACMServer/trunk/sharp tester/Checker/obj/Checker.csproj.FileList.txt =================================================================== --- ACMServer/trunk/sharp tester/Checker/obj/Checker.csproj.FileList.txt (rev 0) +++ ACMServer/trunk/sharp tester/Checker/obj/Checker.csproj.FileList.txt 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,6 @@ +bin\Debug\Checker.dll +bin\Debug\Checker.pdb +bin\Debug\MutanticFramework.dll +obj\Debug\ResolveAssemblyReference.cache +obj\Debug\Checker.dll +obj\Debug\Checker.pdb Property changes on: ACMServer/trunk/sharp tester/Checker/obj/Debug/Checker.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: ACMServer/trunk/sharp tester/Checker/obj/Debug/Checker.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: ACMServer/trunk/sharp tester/Checker/obj/Debug/ResolveAssemblyReference.cache ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: ACMServer/trunk/sharp tester/Checker/scriptExample.txt =================================================================== --- ACMServer/trunk/sharp tester/Checker/scriptExample.txt (rev 0) +++ ACMServer/trunk/sharp tester/Checker/scriptExample.txt 2008-08-06 20:54:59 UTC (rev 307) @@ -0,0 +1,3 @@ +if (output==correctOutput) +result='AC'; +else result='WA'; \ 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-08-04 21:57:54
|
Revision: 306 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=306&view=rev Author: brus07 Date: 2008-08-04 21:57:57 +0000 (Mon, 04 Aug 2008) Log Message: ----------- Add doc comment. Refactoring. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-08-02 12:49:14 UTC (rev 305) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-08-04 21:57:57 UTC (rev 306) @@ -3,6 +3,9 @@ namespace AcmContester.Plugins.PluginsFramework { + /// <summary> + /// <para>\xC0\xE1\xF1\xF2\xF0\xE0\xEA\xF2\xED\xE8\xE9 \xE2\xB3\xE4\xEA\xF0\xE8\xF2\xE8\xE9 \xEA\xEB\xE0\xF1 \xE4\xEB\xFF \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xEF\xEB\xE0\xE3\xB3\xED\xB3\xE2.</para> + /// </summary> public abstract class BaseMediatorPlugin { public delegate void DataArrived_EventHandler(string message); Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-08-02 12:49:14 UTC (rev 305) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-08-04 21:57:57 UTC (rev 306) @@ -5,26 +5,42 @@ namespace AcmContester.Plugins.PluginsFramework { + /// <summary> + /// <para>\xC4\xEE\xEF\xEE\xEC\xB3\xE6\xED\xE8\xE9 \xEA\xEB\xE0\xF1 \xE4\xEB\xFF \xE4\xE8\xED\xE0\xEC\xB3\xF7\xED\xEE\xE3\xEE \xE7\xE0\xE2\xE0\xED\xF2\xE0\xE6\xE5\xED\xED\xFF \xE2\xF1\xB3\xF5 + /// \xF2\xE8\xEF\xB3\xE2 <typeparamref name="T"/> \xB3\xE7 dll, \xFF\xEA\xB3 \xE7\xED\xE0\xF5\xEE\xE4\xFF\xF2\xFC\xF1\xFF + /// \xF3 \xE2\xEA\xE0\xE7\xE0\xED\xB3\xE9 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xBF.</para> + /// </summary> + /// <typeparam name="T">\xD2\xE8\xEF, \xFF\xEA\xE8\xE9 \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE7\xE0\xE2\xE0\xED\xF2\xE0\xE6\xE8\xF2\xE8.</typeparam> 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 + /// <para>Try to load all the instances of type <typeparamref name="T"/> in all the DLLs, + /// found at path.</para> + /// <para>\xD8\xF3\xEA\xE0\xFE\xF2\xFC\xF1\xFF \xE2\xF1\xB3 dll, \xE2 \xFF\xEA\xE8\xF5 \xBA \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xFF \xF2\xE8\xEF\xF3 <typeparamref name="T"/>. + /// \xC4\xEB\xFF \xF6\xFC\xEE\xE3\xEE \xEF\xE5\xF0\xE5\xE1\xE8\xF0\xE0\xBA\xF2\xFC\xF1\xFF \xEA\xEE\xE6\xED\xE0 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xFF \xE2 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xBF, \xF9\xEE \xE2\xEA\xE0\xE7\xF3\xBA\xF2\xFC\xF1\xFF + /// \xEF\xE0\xF0\xE0\xEC\xE5\xF2\xF0\xEE\xEC <paramref name="path"/> \xB3 \xF6\xE8\xF5 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xE9 \xE1\xE5\xF0\xE5\xF2\xFC\xF1\xFF + /// \xE4\xEE \xF3\xE2\xE0\xE3\xE8 \xF2\xB3\xEB\xFC\xEA\xE8 \xF2\xE0 dll \xF9\xEE \xEC\xE0\xBA \xED\xE0\xE7\xE2\xF3 \xF2\xE0\xEA\xF3 \xF1\xE0\xEC\xF3 \xFF\xEA \xB3 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xFF + /// \xE2 \xFF\xEA\xB3\xE9 \xE2\xEE\xED\xE0 \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xFC\xF1\xFF.</para> /// </summary> - /// <param name="path">Path where to find appropriate DLLs</param> - /// <returns>List of all instaces found</returns> + /// <param name="path">Path where to find appropriate DLLs.</param> + /// <returns>List of all instaces found.</returns> + /// <exception cref="DirectoryNotFoundException">Specified path (<paramref name="path"/>) does not exists.</exception> + /// <exception cref="ArgumentNullException"><paramref name="path"/> is a null reference.</exception> + /// <exception cref="ArgumentException">The <paramref name="path"/> parameter is the empty string ("").</exception> public static List<T> Load(string path) { + if (path == null) + throw new ArgumentNullException("path", "Parameter is a null reference"); + if (path.Length == 0) + throw new ArgumentException("The parameter is the empty string (\"\").", "path"); + if (!Directory.Exists(path)) + throw new DirectoryNotFoundException("Specified path (" + path + ") does not exists!"); + 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) { + ///\xE3\xE5\xED\xE5\xF0\xF3\xBA\xF2\xFC\xF1\xFF \xEF\xEE\xF2\xF0\xB3\xE1\xED\xE8\xE9 \xF8\xEB\xFF\xF5 \xE4\xEE dll \xF3 \xE4\xE8\xF0\xE5\xEA\xF2\xEE\xF0\xB3\xBF directory string fileName = directory.Substring(directory.LastIndexOf('\\')+1) + ".dll"; string fileFullName = directory + "\\" + fileName; ScanAndLoad(fileFullName, ref plugins); @@ -33,23 +49,30 @@ } /// <summary> - /// Load all instances of type T in specified file and - /// add them to provided list + /// <para>Load all instances of type <typeparamref name="T"/> in specified file and + /// add them to provided list.</para> /// </summary> - /// <param name="filename">Which file to scan</param> - /// <param name="lst">Where to add found objects</param> + /// <param name="filename">Which file to scan.</param> + /// <param name="lst">Where to add found objects.</param> private static void ScanAndLoad(string filename, ref List<T> lst) { if (File.Exists(filename) == false) { - //throw new Exception("!!!!!!!!!!"); return; } - Assembly assembly = Assembly.LoadFrom(filename); + + Assembly assembly; + try + { + assembly = Assembly.LoadFrom(filename); + } + catch + { + return; + } if (assembly != null) { Type[] types = assembly.GetExportedTypes(); - foreach (Type t in types) { try @@ -58,21 +81,21 @@ if (t.GetInterface(typeof(T).FullName) != null || t.IsSubclassOf(typeof(T))) lst.Add((T)Activator.CreateInstance(t)); } - catch (System.Reflection.TargetInvocationException ex) + catch (System.Reflection.TargetInvocationException) { //throw ex; } - catch (System.MissingMethodException ex) + catch (System.MissingMethodException) { //throw ex; } - catch (System.InvalidCastException ex) + catch (System.InvalidCastException) { //throw ex; } - catch (Exception ex) + catch { - //throw ex; + throw; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-08-02 12:49:04
|
Revision: 305 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=305&view=rev Author: brus07 Date: 2008-08-02 12:49:14 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Add ScrollBars to textBox in WebGatePlugin and fixed bug in one. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-08-02 12:39:10 UTC (rev 304) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-08-02 12:49:14 UTC (rev 305) @@ -48,6 +48,7 @@ this.textBox2.Location = new System.Drawing.Point(3, 58); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; + this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox2.Size = new System.Drawing.Size(263, 145); this.textBox2.TabIndex = 2; // Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-08-02 12:39:10 UTC (rev 304) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-08-02 12:49:14 UTC (rev 305) @@ -46,7 +46,7 @@ else { string timeStr = DateTime.Now.ToLongTimeString() + "." + DateTime.Now.Millisecond.ToString(); - textBox2.Text += timeStr + " " + text + " "; + textBox2.Text += timeStr + " " + text + Environment.NewLine; //if (autoScrollCheckBox.Checked) { textBox2.Select(textBox2.Text.Length, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-08-02 12:39:01
|
Revision: 304 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=304&view=rev Author: brus07 Date: 2008-08-02 12:39:10 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Show in statusBar status about checking webSite. Status can be "Checking..." or empty. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 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/WebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-07-30 20:45:49 UTC (rev 303) +++ ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-08-02 12:39:10 UTC (rev 304) @@ -11,6 +11,9 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; + public event EventHandler onChecking; + public event EventHandler onChecked; + private IGetter getter = new WebGetter(); public WebConnector() @@ -38,13 +41,26 @@ private void OnTimedEvent(object source, ElapsedEventArgs e) { timer.Enabled = false; + OnChecking(); object ob = getter.GetInfoFromSite(); + OnChecked(); if (ob != null) { DataArrived(ob); } timer.Enabled = true; } + + private void OnChecking() + { + if (onChecking != null) + onChecking(this, null); + } + private void OnChecked() + { + if (onChecked != null) + onChecked(this, null); + } private void DataArrived(object Data) { Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-30 20:45:49 UTC (rev 303) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-08-02 12:39:10 UTC (rev 304) @@ -14,6 +14,9 @@ webGate.onDataArrived += DataArrived; base.Control = new WebGatePluginUserControl(); + + webGate.onChecked += OnChecked; + webGate.onChecking += OnChecking; } public override void Send(string message) @@ -26,10 +29,24 @@ protected override void DataArrived(string message) { - string text = "Arrived: " + message.Length + " bytes" + Environment.NewLine; + string text = "Arrived: " + message.Length + " bytes"; ((WebGatePluginUserControl)base.Control).AddText(text); base.DataArrived(message); } + + private void OnChecked(object o,EventArgs a) + { + SetStatusLabel(""); + } + private void OnChecking(object o,EventArgs a) + { + SetStatusLabel("Checking..."); + } + + private void SetStatusLabel(string str) + { + ((WebGatePluginUserControl)base.Control).MainStatusMessage = str; + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-07-30 20:45:49 UTC (rev 303) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-08-02 12:39:10 UTC (rev 304) @@ -34,7 +34,10 @@ this.CheckingIntervalNumericUpDown = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.MainToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).BeginInit(); + this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // textBox2 @@ -45,7 +48,7 @@ this.textBox2.Location = new System.Drawing.Point(3, 58); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(263, 167); + this.textBox2.Size = new System.Drawing.Size(263, 145); this.textBox2.TabIndex = 2; // // setAddressButton @@ -114,10 +117,26 @@ this.label2.TabIndex = 7; this.label2.Text = "seconds."; // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.MainToolStripStatusLabel}); + this.statusStrip1.Location = new System.Drawing.Point(0, 206); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(269, 22); + this.statusStrip1.TabIndex = 8; + this.statusStrip1.Text = "statusStrip1"; + // + // MainToolStripStatusLabel + // + this.MainToolStripStatusLabel.Name = "MainToolStripStatusLabel"; + this.MainToolStripStatusLabel.Size = new System.Drawing.Size(0, 17); + // // WebGatePluginUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.statusStrip1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.CheckingIntervalNumericUpDown); @@ -128,6 +147,8 @@ this.Size = new System.Drawing.Size(269, 228); this.Load += new System.EventHandler(this.WebGatePluginUserControl_Load); ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).EndInit(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -141,5 +162,7 @@ private System.Windows.Forms.NumericUpDown CheckingIntervalNumericUpDown; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel MainToolStripStatusLabel; } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-07-30 20:45:49 UTC (rev 303) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-08-02 12:39:10 UTC (rev 304) @@ -54,5 +54,13 @@ } } } + + public string MainStatusMessage + { + set + { + MainToolStripStatusLabel.Text = value; + } + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx 2008-07-30 20:45:49 UTC (rev 303) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx 2008-08-02 12:39:10 UTC (rev 304) @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 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-30 20:45:45
|
Revision: 303 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=303&view=rev Author: brus07 Date: 2008-07-30 20:45:49 +0000 (Wed, 30 Jul 2008) Log Message: ----------- In WebGatePlugin can change checking interval. Show log in textBox in WebGatePlugin. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -58,5 +58,11 @@ { getter.Send(message); } + + protected void SetTimerInterval(int valueOfSeconds) + { + lock (timer) + timer.Interval = valueOfSeconds * 1000; + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -18,5 +18,13 @@ { return instance; } + + public int CheckingIntervarInSeconds + { + set + { + this.SetTimerInterval(value); + } + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -18,7 +18,18 @@ public override void Send(string message) { + string text = " Send: " + message.Length + " bytes" + Environment.NewLine; + ((WebGatePluginUserControl)base.Control).AddText(text); + webGate.Send(message); } + + protected override void DataArrived(string message) + { + string text = "Arrived: " + message.Length + " bytes" + Environment.NewLine; + ((WebGatePluginUserControl)base.Control).AddText(text); + + base.DataArrived(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -31,6 +31,10 @@ this.textBox2 = new System.Windows.Forms.TextBox(); this.setAddressButton = new System.Windows.Forms.Button(); this.addressComboBox = new System.Windows.Forms.ComboBox(); + this.CheckingIntervalNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).BeginInit(); this.SuspendLayout(); // // textBox2 @@ -38,10 +42,10 @@ 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.Location = new System.Drawing.Point(3, 58); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(263, 193); + this.textBox2.Size = new System.Drawing.Size(263, 167); this.textBox2.TabIndex = 2; // // setAddressButton @@ -69,16 +73,61 @@ this.addressComboBox.TabIndex = 4; this.addressComboBox.Text = "http://127.0.0.1/d"; // + // CheckingIntervalNumericUpDown + // + this.CheckingIntervalNumericUpDown.Location = new System.Drawing.Point(90, 32); + this.CheckingIntervalNumericUpDown.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.Name = "CheckingIntervalNumericUpDown"; + this.CheckingIntervalNumericUpDown.Size = new System.Drawing.Size(53, 20); + this.CheckingIntervalNumericUpDown.TabIndex = 5; + this.CheckingIntervalNumericUpDown.Value = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.ValueChanged += new System.EventHandler(this.CheckingIntervalNumericUpDown_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 35); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(81, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Checking every"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(149, 34); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(50, 13); + this.label2.TabIndex = 7; + this.label2.Text = "seconds."; + // // WebGatePluginUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.CheckingIntervalNumericUpDown); 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); + ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -89,5 +138,8 @@ private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button setAddressButton; private System.Windows.Forms.ComboBox addressComboBox; + private System.Windows.Forms.NumericUpDown CheckingIntervalNumericUpDown; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -28,5 +28,31 @@ WebGate gate = WebGate.GetInstance(); addressComboBox.Text = gate.Address; } + + private void CheckingIntervalNumericUpDown_ValueChanged(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + gate.CheckingIntervarInSeconds = (int)((NumericUpDown)sender).Value; + } + + delegate void AddTextCallback(string text); + public void AddText(string text) + { + if (this.textBox2.InvokeRequired) + { + AddTextCallback d = new AddTextCallback(AddText); + this.Invoke(d, new object[] { text }); + } + else + { + string timeStr = DateTime.Now.ToLongTimeString() + "." + DateTime.Now.Millisecond.ToString(); + textBox2.Text += timeStr + " " + text + " "; + //if (autoScrollCheckBox.Checked) + { + textBox2.Select(textBox2.Text.Length, 0); + textBox2.ScrollToCaret(); + } + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-25 13:20:47
|
Revision: 302 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=302&view=rev Author: brus07 Date: 2008-07-25 13:20:56 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Checking the tester on employment. Send and receive SystemMessage from Testers. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-25 10:00:45 UTC (rev 301) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-25 13:20:56 UTC (rev 302) @@ -1,5 +1,6 @@ using System; using JadBenAutho.EasySocket; +using System.Collections.Generic; namespace AcmContester.Library.Connector { @@ -33,27 +34,121 @@ } } + public void Send(string message) + { + List<int> freeTesters = GetFreeTesters(); + if (freeTesters.Count != 0) + { + Random random = new Random(); + DataSender(message, freeTesters[random.Next() % freeTesters.Count]); + } + } + protected virtual void DataSender(string message, int clientIndex) + { + server.SendData(message, clientIndex); + } + private void DataArrived(object Data, SocketStream DataSender) { - OnDataArrived(Data.ToString()); + if (SystemMessage(Data.ToString()) == true) + return; + DataArriver(Data.ToString()); } - - public void Send(string message) + protected virtual void DataArriver(string message) { - server.SendData(message, 0); + OnDataArrived(message); } + private void OnDataArrived(string message) + { + if (onDataArrived != null) + { + onDataArrived(message); + } + } public int CountClients() { return server.CountClients; } - private void OnDataArrived(string message) + + Queue<string> q = new Queue<string>(); + + /// <summary> + /// \xCF\xEE\xE2\xE5\xF0\xF2\xE0\xBA \xF1\xEF\xE8\xF1\xEE\xEA \xE2\xB3\xEB\xFC\xED\xE8\xF5 \xF2\xE5\xF1\xF2\xE5\xF0\xB3\xE2. + /// ³\xE4\xEF\xF0\xE0\xE2\xEB\xFF\xBA \xEA\xEE\xE6\xED\xEE\xEC\xF3 \xF2\xE5\xF1\xF2\xE5\xF0\xF3 \xEF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xE5\xED\xED\xFF \xE2\xE8\xE3\xEB\xFF\xE4\xF3: + /// test HashCodeTester HashCode\xC7\xE0\xEF\xE8\xF2\xF3 + /// \xC4\xE5 HashCode\xC7\xE0\xEF\xE8\xF2\xF3 - \xF6\xE5 \xF3\xED\xB3\xEA\xE0\xEB\xFC\xED\xE8\xE9 \xF5\xE5\xF8 \xEA\xEE\xE4 \xEA\xEE\xE6\xED\xEE\xE3\xEE \xF2\xE0\xEA\xEE\xE3\xEE \xE7\xE0\xEF\xE8\xF2\xF3. + /// \xCF\xEE\xF2\xB3\xEC \xF7\xE5\xEA\xE0\xBA \xEE\xE4\xED\xF3 (1) \xF1\xE5\xEA\xED\xE4\xF3 \xEA\xEE\xEB\xE8 \xE7\xE0\xEF\xEE\xE2\xED\xE8\xF2\xFC\xF1\xFF q \xF1\xEF\xE8\xF1\xEA\xEE\xEC \xEF\xF0\xE8\xF1\xEB\xE0\xED\xE8\xF5 \xEF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xE5\xED\xFC + /// \xDF\xEA\xF9\xEE \xF2\xE5\xF1\xF2\xE5\xF0 \xEF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xFF\xBA \xF9\xEE \xE2\xB3\xED \xE2\xB3\xEB\xFC\xED\xE8\xE9, \xF2\xEE\xE4\xB3 \xE9\xEE\xE3\xEE \xED\xEE\xEC\xE5\xF0 \xE7\xE0\xED\xEE\xF1\xE8\xF2\xFC\xF1\xFF \xE4\xEE \xF0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2\xF3. + /// </summary> + /// <returns>\xD1\xEF\xE8\xF1\xEE\xEA \xE2\xB3\xEB\xFC\xED\xE8\xF5 \xF2\xE5\xF1\xF2\xE5\xF0\xB3\xE2</returns> + private List<int> GetFreeTesters() { - if (onDataArrived != null) + q.Clear(); + string curHashCode = DateTime.Now.GetHashCode().ToString(); + for (int i = 0; i < server.CountClients; i++) { - onDataArrived(message); + string message = "test"; + message += " " + server.ClientsList[i].GetHashCode().ToString(); + message += " " + curHashCode; + server.SendData(message, i); + } + + DateTime start = DateTime.Now; + Dictionary<string, int> preResult = new Dictionary<string, int>(); + while (preResult.Count < server.CountClients) + { + if (((TimeSpan)(DateTime.Now - start)).TotalSeconds > 1.0) + { + break; + } + lock (q) + { + while (q.Count != 0) + { + string curStr = q.Dequeue(); + char[] chars = new char[1]; + chars[0] = ' '; + string[] mes = curStr.Split(chars); + if (mes[0] == "free" && curHashCode == mes[2]) + { + preResult.Add(mes[1], 0); + } + } + } + System.Threading.Thread.Sleep(50); + } + + List<int> result = new List<int>(); + for (int i = 0; i < server.CountClients; i++) + { + string hashCode = server.ClientsList[i].GetHashCode().ToString(); + if (preResult.ContainsKey(hashCode) == true) + result.Add(i); + } + return result; } + + /// <summary> + /// \xCF\xE5\xF0\xE5\xE2\xB3\xF0\xE0\xBA \xF7\xE8 \xF6\xE5 \xF1\xEB\xF3\xE6\xE1\xEE\xE2\xE5 \xEF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xE5\xED\xED\xFF. + /// \xDF\xEA\xF9\xEE \xF1\xEB\xF3\xE6\xE1\xEE\xE2\xE5, \xF2\xEE\xE4\xB3 \xE2\xEE\xED\xEE \xE7\xE0\xED\xEE\xF1\xE8\xF2\xFC\xF1\xFF \xE4\xEE \xF1\xEF\xE8\xF1\xEA\xF3 q + /// </summary> + /// <param name="message">\xCF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xE5\xED\xED\xFF</param> + /// <returns>\xDF\xEA\xF9\xEE \xF6\xE5 \xF1\xEB\xF3\xE6\xE1\xEE\xE2\xE5 \xEF\xEE\xE2\xB3\xE4\xEE\xEC\xEB\xE5\xED\xED\xFF, \xF2\xEE\xE4\xE2\xB3 \xEF\xEE\xE2\xE5\xF0\xF2\xE0\xBA\xF2\xFC\xF1\xFF true \xEF\xEE \xB3\xED\xE0\xEA\xF8\xEE\xEC\xF3 false</returns> + private bool SystemMessage(string message) + { + char[] chars = new char[1]; + chars[0] = ' '; + string[] mes = message.Split(chars); + if (mes[0] == "busy" || mes[0] == "free") + { + lock(q) + q.Enqueue(message); + return true; + } + return false; + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-07-25 10:00:45 UTC (rev 301) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-07-25 13:20:56 UTC (rev 302) @@ -21,33 +21,55 @@ base.Start(); base.onDataArrived += DataArrived; } - public static SocketServerGate GetInstance() { return instance; } + protected override void DataSender(string message, int clientIndex) + { + Submit submit = Submit.CreateFromXml(message); + if (dataContainer.Add(submit) == true) + { + OnLogMessage("send " + submit.id + " to " + clientIndex); + base.DataSender(message, clientIndex); + } + } public new void Send(string message) { SubmitList submitList = SubmitList.CreateFromXml(message); - for (int index = 0; index < submitList.Items.Length; index++) - { - if (dataContainer.Add(submitList.Items[index]) == true) - { - base.Send(submitList.Items[index].ToString()); - } - } - OnLogMessage("SocketServerGate::Send(message)"); + OnLogMessage("Get submits"); string ids = ""; for (int i = 0; i < submitList.Items.Length; i++) { ids += " " + submitList.Items[i].id.ToString(); } OnLogMessage("\t ID: " + ids); + + for (int index = 0; index < submitList.Items.Length; index++) + { + base.Send(submitList.Items[index].ToString()); + } } + protected override void DataArriver(string message) + { + Result result = Result.CreateFromXml(message); + dataContainer.Return(result); + OnLogMessage("result " + result.Submit.id); + OnLogMessage("\t " + result.res); + + base.DataArriver(message); + } + private void DataArrived(string message) + { + if (onDataArrived != null) + onDataArrived(message); + } + + public class LogMessageEventArgs : EventArgs { public string message; @@ -56,7 +78,6 @@ message = mes; } } - public event EventHandler<LogMessageEventArgs> LogMessage; private void OnLogMessage(string p) { @@ -64,18 +85,5 @@ if (temp != null) temp(this, new LogMessageEventArgs(p)); } - - - protected void DataArrived(string message) - { - Result result = Result.CreateFromXml(message); - dataContainer.Return(result); - if (onDataArrived != null) - onDataArrived(result.ToStringX()); - - - OnLogMessage("SocketServerGate::DataArrived(message)"); - OnLogMessage("\t " + result.res + " for " + result.Submit.id.ToString()); - } } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-07-25 10:00:45 UTC (rev 301) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-07-25 13:20:56 UTC (rev 302) @@ -58,22 +58,59 @@ private void DataArrived(string message) { UpdateTextLog("\r\n" + message); + if (SystemMessage(message) == true) + return; AddWork(message); } + bool SystemMessage(string message) + { + char[] chars = new char[1]; + chars[0] = ' '; + string[] mes = message.Split(chars); + if (mes[0] == "test") + { + string result = ""; + if (IsBusy() == true) + { + result = "busy"; + } + else + { + result = "free"; + } + string addStr = ""; + for (int i = 1; i < mes.Length; i++) + { + result += " " + mes[i]; + } + socket.Send(result); + return true; + } + return false; + } + static string source; static object working = 0; Thread thread = new Thread(new ThreadStart(Go)); - void AddWork(string message) + bool IsBusy() { lock (working) { if ((int)working == 1 || (thread.ThreadState == ThreadState.Running)) { - UpdateTextLog("\r\n--------- busy ---------"); - return; + return true; ; } } + return false; + } + void AddWork(string message) + { + if (IsBusy() == true) + { + UpdateTextLog("\r\n--------- busy ---------"); + return; + } source = message; onDataArrived += UpdateTextLog; thread = new Thread(new ThreadStart(Go)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-25 10:00:36
|
Revision: 301 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=301&view=rev Author: brus07 Date: 2008-07-25 10:00:45 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove SocketProtocol unit Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-25 10:00:45 UTC (rev 301) @@ -41,13 +41,7 @@ <Compile Include="Getter\FileGetter.cs" /> <Compile Include="Getter\IGetter.cs" /> <Compile Include="Getter\WebGetter.cs" /> - <Compile Include="ISocket.cs" /> <Compile Include="SocketClient.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" /> Deleted: ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,7 +0,0 @@ -namespace AcmContester.Library.Connector -{ - interface ISocket - { - void OnDataArrived(string message); - } -} Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,10 +1,9 @@ using System; using JadBenAutho.EasySocket; -using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { - public class SocketClient: ISocket + public class SocketClient { EasyClient client; @@ -56,16 +55,12 @@ return client.IsConnected; } - #region ISocket Members - - public void OnDataArrived(string message) + private void OnDataArrived(string message) { if (onDataArrived != null) { onDataArrived(message); } } - - #endregion } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,10 +1,9 @@ using System; using JadBenAutho.EasySocket; -using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { - public class SocketServer: ISocket + public class SocketServer { int port = 4120; EasyServer server; @@ -16,8 +15,6 @@ { server = new EasyServer(port, true); server.DataArrived += new DataArrived2Server_EventHandler(DataArrived); - - InitProtocol(); } public void Start() @@ -38,12 +35,12 @@ private void DataArrived(object Data, SocketStream DataSender) { - arrivedHead.PrevProcess(Data.ToString()); + OnDataArrived(Data.ToString()); } public void Send(string message) { - sendHead.NextProcess(message); + server.SendData(message, 0); } public int CountClients() @@ -51,47 +48,12 @@ return server.CountClients; } - Protocol sendHead; - Protocol sendNext; - Protocol arrivedHead; - Protocol arrivedNext; - - private void InitProtocol() + private void OnDataArrived(string message) { - 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) - { if (onDataArrived != null) { onDataArrived(message); } } - - #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-23 12:24:00
|
Revision: 300 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=300&view=rev Author: brus07 Date: 2008-07-23 12:24:09 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Optimize plugin interface. Remove "onWorkingData" event. Modified Paths: -------------- 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/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-07-22 20:24:30 UTC (rev 299) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-07-23 12:24:09 UTC (rev 300) @@ -26,7 +26,6 @@ private void button2_Click(object sender, EventArgs e) { kernel = new AcmContester.Mediator.Library.MediatorKernel(); - kernel.onWorkingData += WorkingData; System.Threading.ThreadPool.QueueUserWorkItem(RunLoadDll); } @@ -55,26 +54,19 @@ } } - private void WorkingData(string message) + delegate void UpdateTextLogCallback(string message, TextBox textBox); + private void UpdateTextLog(string message, TextBox textBox) { - string s = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": "; - s += message; - UpdateTextLog(s + "\r\n"); - } - - delegate void UpdateTextLogCallback(string message); - private void UpdateTextLog(string message) - { - if (this.textBox3.InvokeRequired) + if (textBox.InvokeRequired) { UpdateTextLogCallback d = new UpdateTextLogCallback(UpdateTextLog); this.Invoke(d, new object[] { message }); } else { - textBox3.Text += message; - textBox3.Select(textBox3.Text.Length, 0); - textBox3.ScrollToCaret(); + textBox.Text += message; + textBox.Select(textBox3.Text.Length, 0); + textBox.ScrollToCaret(); } } Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-07-22 20:24:30 UTC (rev 299) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-07-23 12:24:09 UTC (rev 300) @@ -45,7 +45,6 @@ foreach (BaseMediatorPlugin plugin in testerSideList) { plugin.onDataArrived += DataArrivedFromTesterList; - plugin.onWorkingData += WorkingData; if (plugin.Control != null) { this.OnAddControl(new ControlEventArgs(plugin.Control, plugin.GetType().Name)); @@ -55,7 +54,6 @@ foreach (BaseMediatorPlugin plugin in clientSideList) { plugin.onDataArrived += DataArrivedFromClientList; - plugin.onWorkingData += WorkingData; if (plugin.Control != null) { this.OnAddControl(new ControlEventArgs(plugin.Control, plugin.GetType().Name)); @@ -70,14 +68,6 @@ temp(this, e); } - public delegate void WorkingData_EventHandler(string message); - public event WorkingData_EventHandler onWorkingData; - private void WorkingData(string message) - { - if (onWorkingData != null) - onWorkingData(message); - } - private void DataArrivedFromClientList(string message) { if (testerSideList != null) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-07-22 20:24:30 UTC (rev 299) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-07-23 12:24:09 UTC (rev 300) @@ -25,8 +25,6 @@ socketServerGate.Stop(); return; } - WorkingData("SocketServerGatePlugin::Send(" + message + ")"); - WorkingData("SocketServerGatePlugin::Send CountClients = " + socketServerGate.CountClients().ToString()); socketServerGate.Send(message); } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-22 20:24:30 UTC (rev 299) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-23 12:24:09 UTC (rev 300) @@ -18,7 +18,6 @@ public override void Send(string message) { - WorkingData("WebGatePlugin::Send(" + message + ")"); webGate.Send(message); } } Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-07-22 20:24:30 UTC (rev 299) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-07-23 12:24:09 UTC (rev 300) @@ -8,9 +8,6 @@ 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); private UserControl control = null; @@ -29,15 +26,8 @@ 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); - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-22 20:24:22
|
Revision: 299 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=299&view=rev Author: brus07 Date: 2008-07-22 20:24:30 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Change method definition Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-07-16 21:54:04 UTC (rev 298) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-07-22 20:24:30 UTC (rev 299) @@ -27,7 +27,7 @@ { string fileName = directory.Substring(directory.LastIndexOf('\\')+1) + ".dll"; string fileFullName = directory + "\\" + fileName; - ScanAndLoad(fileFullName, plugins); + ScanAndLoad(fileFullName, ref plugins); } return plugins; } @@ -38,7 +38,7 @@ /// </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) + private static void ScanAndLoad(string filename, ref List<T> lst) { if (File.Exists(filename) == false) { 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. |
From: <Or...@us...> - 2008-07-11 11:35:06
|
Revision: 296 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=296&view=rev Author: Oracle_ Date: 2008-07-11 04:35:15 -0700 (Fri, 11 Jul 2008) Log Message: ----------- Fixed bug with counting points. Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-09 09:53:53 UTC (rev 295) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-11 11:35:15 UTC (rev 296) @@ -150,7 +150,7 @@ sec.lpSecurityDescriptor=NULL; sec.nLength=sizeof(sec); char* bufA; - wchar_t* bufW; + wchar_t* bufW,*bufW2; try { String^ srcpath=gcnew String(FTempPath+"source.txt"); @@ -180,14 +180,17 @@ DWORD start=GetTickCount(); bufW=StrToArrW("\""+FCompPath+"\" \""+srcpath+"\" \""+FTempPath); - if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) + bufW2=StrToArrW(Path::GetDirectoryName(FCompPath)); + if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,bufW2,&si,&pi)) { FreeArr(bufW); + FreeArr(bufW2); FCompResult->res=TCompRes::crIE; FCompResult->Details+="Can not run the compiler\n"; return; } FreeArr(bufW); + FreeArr(bufW2); if (WaitForSingleObject(pi.hProcess,FLim->CompilationTimeLimit)==WAIT_TIMEOUT) { TerminateProcess(pi.hProcess,0); @@ -242,10 +245,12 @@ if (n<TestCnt()) { RunTest(n); + lock(); Summary->res->points+=Results[n-1]->points; Summary->res->UsedMemory=max(Results[n-1]->UsedMemory,Summary->res->UsedMemory); Summary->res->UsedTime=max(Results[n-1]->UsedTime,Summary->res->UsedTime); Summary->res->UsedRealTime=max(Results[n-1]->UsedRealTime,Summary->res->UsedRealTime); + unlock(); if (Results[n-1]->res!=TRes::trAC) { Summary->res->res=Results[n-1]->res; @@ -479,7 +484,7 @@ Results[index-1]->Details+="Real time limit"; break; } - if (CheckTL((int)(acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart),Lim->TimeLimit*10000)) + if (CheckTL((int)(acc.TotalKernelTime.QuadPart+acc.TotalUserTime.QuadPart),Lim->TimeLimit*10000)) { TerminateJobObject(job,0); Results[index-1]->res=TRes::trTL; @@ -542,7 +547,7 @@ QueryInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem),NULL); QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); Results[index-1]->UsedMemory=mem.PeakJobMemoryUsed; - Results[index-1]->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); + Results[index-1]->UsedTime=(int)((acc.TotalKernelTime.QuadPart+acc.TotalUserTime.QuadPart)/10000); if (Results[index-1]->res!=TRes::trAC) return; if ((int)GetFileSize(si.hStdOutput,NULL)>Lim->OutputLimit) @@ -585,7 +590,7 @@ if (r==carAC) { if (File::Exists(pointpath)) - Results[index-1]->points.Parse(ReadFullFile(pointpath)); else + Results[index-1]->points=int::Parse(ReadFullFile(pointpath)); else Results[index-1]->points=1; return ; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-09 09:53:44
|
Revision: 295 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=295&view=rev Author: brus07 Date: 2008-07-09 02:53:53 -0700 (Wed, 09 Jul 2008) Log Message: ----------- Refactoring of Protocol classes. All data transferring in string type. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-09 09:43:28 UTC (rev 294) +++ ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-09 09:53:53 UTC (rev 295) @@ -2,6 +2,6 @@ { interface ISocket { - void OnDataArrived(object data); + void OnDataArrived(string message); } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-09 09:43:28 UTC (rev 294) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-09 09:53:53 UTC (rev 295) @@ -59,11 +59,11 @@ #region ISocket Members - public void OnDataArrived(object data) + public void OnDataArrived(string message) { if (onDataArrived != null) { - onDataArrived(data.ToString()); + onDataArrived(message); } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs 2008-07-09 09:53:53 UTC (rev 295) @@ -5,27 +5,20 @@ { class EasyProtocol: IProtocol { - int clientIndex = 0; #region IProtocol Members - public void DataArrived(object message, ISocket socket) + public void DataArrived(string message, ISocket socket) { socket.OnDataArrived(message); } - public void Send(object message, EasyServer server) + public void Send(string message, EasyServer server, int targerClientIndex) { - if (server.CountClients > 0) - { - if (clientIndex >= server.CountClients) - clientIndex = 0; - server.SendData(message, clientIndex); - clientIndex++; - } + server.SendData(message, targerClientIndex); } - public void Send(object message, EasyClient client) + public void Send(string message, EasyClient client) { if (client.IsConnected == true) client.SendData(message); Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs 2008-07-09 09:53:53 UTC (rev 295) @@ -4,8 +4,8 @@ { interface IProtocol { - void DataArrived(object message, ISocket socket); - void Send(object message, EasyServer server); - void Send(object message, EasyClient client); + void DataArrived(string message, ISocket socket); + void Send(string message, EasyServer server, int targerClientIndex); + void Send(string message, EasyClient client); } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-09 09:43:28 UTC (rev 294) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-09 09:53:53 UTC (rev 295) @@ -41,9 +41,16 @@ protocol.DataArrived(Data.ToString(), this); } + int clientIndex = 0; public void Send(string message) { - protocol.Send(message, server); + if (server.CountClients > 0) + { + if (clientIndex >= server.CountClients) + clientIndex = 0; + protocol.Send(message, server, clientIndex); + clientIndex++; + } } public int CountClients() @@ -53,11 +60,11 @@ #region ISocket Members - public void OnDataArrived(object data) + public void OnDataArrived(string message) { if (onDataArrived != null) { - onDataArrived(data.ToString()); + onDataArrived(message); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-09 09:43:35
|
Revision: 294 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=294&view=rev Author: brus07 Date: 2008-07-09 02:43:28 -0700 (Wed, 09 Jul 2008) Log Message: ----------- Move protocol classes to special directory. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-08 21:14:53 UTC (rev 293) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-09 09:43:28 UTC (rev 294) @@ -38,13 +38,13 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="EasyProtocol.cs" /> <Compile Include="Getter\FileGetter.cs" /> <Compile Include="Getter\IGetter.cs" /> <Compile Include="Getter\WebGetter.cs" /> - <Compile Include="IProtocol.cs" /> <Compile Include="ISocket.cs" /> <Compile Include="SocketClient.cs" /> + <Compile Include="SocketProtocol\EasyProtocol.cs" /> + <Compile Include="SocketProtocol\IProtocol.cs" /> <Compile Include="SocketServer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebConnector.cs" /> Deleted: ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs 2008-07-08 21:14:53 UTC (rev 293) +++ ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -1,36 +0,0 @@ -using System; -using JadBenAutho.EasySocket; - -namespace AcmContester.Library.Connector -{ - class EasyProtocol: IProtocol - { - int clientIndex = 0; - - #region IProtocol Members - - public void DataArrived(object message, ISocket socket) - { - socket.OnDataArrived(message); - } - - public void Send(object message, EasyServer server) - { - if (server.CountClients > 0) - { - if (clientIndex >= server.CountClients) - clientIndex = 0; - server.SendData(message, clientIndex); - clientIndex++; - } - } - - public void Send(object message, EasyClient client) - { - if (client.IsConnected == true) - client.SendData(message); - } - - #endregion - } -} Deleted: ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs 2008-07-08 21:14:53 UTC (rev 293) +++ ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -1,11 +0,0 @@ -using JadBenAutho.EasySocket; - -namespace AcmContester.Library.Connector -{ - interface IProtocol - { - void DataArrived(object message, ISocket socket); - void Send(object message, EasyServer server); - void Send(object message, EasyClient client); - } -} Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-08 21:14:53 UTC (rev 293) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -1,5 +1,6 @@ using System; using JadBenAutho.EasySocket; +using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { Property changes on: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol ___________________________________________________________________ Name: tsvn:logminsize + 5 Copied: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs (from rev 293, ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -0,0 +1,36 @@ +using System; +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + class EasyProtocol: IProtocol + { + int clientIndex = 0; + + #region IProtocol Members + + public void DataArrived(object message, ISocket socket) + { + socket.OnDataArrived(message); + } + + public void Send(object message, EasyServer server) + { + if (server.CountClients > 0) + { + if (clientIndex >= server.CountClients) + clientIndex = 0; + server.SendData(message, clientIndex); + clientIndex++; + } + } + + public void Send(object message, EasyClient client) + { + if (client.IsConnected == true) + client.SendData(message); + } + + #endregion + } +} Property changes on: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/EasyProtocol.cs ___________________________________________________________________ Name: svn:mergeinfo + Copied: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs (from rev 293, ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -0,0 +1,11 @@ +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector.SocketProtocol +{ + interface IProtocol + { + void DataArrived(object message, ISocket socket); + void Send(object message, EasyServer server); + void Send(object message, EasyClient client); + } +} Property changes on: ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/IProtocol.cs ___________________________________________________________________ Name: svn:mergeinfo + Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-08 21:14:53 UTC (rev 293) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-09 09:43:28 UTC (rev 294) @@ -1,5 +1,6 @@ using System; using JadBenAutho.EasySocket; +using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-08 21:14:49
|
Revision: 293 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=293&view=rev Author: brus07 Date: 2008-07-08 14:14:53 -0700 (Tue, 08 Jul 2008) Log Message: ----------- Add feature for using real protocol in Socket module. (pattern strategy) Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-08 18:41:35 UTC (rev 292) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-08 21:14:53 UTC (rev 293) @@ -38,9 +38,12 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="EasyProtocol.cs" /> <Compile Include="Getter\FileGetter.cs" /> <Compile Include="Getter\IGetter.cs" /> <Compile Include="Getter\WebGetter.cs" /> + <Compile Include="IProtocol.cs" /> + <Compile Include="ISocket.cs" /> <Compile Include="SocketClient.cs" /> <Compile Include="SocketServer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> Added: ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/EasyProtocol.cs 2008-07-08 21:14:53 UTC (rev 293) @@ -0,0 +1,36 @@ +using System; +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector +{ + class EasyProtocol: IProtocol + { + int clientIndex = 0; + + #region IProtocol Members + + public void DataArrived(object message, ISocket socket) + { + socket.OnDataArrived(message); + } + + public void Send(object message, EasyServer server) + { + if (server.CountClients > 0) + { + if (clientIndex >= server.CountClients) + clientIndex = 0; + server.SendData(message, clientIndex); + clientIndex++; + } + } + + public void Send(object message, EasyClient client) + { + if (client.IsConnected == true) + client.SendData(message); + } + + #endregion + } +} Added: ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/IProtocol.cs 2008-07-08 21:14:53 UTC (rev 293) @@ -0,0 +1,11 @@ +using JadBenAutho.EasySocket; + +namespace AcmContester.Library.Connector +{ + interface IProtocol + { + void DataArrived(object message, ISocket socket); + void Send(object message, EasyServer server); + void Send(object message, EasyClient client); + } +} Added: ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-08 21:14:53 UTC (rev 293) @@ -0,0 +1,7 @@ +namespace AcmContester.Library.Connector +{ + interface ISocket + { + void OnDataArrived(object data); + } +} Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-08 18:41:35 UTC (rev 292) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-08 21:14:53 UTC (rev 293) @@ -3,9 +3,10 @@ namespace AcmContester.Library.Connector { - public class SocketClient + public class SocketClient: ISocket { EasyClient client; + IProtocol protocol = new EasyProtocol(); public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; @@ -41,14 +42,12 @@ } public void Send(string message) { - if (client.IsConnected == true) - client.SendData(message); + protocol.Send(message, client); } - private void DataArrived(object message) + private void DataArrived(object Data) { - if (onDataArrived != null) - onDataArrived(message.ToString()); + protocol.DataArrived(Data.ToString(), this); } public bool IsConnected() { @@ -56,5 +55,17 @@ return false; return client.IsConnected; } + + #region ISocket Members + + public void OnDataArrived(object data) + { + if (onDataArrived != null) + { + onDataArrived(data.ToString()); + } + } + + #endregion } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-08 18:41:35 UTC (rev 292) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-08 21:14:53 UTC (rev 293) @@ -3,17 +3,16 @@ namespace AcmContester.Library.Connector { - public class SocketServer + public class SocketServer: ISocket { int port = 4120; - EasyServer server; + IProtocol protocol = new EasyProtocol(); + public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; - int clientIndex = 0; - public SocketServer() { server = new EasyServer(port, true); @@ -38,26 +37,29 @@ private void DataArrived(object Data, SocketStream DataSender) { - if (onDataArrived != null) - { - onDataArrived(Data.ToString()); - } + protocol.DataArrived(Data.ToString(), this); } public void Send(string message) { - if (server.CountClients > 0) - { - if (clientIndex >= server.CountClients) - clientIndex = 0; - server.SendData(message, clientIndex); - clientIndex++; - } + protocol.Send(message, server); } public int CountClients() { return server.CountClients; } + + #region ISocket Members + + public void OnDataArrived(object data) + { + if (onDataArrived != null) + { + onDataArrived(data.ToString()); + } + } + + #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-07-08 18:41:28
|
Revision: 292 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=292&view=rev Author: Oracle_ Date: 2008-07-08 11:41:35 -0700 (Tue, 08 Jul 2008) Log Message: ----------- Source became more elegant. Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp ACMServer/trunk/sharp tester/tester/Program.cs Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-06 20:49:54 UTC (rev 291) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-08 18:41:35 UTC (rev 292) @@ -427,7 +427,7 @@ SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); lock(); - if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|NORMAL_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details)) + if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|ABOVE_NORMAL_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details)) { FreeArr(bufW); Results[index-1]->points=0; @@ -447,8 +447,8 @@ FreeArr(bufW); unlock(); job=CreateJobObject(NULL,NULL); - mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY; - mem.ProcessMemoryLimit=Lim->MemoryLimit; + mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_JOB_MEMORY; + mem.JobMemoryLimit=Lim->MemoryLimit; SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem)); port.CompletionKey=(void*)index; port.CompletionPort=CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); @@ -468,7 +468,7 @@ { TerminateJobObject(job,0); Results[index-1]->res=TRes::trOL; - Results[index-1]->Details+="Size of output file excided OutputLimit"; + Results[index-1]->Details+="OutputLimit"; break; } QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); @@ -509,7 +509,7 @@ } needbreak=true; break; - case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: + case JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: Results[index-1]->res=TRes::trML; Results[index-1]->Details+="Memory Limit"; needbreak=true; @@ -537,19 +537,40 @@ } Sleep(1); } - - CloseHandle(si.hStdOutput);si.hStdOutput=NULL; - CloseHandle(si.hStdInput);si.hStdInput=NULL; - Sleep(CONST_SLEEP); //waiting for file - + Results[index-1]->UsedRealTime=GetTickCount()-start; QueryInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem),NULL); QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); - Results[index-1]->UsedMemory=mem.PeakProcessMemoryUsed; + Results[index-1]->UsedMemory=mem.PeakJobMemoryUsed; Results[index-1]->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); - Results[index-1]->UsedRealTime=GetTickCount()-start; + if (Results[index-1]->res!=TRes::trAC) return; + if ((int)GetFileSize(si.hStdOutput,NULL)>Lim->OutputLimit) + { + Results[index-1]->res=TRes::trOL; + Results[index-1]->Details+="OutputLimit"; + return; + } + if (CheckTL(Results[index-1]->UsedTime,Lim->TimeLimit)) + { + Results[index-1]->res=TRes::trTL; + Results[index-1]->Details+="Time Limit"; + return; + } + + if (CheckRTL(Results[index-1]->UsedRealTime,Lim->RealTimeLimit)) + { + Results[index-1]->res=TRes::trRTL; + Results[index-1]->Details+="Real time limit"; + return; + } + + CloseHandle(si.hStdOutput);si.hStdOutput=NULL; + CloseHandle(si.hStdInput);si.hStdInput=NULL; + + Sleep(CONST_SLEEP); //waiting for file + if (!File::Exists(oupath)) { Results[index-1]->res=TRes::trWA; @@ -557,7 +578,7 @@ return; } - //Sleep(CONST_SLEEP); //waiting for closing all handles to this file + Sleep(CONST_SLEEP); //waiting for closing all handles to this file TCheckAnsRes r=CheckAnswer(index,ReadFullFile(oupath),Results[index-1]->Details); Modified: ACMServer/trunk/sharp tester/tester/Program.cs =================================================================== --- ACMServer/trunk/sharp tester/tester/Program.cs 2008-07-06 20:49:54 UTC (rev 291) +++ ACMServer/trunk/sharp tester/tester/Program.cs 2008-07-08 18:41:35 UTC (rev 292) @@ -70,7 +70,7 @@ Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); - //Console.ReadKey(); + Console.ReadKey(); index++; c.Dispose(); } @@ -84,6 +84,7 @@ /*Console.WriteLine("Used Time: {0} ms", (System.DateTime.Now.Ticks - start.Ticks)/10000); Console.WriteLine("MAX: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte", ct.max, t.max, rt.max, mem.max); Console.WriteLine("Diff: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte",ct.diff(),t.diff(),rt.diff(),mem.diff());*/ + Console.WriteLine("------------FINISH----------------"); Console.ReadKey(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-06 20:49:46
|
Revision: 291 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=291&view=rev Author: brus07 Date: 2008-07-06 13:49:54 -0700 (Sun, 06 Jul 2008) Log Message: ----------- Tester don't wait testing for receive new data via socket. Tester don't calculate new data when working on old data (in future response to Mediator about state). Modified Paths: -------------- ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-07-06 16:42:12 UTC (rev 290) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-07-06 20:49:54 UTC (rev 291) @@ -8,12 +8,13 @@ using AcmContester.Library.Connector; using System.IO; using AcmContester.Library.LibraryExtention; +using System.Threading; namespace Tester { public partial class Form1 : Form { - SocketClient socket; + static SocketClient socket; public Form1() { @@ -56,10 +57,44 @@ } private void DataArrived(string message) { - string result = ""; - UpdateTextLog("\r\n" + message); + AddWork(message); + } + static string source; + static object working = 0; + Thread thread = new Thread(new ThreadStart(Go)); + void AddWork(string message) + { + lock (working) + { + if ((int)working == 1 || (thread.ThreadState == ThreadState.Running)) + { + UpdateTextLog("\r\n--------- busy ---------"); + return; + } + } + source = message; + onDataArrived += UpdateTextLog; + thread = new Thread(new ThreadStart(Go)); + thread.Start(); + } + + static void Go() + { + lock (working) + { + working = 1; + } + Testing(source); + lock (working) + { + working = 0; + } + } + static void Testing(string message) + { + string result; try { result = Checker.Checker.GetResult(message); @@ -72,11 +107,19 @@ return; } - UpdateTextLog("\r\n" + result); - socket.Send(result); + if (onDataArrived != null) + { + onDataArrived("\r\n" + result); + onDataArrived("\r\n--------- free ---------"); + } + //UpdateTextLog("\r\n" + result); + lock(socket) + socket.Send(result); } + public delegate void DataArrivedDelegate(string s); + public static event DataArrivedDelegate onDataArrived; delegate void UpdateTextLogCallback(string message); private void UpdateTextLog(string message) @@ -98,6 +141,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e) { + thread.Abort(); Disconnect(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-07-06 16:42:05
|
Revision: 290 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=290&view=rev Author: brus07 Date: 2008-07-06 09:42:12 -0700 (Sun, 06 Jul 2008) Log Message: ----------- Delete old method Modified Paths: -------------- ACMServer/trunk/ACMServer/Checker/Class1.cs Modified: ACMServer/trunk/ACMServer/Checker/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-29 18:04:13 UTC (rev 289) +++ ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-07-06 16:42:12 UTC (rev 290) @@ -82,25 +82,5 @@ result.usedTime = c.Summary.res.UsedTime; return result.ToStringX(); } - public static int GetResult1(string code) - { - code = (code.Split(' '))[1]; - int res = 0; - for (int i = 0; i < code.Length; i++) - { - if (Char.IsWhiteSpace(code[i]) == false) - res++; - } - for (int j = 0; j < 20000000; j++) - { - string s = ""; - for (int i = 0; i < code.Length; i++) - { - s += code[i]; - s += s; - } - } - return res; - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-29 18:05:21
|
Revision: 289 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=289&view=rev Author: Oracle_ Date: 2008-06-29 11:04:13 -0700 (Sun, 29 Jun 2008) Log Message: ----------- Deleted old source test. Removed Paths: ------------- ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt Deleted: ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt 2008-06-29 17:41:09 UTC (rev 288) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt 2008-06-29 18:04:13 UTC (rev 289) @@ -1,18 +0,0 @@ -uses Windows; var f:Thandle; begin f:=CreateFile('Hello.txt',GENERIC_WRITE,0,nil,CREATE_ALWAYS,0,0); if (f=INVALID_HANDLE_VALUE) then while true do; CloseHandle(f); end. -var a,b:Extended; -i:Integer; -x:array of Integer; -begin - read(a,b); - for i:=1 to 5700000 do - a:=sqrt(a)*sqrt(a)+((sqrt(a)*sqrt(a))/sqrt(a))/sqrt(a)-1; - for i:=1 to 180000000 do ; - for i:=1 to 20 do - begin - SetLength(x,5000000); - x[1237]:=2178; - x[5237]:=2174; - SetLength(x,0); - end; - write(a+b:0:0); -end. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-29 17:41:01
|
Revision: 288 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=288&view=rev Author: Oracle_ Date: 2008-06-29 10:41:09 -0700 (Sun, 29 Jun 2008) Log Message: ----------- Added some test sources. Added Paths: ----------- ACMServer/trunk/sharp tester/tester/SAMPLE/source1.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source10.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source11.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source12.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source13.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source2.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source3.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source4.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source5.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source6.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source7.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source8.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source9.txt Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source1.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source1.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source1.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,17 @@ +var a,b:Extended; +i:Integer; +x:array of Integer; +begin + read(a,b); + for i:=1 to 1700000 do + a:=sqrt(a)*sqrt(a)+((sqrt(a)*sqrt(a))/sqrt(a))/sqrt(a)-1; + for i:=1 to 100000000 do ; + for i:=1 to 10 do + begin + SetLength(x,5000000); + x[1237]:=2178; + x[5237]:=2174; + SetLength(x,0); + end; + write(a+b:0:0); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source10.txt =================================================================== Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source11.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source11.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source11.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,4 @@ +var a:array [1..5000000] of Integer; +begin +fillchar(a,sizeof(a),0); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source12.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source12.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source12.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,5 @@ +var i:Integer; +begin +for i:=1 to 1025 do + write(' '); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source13.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source13.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source13.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,5 @@ +var i:Integer; +begin + for i:=1 to 1024 do + write(' '); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source2.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source2.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source2.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,7 @@ +var a,b:Extended; +i:Integer; +x:array of Integer; +begin + read(a,b); + write(a+b:0:0); +end. Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source3.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source3.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source3.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1 @@ +uses windows; begin while true do; end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source4.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source4.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source4.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,4 @@ +uses windows; +begin +sleep(10000); +end. Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source5.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source5.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source5.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,5 @@ +var a,b:integer; +begin + read(a,b); + write(a+b,' '); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source6.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source6.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source6.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,5 @@ +begin +assignfile(output,'out.txt'); +rewrite(output); +closefile(output); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source7.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source7.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source7.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,4 @@ +begin +assignfile(input,'source.txt');reset(input); +closefile(input); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source8.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source8.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source8.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1,4 @@ +var a:array [1..2147000000] of char; +begin + fillchar(a,0,sizeof(a)); +end. \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/source9.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source9.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source9.txt 2008-06-29 17:41:09 UTC (rev 288) @@ -0,0 +1 @@ +hello! \ 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: <Or...@us...> - 2008-06-29 17:37:49
|
Revision: 287 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=287&view=rev Author: Oracle_ Date: 2008-06-29 10:37:55 -0700 (Sun, 29 Jun 2008) Log Message: ----------- Fixed bug with big outputs, updated source. Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp ACMServer/trunk/sharp tester/SourceTest/SourceTest.h ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/trunk/sharp tester/TestLibrary/dllmain.cpp ACMServer/trunk/sharp tester/tester/Program.cs ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-29 17:37:55 UTC (rev 287) @@ -2,7 +2,6 @@ #include "stdafx.h" //#define _WIN32_WINNT 0x0500 //need for easy compiling on different machine -#include <stdio.h> #include "SourceTest.h" #include <LM.h> #include <Aclapi.h> @@ -36,74 +35,58 @@ System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); } -String^ ToStr(int x) //fast convert integer to Managed String +String^ ReadFullFile(String^ filename) { - char intg[15]; - _itoa_s(x,intg,10); - return %String(intg); -} - -bool FileExists(String^ path) //checks whether file exists or not -{ - char* buf=StrToArr(path); - OFSTRUCT of; - ZeroMemory(&of,sizeof(of)); - of.cBytes=sizeof(of); - bool res=(OpenFile(buf,&of,OF_EXIST)!=HFILE_ERROR); - FreeArr(buf); + StreamReader^ r; + int cycle=0; + while (cycle<1000) + { + ++cycle; + try + { + r=File::OpenText(filename); + } catch (...) + { + Sleep(1); + continue; + } + break; + } + if (r->Equals(StreamReader::Null)) + return ""; + String^ res=r->ReadToEnd(); + delete (IDisposable^)r; return res; } -String^ ReadFullFile(String^ filename) -{ - HANDLE h; - wchar_t* bufW=StrToArrW(filename); - int cycle=0; - do - { - h=CreateFile(bufW,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL); - Sleep(1); - ++cycle; - } while (h==INVALID_HANDLE_VALUE&&cycle<100); - if (h==INVALID_HANDLE_VALUE) - return ""; - FreeArr(bufW); - DWORD size=GetFileSize(h,NULL); - char* res=new char[size+20];ZeroMemory(res,(size+2)*sizeof(char)); - char* buf=new char[size+20]; - DWORD curlen=0; - cycle=0; - do - { - ZeroMemory(buf, (size+20)*sizeof(char)); - DWORD rlen=0; - ReadFile(h,buf,size,&rlen,NULL); - curlen+=rlen; - strcat_s(res,size+10,buf); - Sleep(1); - ++cycle; - } while (curlen<size&&cycle<100); - CloseHandle(h); - String^ r=gcnew String(res); - delete[] res; - delete[] buf; - if (curlen<size) - return ""; - return r; -} - TSource::TSource() { -FSrc=gcnew String(""); -FExePath=gcnew String(""); -FProblemPath=gcnew String(""); -FState=ssNone; -FCompPath=gcnew String(""); +FSrc=""; +FExePath=""; +FProblemPath=""; +FState=TSourceState::ssNone; +FCompPath=""; FRunAll=true; -lib=LoadLibraryA("TestLibrary.dll"); +FLim=gcnew TLimits(); +FRes=gcnew ArrayList(); +FLang=TLang::lPascal; +FSummary=gcnew TSummary(); +FThreads=gcnew ArrayList(); +FCompResult=gcnew TCompResult(); + +if ((lib=LoadLibrary(L"TestLibrary.dll"))!=NULL) +{ + DLLFreeChar=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + DLLCheckCL=(TCheckSrc)GetProcAddress(lib,"CheckCL"); + DLLCheckDF=(TCheckSrc)GetProcAddress(lib,"CheckDF"); + DLLCheckAnswer=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); + DLLCheckTL=(TCheckLim)GetProcAddress(lib,"CheckTL"); + DLLCheckRTL=(TCheckLim)GetProcAddress(lib,"CheckRTL"); +} FSecurity=NULL; InitSecure(false); init(); //initializing of critical section +SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS); } void TSource::InitSecure(bool SetPrivAnyway) @@ -118,47 +101,44 @@ if (lib!=NULL) FreeLibrary(lib); delete FSecurity; -FRes.Clear(); -FThreads.Clear(); +FRes->Clear(); +FThreads->Clear(); final(); +SetPriorityClass(GetCurrentProcess(),NORMAL_PRIORITY_CLASS); } void TSource::CheckCL() //checking size of source { if (lib==NULL) //no library was found { - if (FSrc->Length>FLim.CodeLimit) - FCompResult.res=crCL; - FCompResult.Details+="Used std checker for Code Limit\n"; + if (FSrc->Length>FLim->CodeLimit) + FCompResult->res=TCompRes::crCL; + FCompResult->Details+="Used std checker for Code Limit\n"; } else { - TCheckSrc prc=(TCheckSrc)GetProcAddress(lib,"CheckCL"); char* buf,*bufA; - if (prc(bufA=StrToArr(FSrc),FLim.CodeLimit,buf)) FCompResult.res=crCL; + if (DLLCheckCL(bufA=StrToArr(FSrc),FLim->CodeLimit,buf)) FCompResult->res=TCompRes::crCL; FreeArr(bufA); - FCompResult.Details+=gcnew String(buf); - TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); - prc2(buf); + FCompResult->Details+=gcnew String(buf); + DLLFreeChar(buf); } - FState=ssCheckedCL; + FState=TSourceState::ssCheckedCL; } void TSource::CheckDF() //checking for DF in source { if (lib==NULL) //no library was found { - FCompResult.Details+="No checker for DF\n"; + FCompResult->Details+="No checker for DF\n"; } else { - TCheckSrc prc=(TCheckSrc)GetProcAddress(lib,"CheckDF"); char* buf,*bufA; - if (prc(bufA=StrToArr(FSrc),(int)FLang,buf)) FCompResult.res=crDF; + if (DLLCheckDF(bufA=StrToArr(FSrc),(int)FLang,buf)) FCompResult->res=TCompRes::crDF; FreeArr(bufA); - FCompResult.Details+=gcnew String(buf); - TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); - prc2(buf); + FCompResult->Details+=gcnew String(buf); + DLLFreeChar(buf); } - FState=ssCheckedDF; + FState=TSourceState::ssCheckedDF; } void TSource::Compile() //compiles the source @@ -177,7 +157,7 @@ String^ outpath=gcnew String(FTempPath+"compoutput.txt"); FExePath=FTempPath+"source.exe"; - if (FileExists(FExePath)) //delete previsious source + if (File::Exists(FExePath)) //delete previsious source { DeleteFile((LPCTSTR)(bufW=StrToArrW(FExePath))); FreeArr(bufW); @@ -203,35 +183,35 @@ if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) { FreeArr(bufW); - FCompResult.res=crIE; - FCompResult.Details+="Can not run the compiler\n"; + FCompResult->res=TCompRes::crIE; + FCompResult->Details+="Can not run the compiler\n"; return; } FreeArr(bufW); - if (WaitForSingleObject(pi.hProcess,FLim.CompilationTimeLimit)==WAIT_TIMEOUT) + if (WaitForSingleObject(pi.hProcess,FLim->CompilationTimeLimit)==WAIT_TIMEOUT) { TerminateProcess(pi.hProcess,0); - FCompResult.res=crCTL; - FCompResult.UsedTime=FLim.CompilationTimeLimit; - FCompResult.Details+="Time out during compilation\n"; + FCompResult->res=TCompRes::crCTL; + FCompResult->UsedTime=FLim->CompilationTimeLimit; + FCompResult->Details+="Time out during compilation\n"; return; } - FCompResult.UsedTime=GetTickCount()-start; + FCompResult->UsedTime=GetTickCount()-start; Sleep(CONST_SLEEP); //waiting for creating the file CloseHandle(si.hStdOutput); si.hStdOutput=NULL; - if (!FileExists(FExePath)) //compilation error + if (!File::Exists(FExePath)) //compilation error { - FCompResult.res=crCE; - FCompResult.Details+="EXE file not found\n"+ReadFullFile(outpath); + FCompResult->res=TCompRes::crCE; + FCompResult->Details+="EXE file not found\n"+ReadFullFile(outpath); return; } - FCompResult.Details+=ReadFullFile(outpath); + FCompResult->Details+=ReadFullFile(outpath); - }__finally + }finally { if (pi.hProcess!=NULL) CloseHandle(pi.hProcess); @@ -239,14 +219,14 @@ CloseHandle(pi.hThread); if (si.hStdOutput!=NULL) CloseHandle(si.hStdOutput); - FState=ssCompiled; + FState=TSourceState::ssCompiled; } } void TSource::AddThread() { Threading::Thread^ t=gcnew Threading::Thread(gcnew System::Threading::ThreadStart(this,&TSource::ThreadProc)); - FThreads.Add(t); + FThreads->Add(t); t->Start(); } @@ -266,7 +246,7 @@ Summary->res->UsedMemory=max(Results[n-1]->UsedMemory,Summary->res->UsedMemory); Summary->res->UsedTime=max(Results[n-1]->UsedTime,Summary->res->UsedTime); Summary->res->UsedRealTime=max(Results[n-1]->UsedRealTime,Summary->res->UsedRealTime); - if (Results[n-1]->res!=trAC) + if (Results[n-1]->res!=TRes::trAC) { Summary->res->res=Results[n-1]->res; if (!RunAll) { NeedTest=false; break; } @@ -281,40 +261,40 @@ void TSource::RunTests() //runs all tests of problem { - FState=ssIsRunning; + FState=TSourceState::ssIsRunning; CurrentTest=0; NeedTest=true; FTestCnt=1; - FRes.Clear(); - while (FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\in.txt")||FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\out.txt")||FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\points.txt")) + FRes->Clear(); + while (File::Exists(FProblemPath+"test"+FTestCnt.ToString()+"\\in.txt")||File::Exists(FProblemPath+"test"+FTestCnt.ToString()+"\\out.txt")||File::Exists(FProblemPath+"test"+FTestCnt.ToString()+"\\points.txt")) { - FRes.Add(%TResult()); + FRes->Add(%TResult()); FTestCnt++; } - FThreads.Clear(); - for (int i=0;i<min(FLim.MaxThreads-1,FTestCnt-1);i++) + FThreads->Clear(); + for (int i=0;i<min(FLim->MaxThreads,FTestCnt-1);i++) AddThread(); - for (int i=0;i<FThreads.Count;i++) + for (int i=0;i<FThreads->Count;i++) ((Threading::Thread^)FThreads[i])->Join(INFINITE); - FState=ssFinish; + FState=TSourceState::ssFinish; } -void TSource::LoadTest(int index,TTest% test) //loads test from file +void TSource::LoadTest(int index,TTest^ test) //loads test from file { try { lock(); - if (FileExists(FProblemPath+"test"+ToStr(index)+"\\in.txt")) - test.input=ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\in.txt"); else - test.input=""; - if (FileExists(FProblemPath+"test"+ToStr(index)+"\\out.txt")) - test.output=ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\out.txt"); else - test.output=""; - if (FileExists(FProblemPath+"test"+ToStr(index)+"\\points.txt")) - test.points.Parse(ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\points.txt")); else - test.points=1; -}__finally + if (File::Exists(FProblemPath+"test"+index.ToString()+"\\in.txt")) + test->input=ReadFullFile(FProblemPath+"test"+index.ToString()+"\\in.txt"); else + test->input=""; + if (File::Exists(FProblemPath+"test"+index.ToString()+"\\out.txt")) + test->output=ReadFullFile(FProblemPath+"test"+index.ToString()+"\\out.txt"); else + test->output=""; + if (File::Exists(FProblemPath+"test"+index.ToString()+"\\points.txt")) + test->points=int::Parse(ReadFullFile(FProblemPath+"test"+index.ToString()+"\\points.txt")); else + test->points=1; +}finally { unlock(); } @@ -324,25 +304,23 @@ { try { - TTest t; + TTest^ t=gcnew TTest(); LoadTest(index,t); lock(); if (lib==NULL) //lib was not found { - if (output!=t.output) + if (output!=t->output) return carWA; return carAC; } else { char* buf1,*buf2,*buf3,*buf4=NULL; - TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); - TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output),buf4); + TCheckAnsRes res=(TCheckAnsRes)DLLCheckAnswer(buf1=StrToArr(t->input),buf2=StrToArr(output),buf3=StrToArr(t->output),buf4); Details+=gcnew String(buf4); - TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); - FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);prc2(buf4); + FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);DLLFreeChar(buf4); return res; } -} __finally +} finally { unlock(); } @@ -355,9 +333,8 @@ lock(); if (lib==NULL) return usedtime>timelimit; - TCheckLim prc=(TCheckLim)GetProcAddress(lib,"CheckTL"); - return prc(usedtime,timelimit); -}__finally + return DLLCheckTL(usedtime,timelimit); +}finally { unlock(); } @@ -369,9 +346,8 @@ lock(); if (lib==NULL) return usedrealtime>realtimelimit; - TCheckLim prc=(TCheckLim)GetProcAddress(lib,"CheckRTL"); - return prc(usedrealtime,realtimelimit); -}__finally + return DLLCheckRTL(usedrealtime,realtimelimit); +}finally { unlock(); } @@ -382,18 +358,18 @@ try { CheckCL(); - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) CheckDF(); else return ; - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) Compile(); else return ; - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) RunTests(); else return ; -} __finally +} finally { - (*FSummary.compres)=FCompResult; + FSummary->compres=FCompResult; } } @@ -431,16 +407,16 @@ wchar_t* bufW; try { - Results[index-1]->res=trAC; + Results[index-1]->res=TRes::trAC; Results[index-1]->points=0; Results[index-1]->Details=""; Results[index-1]->UsedMemory=-1; Results[index-1]->UsedRealTime=-1; Results[index-1]->UsedTime=-1; - String^ inpath=ProblemPath+"test"+ToStr(index)+"\\in.txt"; - String^ oupath=TempPath+"out"+ToStr(index)+".txt"; - String^ erpath=TempPath+"err"+ToStr(index)+".txt"; - String^ pointpath=ProblemPath+"test"+ToStr(index)+"\\points.txt"; + String^ inpath=ProblemPath+"test"+index.ToString()+"\\in.txt"; + String^ oupath=TempPath+"out"+index.ToString()+".txt"; + String^ erpath=TempPath+"err"+index.ToString()+".txt"; + String^ pointpath=ProblemPath+"test"+index.ToString()+"\\points.txt"; si.cb=sizeof(si); si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; @@ -451,18 +427,18 @@ SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); lock(); - if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|HIGH_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details)) + if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|NORMAL_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details)) { FreeArr(bufW); Results[index-1]->points=0; int err=GetLastError(); if ((err==193)||(err==1455)) { - Results[index-1]->res=trRE; + Results[index-1]->res=TRes::trRE; Results[index-1]->Details+="Too large array"; } else { - Results[index-1]->res=trIE; + Results[index-1]->res=TRes::trIE; Results[index-1]->Details+="Can not start process"; } unlock(); @@ -483,8 +459,6 @@ AssignProcessToJobObject(job,pi.hProcess); - SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL); - ResumeThread(pi.hThread); DWORD start=GetTickCount(); @@ -493,7 +467,7 @@ if ((int)GetFileSize(si.hStdOutput,NULL)>Lim->OutputLimit) { TerminateJobObject(job,0); - Results[index-1]->res=trOL; + Results[index-1]->res=TRes::trOL; Results[index-1]->Details+="Size of output file excided OutputLimit"; break; } @@ -501,14 +475,14 @@ if (CheckRTL((int)(GetTickCount()-start),Lim->RealTimeLimit)) { TerminateJobObject(job,0); - Results[index-1]->res=trRTL; + Results[index-1]->res=TRes::trRTL; Results[index-1]->Details+="Real time limit"; break; } if (CheckTL((int)(acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart),Lim->TimeLimit*10000)) { TerminateJobObject(job,0); - Results[index-1]->res=trTL; + Results[index-1]->res=TRes::trTL; Results[index-1]->Details+="Time Limit"; break; } @@ -525,18 +499,18 @@ GetExitCodeProcess(pi.hProcess,&code); if (code==5) { - Results[index-1]->res=trDF; + Results[index-1]->res=TRes::trDF; Results[index-1]->Details+="Access denied."; } else if (code!=0) { - Results[index-1]->res=trRE; - Results[index-1]->Details+="Runtime error #"+ToStr((int)code); + Results[index-1]->res=TRes::trRE; + Results[index-1]->Details+="Runtime error #"+code.ToString(); } needbreak=true; break; case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: - Results[index-1]->res=trML; + Results[index-1]->res=TRes::trML; Results[index-1]->Details+="Memory Limit"; needbreak=true; break; @@ -544,13 +518,13 @@ GetExitCodeProcess(pi.hProcess,&code); if (code==5) { - Results[index-1]->res=trDF; + Results[index-1]->res=TRes::trDF; Results[index-1]->Details+="Access denied."; } else if (code!=0) { - Results[index-1]->res=trRE; - Results[index-1]->Details+="Runtime error #"+ToStr((int)code); + Results[index-1]->res=TRes::trRE; + Results[index-1]->Details+="Runtime error #"+code.ToString(); } needbreak=true; break; @@ -563,8 +537,6 @@ } Sleep(1); } - - SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL); CloseHandle(si.hStdOutput);si.hStdOutput=NULL; CloseHandle(si.hStdInput);si.hStdInput=NULL; @@ -576,11 +548,11 @@ Results[index-1]->UsedMemory=mem.PeakProcessMemoryUsed; Results[index-1]->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); Results[index-1]->UsedRealTime=GetTickCount()-start; - if (Results[index-1]->res!=trAC) return; + if (Results[index-1]->res!=TRes::trAC) return; - if (!FileExists(oupath)) + if (!File::Exists(oupath)) { - Results[index-1]->res=trWA; + Results[index-1]->res=TRes::trWA; Results[index-1]->Details+="No output file"; return; } @@ -591,7 +563,7 @@ if (r==carAC) { - if (FileExists(pointpath)) + if (File::Exists(pointpath)) Results[index-1]->points.Parse(ReadFullFile(pointpath)); else Results[index-1]->points=1; return ; @@ -600,20 +572,20 @@ switch (r) { case carOE: - Results[index-1]->res=trOE; + Results[index-1]->res=TRes::trOE; break; case carPE: - Results[index-1]->res=trPE; + Results[index-1]->res=TRes::trPE; break; case carWA: - Results[index-1]->res=trWA; + Results[index-1]->res=TRes::trWA; break; case carIE: - Results[index-1]->res=trIE; + Results[index-1]->res=TRes::trIE; break; }; -}__finally +}finally { if (pi.hProcess!=NULL) CloseHandle(pi.hProcess); @@ -639,62 +611,79 @@ try { CheckCL(); - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) CheckDF(); else return ; - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) Compile(); else return ; - if (FCompResult.res==crOK) + if (FCompResult->res==TCompRes::crOK) RunTest(index); else return ; -} __finally +} finally { - (*FSummary.compres)=FCompResult; + FSummary->compres=FCompResult; } } void TSource::LoadLimits() { String^ path=FProblemPath+"Limits.txt"; - if (!FileExists(path)) + if (!File::Exists(path)) return; - char* buf; - FILE* f; - try + if (FState!=TSourceState::ssNone) { - if (FState!=ssNone) - { - throw "Can not load limits if state is higher than ssNone"; - return; - } - fopen_s(&f,buf=StrToArr(path),"rt"); - fscanf_s(f,"CodeLimit: %d\nCompilationTimeLimit: %d\nMemoryLimit: %d\n",&FLim.CodeLimit,&FLim.CompilationTimeLimit,&FLim.MemoryLimit); - fscanf_s(f,"OutputLimit: %d\nRealTimeLimit: %d\nTimeLimit: %d\n",&FLim.OutputLimit,&FLim.RealTimeLimit,&FLim.TimeLimit); - fscanf_s(f,"MaxThreads: %d",&FLim.MaxThreads); - }__finally - { - fclose(f); - FreeArr(buf); + throw "Can not load limits if state is higher than ssNone"; + return; } + StreamReader^ r=File::OpenText(path); + String^ buf=r->ReadLine(); + int i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->CodeLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->CompilationTimeLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->MemoryLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->OutputLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->RealTimeLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->TimeLimit=int::Parse(buf->Substring(i,buf->Length-i)); + + buf=r->ReadLine();i=0; + while (!((buf[i]>='0')&&(buf[i]<='9'))) i++; + FLim->MaxThreads=int::Parse(buf->Substring(i,buf->Length-i)); + r->Close(); } String^ TSource::TestResultToString(TRes res) { switch (res) { - case trAC:return "Accepted"; - case trWA:return "Wrong Answer"; - case trTL:return "Time Limit"; - case trML:return "Memory Limit"; - case trRTL:return "Real Time Limit"; - case trRE:return "Runtime Error"; - case trDF:return "Destricted Function"; - case trIE:return "Internal Error"; - case trOL:return "Output Limit"; - case trPE:return "Presentation Error"; - case trOE:return "Output Error"; + case TRes::trAC:return "Accepted"; + case TRes::trWA:return "Wrong Answer"; + case TRes::trTL:return "Time Limit"; + case TRes::trML:return "Memory Limit"; + case TRes::trRTL:return "Real Time Limit"; + case TRes::trRE:return "Runtime Error"; + case TRes::trDF:return "Destricted Function"; + case TRes::trIE:return "Internal Error"; + case TRes::trOL:return "Output Limit"; + case TRes::trPE:return "Presentation Error"; + case TRes::trOE:return "Output Error"; default:return "Unknown Error"; } } @@ -703,12 +692,12 @@ { switch (res) { - case crOK:return "No Error"; - case crCE:return "Compilation Error"; - case crCL:return "Code Limit"; - case crCTL:return "Compilation Time Limit"; - case crDF:return "Destricted Function"; - case crIE:return "Internal Error"; + case TCompRes::crOK:return "No Error"; + case TCompRes::crCE:return "Compilation Error"; + case TCompRes::crCL:return "Code Limit"; + case TCompRes::crCTL:return "Compilation Time Limit"; + case TCompRes::crDF:return "Destricted Function"; + case TCompRes::crIE:return "Internal Error"; default:return "Unknown Error"; } } Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-29 17:37:55 UTC (rev 287) @@ -64,7 +64,7 @@ ///TCompRes is all possible results of compilation ///</summary> - public enum TCompRes //result of compilation + public enum class TCompRes //result of compilation { crOK, //all ok crCE, //compilation error @@ -78,7 +78,7 @@ ///TRes is all possible results of running the source ///</summary> - public enum TRes + public enum class TRes { trAC, //accepted trWA, //wrong answer @@ -108,7 +108,7 @@ TResult() { - res=trAC; + res=TRes::trAC; points=0; UsedMemory=0; UsedTime=0; @@ -156,7 +156,7 @@ TCompResult() { - res=crOK; + res=TCompRes::crOK; UsedTime=0; Details=""; } @@ -173,7 +173,7 @@ ///TSourceState is all possible states of source during its testing ///</summary> - public enum TSourceState + public enum class TSourceState { ssNone=0, //no actions were taken ssCheckedCL=1, //CodeLimit checked @@ -236,7 +236,7 @@ ///TLang is all possible languages of source (needed for CheckDF) ///</summary> - public enum TLang + public enum class TLang { lCpp=0, lPascal=1 @@ -275,10 +275,10 @@ String^ FTempPath; //this is the place where temporary files will be created bool FRunAll; //if true then all tests will run (no matter on errors) TSourceState FState; //state of source - TCompResult FCompResult; //result of compilation - ArrayList FRes; //results of each test *MT* - TSummary FSummary; //summary results of all tests *MT* - TLimits FLim; //limits for testing + TCompResult^ FCompResult; //result of compilation + ArrayList^ FRes; //results of each test *MT* + TSummary^ FSummary; //summary results of all tests *MT* + TLimits^ FLim; //limits for testing TTestHandler^ FTestHandler; //event, that occures when test is completed *MT* TLang FLang; //language of source TSecure *FSecurity; //security class *MT* @@ -290,12 +290,18 @@ //int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE //void FreeChar(char* buf); - must free memory used by buf //if there is no library called TestLibrary.dll then standart check is performed + TFreeFunc DLLFreeChar; + TCheckSrc DLLCheckCL; + TCheckSrc DLLCheckDF; + TCheckAnswer DLLCheckAnswer; + TCheckLim DLLCheckTL; + TCheckLim DLLCheckRTL; CRITICAL_SECTION* cs; //for multithreading void init() { cs=new CRITICAL_SECTION; - InitializeCriticalSectionAndSpinCount(cs,100); + InitializeCriticalSectionAndSpinCount(cs,5); } void lock() @@ -319,7 +325,7 @@ int FCurrentTest; //current test for testing *MT* bool FNeedTest; //if found WA, or all test completed *MT* int FTestCnt; - ArrayList FThreads; + ArrayList^ FThreads; property int CurrentTest { void set(int value) @@ -328,7 +334,7 @@ { lock(); FCurrentTest=value; - }__finally + }finally { unlock(); } @@ -340,7 +346,7 @@ { lock(); return FCurrentTest; - }__finally + }finally { unlock(); } @@ -355,7 +361,7 @@ { lock(); FNeedTest=value; - }__finally + }finally { unlock(); } @@ -367,7 +373,7 @@ { lock(); return FNeedTest; - }__finally + }finally { unlock(); } @@ -380,7 +386,7 @@ { lock(); return FTestCnt; - } __finally + } finally { unlock(); } @@ -401,7 +407,7 @@ TCheckAnsRes CheckAnswer(int index,String^ output, String^% Details); void ProcessAll(); //gets result for all tests void ProcessTest(int index); //gets result for only 1 test - void LoadTest(int index,TTest% test); //load test from file + void LoadTest(int index,TTest^ test); //load test from file void LoadLimits(); //loads limits from a file Limits.txt static String^ TestResultToString(TRes res); static String^ CompileResultToString(TCompRes res); @@ -413,9 +419,9 @@ try { lock(); - FLim=(*value); + FLim=value; } - __finally { + finally { unlock(); } } @@ -424,9 +430,9 @@ try { lock(); - return %FLim; + return FLim; } - __finally { + finally { unlock(); } } @@ -440,7 +446,7 @@ { lock(); return FSrc; - }__finally { + }finally { unlock(); } } @@ -451,7 +457,7 @@ { lock(); FSrc=value; - } __finally { + } finally { unlock(); } } @@ -465,7 +471,7 @@ { lock(); return FExePath; - }__finally{ + }finally{ unlock(); } } @@ -478,7 +484,7 @@ { lock(); return FProblemPath; - }__finally { + }finally { unlock(); } } @@ -488,7 +494,7 @@ try{ lock(); FProblemPath=value; - }__finally { + }finally { unlock(); } } @@ -501,8 +507,8 @@ try { lock(); - return %FCompResult; - }__finally { + return FCompResult; + }finally { unlock(); } } @@ -514,8 +520,8 @@ try { lock(); - return (FState); - }__finally { + return FState; + }finally { unlock(); } }; @@ -525,7 +531,7 @@ { lock(); FState=(value); - }__finally { + }finally { unlock(); } }; @@ -538,14 +544,14 @@ try { lock(); - if (index>=FRes.Count) + if (index>=FRes->Count) { throw "The index is not accesible"; return (%TResult()); } return (TResult^)FRes[index]; } - __finally + finally { unlock(); } @@ -559,8 +565,8 @@ try { lock(); - return (%FSummary); - }__finally + return FSummary; + }finally { unlock(); } @@ -571,9 +577,9 @@ try { lock(); - FSummary=(*value); + FSummary=value; } - __finally { + finally { unlock(); } } @@ -587,7 +593,7 @@ { lock(); return FTestHandler; - }__finally + }finally { unlock(); } @@ -599,7 +605,7 @@ { lock(); FTestHandler=value; - }__finally + }finally { unlock(); } @@ -614,7 +620,7 @@ { lock(); return (FCompPath); - }__finally + }finally { unlock(); } @@ -626,7 +632,7 @@ { lock(); FCompPath=value; - }__finally + }finally { unlock(); } @@ -641,7 +647,7 @@ { lock(); return FTempPath; - }__finally + }finally { unlock(); } @@ -654,7 +660,7 @@ lock(); FTempPath=value; System::IO::Directory::CreateDirectory(FTempPath); - }__finally + }finally { unlock(); } @@ -669,7 +675,7 @@ { lock(); FRunAll=value; - } __finally + } finally { unlock(); } @@ -681,7 +687,7 @@ { lock(); return FRunAll; - }__finally + }finally { unlock(); } @@ -696,7 +702,7 @@ { lock(); FLang=value; - } __finally + } finally { unlock(); } @@ -708,7 +714,7 @@ { lock(); return FLang; - }__finally + }finally { unlock(); } Modified: ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-29 17:37:55 UTC (rev 287) @@ -7,14 +7,14 @@ TESTLIBRARY_API bool CheckCL(char* src, int cl, char*& details) { details=new char[20]; - strcpy_s(details,20,"CheckCL from DLL\n"); + strcpy_s(details,20,"DLLCheckCL"); return ((int)strlen(src)>cl); } TESTLIBRARY_API bool CheckDF(char* src, int lang, char*& details) { details=new char[20]; - strcpy_s(details,20,"CheckDF from DLL\n"); + strcpy_s(details,20,"DLLCheckDF"); return false; } @@ -38,10 +38,7 @@ if (strcmp(output,rightoutput)==0) return 0; Details=new char[30]; - strcpy(Details,output); - strcat(Details," RIGHT: "); - strcat(Details,rightoutput); - strcat(Details,"\n"); + strcpy_s(Details,30,"DLLCheckAns"); int curo=0; for (int i=0;;i++,curo++) { Modified: ACMServer/trunk/sharp tester/TestLibrary/dllmain.cpp =================================================================== --- ACMServer/trunk/sharp tester/TestLibrary/dllmain.cpp 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/TestLibrary/dllmain.cpp 2008-06-29 17:37:55 UTC (rev 287) @@ -1,7 +1,7 @@ // dllmain.cpp : Defines the entry point for the DLL application. #pragma once #include "stdafx.h" -#include <stdio.h> +#include <fstream> extern double TLx,TLk; BOOL APIENTRY DllMain( HMODULE hModule, @@ -12,18 +12,18 @@ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: - FILE* f; + { TLx=0;TLk=1; - if (fopen_s(&f,"Times.txt","rt")==0) + std::ifstream f("Times.txt"); + if (!f.bad()) { - fscanf_s(f,"%Lf %Lf",&TLk,&TLx); - fclose(f); + f>>TLk>>TLx; + f.close(); } - break; - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; + } + case DLL_THREAD_ATTACH:; + case DLL_THREAD_DETACH:; + case DLL_PROCESS_DETACH:; } return TRUE; } \ No newline at end of file Modified: ACMServer/trunk/sharp tester/tester/Program.cs =================================================================== --- ACMServer/trunk/sharp tester/tester/Program.cs 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/tester/Program.cs 2008-06-29 17:37:55 UTC (rev 287) @@ -38,47 +38,52 @@ { DateTime start=DateTime.Now; MiniMax rt=new MiniMax(),t=new MiniMax(),mem=new MiniMax(),ct=new MiniMax(); - //for (int i = 0; i < 10000; i++) + for (int i = 0; i < 1; i++) { - TSource c = new TSource(); StreamReader s = new StreamReader("InData.txt", Encoding.Default); String compiler = s.ReadLine(); String problem = s.ReadLine(); String temp = s.ReadLine(); String source = s.ReadLine(); s.Close(); - s = File.OpenText(source); - c.CompPath = compiler; - c.ProblemPath = problem; - c.LoadLimits(); - c.Src = s.ReadToEnd(); - s.Close(); - c.TempPath = temp; - c.TestHandler += new TTestHandler(func); - c.Language = (TLang)1; - c.ProcessAll(); - c.State = (TSourceState)6; - Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res),c.Summary.compres.Details,c.Summary.compres.UsedTime); - Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); - Console.WriteLine("Points: {0}", c.Summary.res.points); - Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); - Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); - Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); - //Console.ReadKey(); - Console.WriteLine(" CompRes: {0}, TestRes: {1}", TSource.CompileResultToString(c.Summary.compres.res), TSource.TestResultToString(c.Summary.res.res)); + int index=1; + while (File.Exists(Path.GetDirectoryName(source) + "\\" + Path.GetFileNameWithoutExtension(source) + index.ToString() + Path.GetExtension(source))) + { + Console.WriteLine("----------------------------------------------------------------"); + Console.WriteLine("------------------------Test Number {0}-------------------------", index); + Console.WriteLine("----------------------------------------------------------------"); + s = File.OpenText(Path.GetDirectoryName(source) + "\\" + Path.GetFileNameWithoutExtension(source) + index.ToString() + Path.GetExtension(source)); + TSource c = new TSource(); + c.CompPath = compiler; + c.ProblemPath = problem; + c.LoadLimits(); + c.Src = s.ReadToEnd(); + s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + c.Language = TLang.lPascal; + c.ProcessAll(); + c.State = TSourceState.ssFinish; + Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + Console.WriteLine("Points: {0}", c.Summary.res.points); + Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + //Console.ReadKey(); + index++; + c.Dispose(); + } + /*Console.WriteLine(" CompRes: {0}, TestRes: {1}", TSource.CompileResultToString(c.Summary.compres.res), TSource.TestResultToString(c.Summary.res.res)); rt.update(c.Summary.res.UsedRealTime); t.update(c.Summary.res.UsedTime); ct.update(c.Summary.compres.UsedTime); - mem.update(c.Summary.res.UsedMemory); - /*if (c.Summary.res.res != 0) - { - System.Media.SystemSounds.Beep.Play(); - Console.ReadKey(); - }*/ + mem.update(c.Summary.res.UsedMemory);*/ + } - Console.WriteLine("Used Time: {0} ms", (System.DateTime.Now.Ticks - start.Ticks)/10000); + /*Console.WriteLine("Used Time: {0} ms", (System.DateTime.Now.Ticks - start.Ticks)/10000); Console.WriteLine("MAX: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte", ct.max, t.max, rt.max, mem.max); - Console.WriteLine("Diff: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte",ct.diff(),t.diff(),rt.diff(),mem.diff()); + Console.WriteLine("Diff: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte",ct.diff(),t.diff(),rt.diff(),mem.diff());*/ Console.ReadKey(); } } Modified: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-28 12:23:27 UTC (rev 286) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-29 17:37:55 UTC (rev 287) @@ -1,7 +1,7 @@ CodeLimit: 1024 CompilationTimeLimit: 10000 -MemoryLimit: 10000000 +MemoryLimit: 21000000 OutputLimit: 1024 RealTimeLimit: 100000 -TimeLimit: 500 +TimeLimit: 1000 MaxThreads: 4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-28 12:23:20
|
Revision: 286 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=286&view=rev Author: brus07 Date: 2008-06-28 05:23:27 -0700 (Sat, 28 Jun 2008) Log Message: ----------- Rename file of SocketServerGatePlugin UserControl Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.resx Removed 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 Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-28 11:29:06 UTC (rev 285) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-28 12:23:27 UTC (rev 286) @@ -38,11 +38,11 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SocketServerGate.cs" /> <Compile Include="SocketServerGatePlugin.cs" /> - <Compile Include="TestUserControl.cs"> + <Compile Include="SocketServerGatePluginUserControl.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="TestUserControl.Designer.cs"> - <DependentUpon>TestUserControl.cs</DependentUpon> + <Compile Include="SocketServerGatePluginUserControl.Designer.cs"> + <DependentUpon>SocketServerGatePluginUserControl.cs</DependentUpon> </Compile> </ItemGroup> <ItemGroup> @@ -64,9 +64,9 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="TestUserControl.resx"> + <EmbeddedResource Include="SocketServerGatePluginUserControl.resx"> <SubType>Designer</SubType> - <DependentUpon>TestUserControl.cs</DependentUpon> + <DependentUpon>SocketServerGatePluginUserControl.cs</DependentUpon> </EmbeddedResource> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs (from rev 284, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs 2008-06-28 12:23:27 UTC (rev 286) @@ -0,0 +1,110 @@ +namespace SocketServerGatePlugin +{ + partial class SocketServerGatePluginUserControl + { + /// <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.components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.socketGateStatusStrip = new System.Windows.Forms.StatusStrip(); + this.clientsCountToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.clientCountTimer = new System.Windows.Forms.Timer(this.components); + this.autoScrollCheckBox = new System.Windows.Forms.CheckBox(); + this.socketGateStatusStrip.SuspendLayout(); + this.SuspendLayout(); + // + // 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, 26); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox1.Size = new System.Drawing.Size(211, 130); + this.textBox1.TabIndex = 1; + // + // socketGateStatusStrip + // + this.socketGateStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.clientsCountToolStripStatusLabel}); + this.socketGateStatusStrip.Location = new System.Drawing.Point(0, 159); + this.socketGateStatusStrip.Name = "socketGateStatusStrip"; + this.socketGateStatusStrip.Size = new System.Drawing.Size(217, 22); + this.socketGateStatusStrip.TabIndex = 3; + this.socketGateStatusStrip.Text = "statusStrip1"; + // + // clientsCountToolStripStatusLabel + // + this.clientsCountToolStripStatusLabel.Name = "clientsCountToolStripStatusLabel"; + this.clientsCountToolStripStatusLabel.Size = new System.Drawing.Size(87, 17); + this.clientsCountToolStripStatusLabel.Text = "CountOfClients: "; + // + // clientCountTimer + // + this.clientCountTimer.Tick += new System.EventHandler(this.clientCountTimer_Tick); + // + // autoScrollCheckBox + // + this.autoScrollCheckBox.AutoSize = true; + this.autoScrollCheckBox.Checked = true; + this.autoScrollCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.autoScrollCheckBox.Enabled = false; + this.autoScrollCheckBox.Location = new System.Drawing.Point(3, 3); + this.autoScrollCheckBox.Name = "autoScrollCheckBox"; + this.autoScrollCheckBox.Size = new System.Drawing.Size(74, 17); + this.autoScrollCheckBox.TabIndex = 4; + this.autoScrollCheckBox.Text = "AutoScroll"; + this.autoScrollCheckBox.UseVisualStyleBackColor = true; + // + // SocketServerGatePluginUserControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.autoScrollCheckBox); + this.Controls.Add(this.socketGateStatusStrip); + this.Controls.Add(this.textBox1); + this.Name = "SocketServerGatePluginUserControl"; + this.Size = new System.Drawing.Size(217, 181); + this.Load += new System.EventHandler(this.SocketServerGatePluginUserControl_Load); + this.socketGateStatusStrip.ResumeLayout(false); + this.socketGateStatusStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.StatusStrip socketGateStatusStrip; + private System.Windows.Forms.ToolStripStatusLabel clientsCountToolStripStatusLabel; + private System.Windows.Forms.Timer clientCountTimer; + private System.Windows.Forms.CheckBox autoScrollCheckBox; + } +} Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs (from rev 284, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs 2008-06-28 12:23:27 UTC (rev 286) @@ -0,0 +1,65 @@ +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.SocketServerGatePlugin; + +namespace SocketServerGatePlugin +{ + public partial class SocketServerGatePluginUserControl : UserControl + { + public SocketServerGatePluginUserControl() + { + InitializeComponent(); + } + + delegate void AddTextCallback(string text); + public void AddText(string text) + { + if (this.textBox1.InvokeRequired) + { + AddTextCallback d = new AddTextCallback(AddText); + this.Invoke(d, new object[] { text }); + } + else + { + textBox1.Text += text; + if (autoScrollCheckBox.Checked) + { + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + } + } + } + + delegate void UpdateClientsCountStatusCallback(int clientsCount); + public void UpdateClientsCountStatus(int clientsCount) + { + if (this.socketGateStatusStrip.InvokeRequired) + { + UpdateClientsCountStatusCallback d = new UpdateClientsCountStatusCallback(UpdateClientsCountStatus); + this.Invoke(d, new object[] { clientsCount }); + } + else + { + clientsCountToolStripStatusLabel.Text = "CountOfClients: "; + clientsCountToolStripStatusLabel.Text += clientsCount.ToString(); + } + } + + private void clientCountTimer_Tick(object sender, EventArgs e) + { + SocketServerGate gate = SocketServerGate.GetInstance(); + int count = gate.CountClients(); + UpdateClientsCountStatus(count); + } + + private void SocketServerGatePluginUserControl_Load(object sender, EventArgs e) + { + clientCountTimer.Enabled = true; + } + } +} Copied: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.resx (from rev 284, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx) =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.resx (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.resx 2008-06-28 12:23:27 UTC (rev 286) @@ -0,0 +1,126 @@ +<?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> + <metadata name="socketGateStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="clientCountTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>178, 17</value> + </metadata> +</root> \ No newline at end of file Deleted: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-28 11:29:06 UTC (rev 285) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-28 12:23:27 UTC (rev 286) @@ -1,110 +0,0 @@ -namespace SocketServerGatePlugin -{ - partial class SocketServerGatePluginUserControl - { - /// <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.components = new System.ComponentModel.Container(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.socketGateStatusStrip = new System.Windows.Forms.StatusStrip(); - this.clientsCountToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.clientCountTimer = new System.Windows.Forms.Timer(this.components); - this.autoScrollCheckBox = new System.Windows.Forms.CheckBox(); - this.socketGateStatusStrip.SuspendLayout(); - this.SuspendLayout(); - // - // 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, 26); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBox1.Size = new System.Drawing.Size(211, 130); - this.textBox1.TabIndex = 1; - // - // socketGateStatusStrip - // - this.socketGateStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.clientsCountToolStripStatusLabel}); - this.socketGateStatusStrip.Location = new System.Drawing.Point(0, 159); - this.socketGateStatusStrip.Name = "socketGateStatusStrip"; - this.socketGateStatusStrip.Size = new System.Drawing.Size(217, 22); - this.socketGateStatusStrip.TabIndex = 3; - this.socketGateStatusStrip.Text = "statusStrip1"; - // - // clientsCountToolStripStatusLabel - // - this.clientsCountToolStripStatusLabel.Name = "clientsCountToolStripStatusLabel"; - this.clientsCountToolStripStatusLabel.Size = new System.Drawing.Size(87, 17); - this.clientsCountToolStripStatusLabel.Text = "CountOfClients: "; - // - // clientCountTimer - // - this.clientCountTimer.Tick += new System.EventHandler(this.clientCountTimer_Tick); - // - // autoScrollCheckBox - // - this.autoScrollCheckBox.AutoSize = true; - this.autoScrollCheckBox.Checked = true; - this.autoScrollCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.autoScrollCheckBox.Enabled = false; - this.autoScrollCheckBox.Location = new System.Drawing.Point(3, 3); - this.autoScrollCheckBox.Name = "autoScrollCheckBox"; - this.autoScrollCheckBox.Size = new System.Drawing.Size(74, 17); - this.autoScrollCheckBox.TabIndex = 4; - this.autoScrollCheckBox.Text = "AutoScroll"; - this.autoScrollCheckBox.UseVisualStyleBackColor = true; - // - // SocketServerGatePluginUserControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.autoScrollCheckBox); - this.Controls.Add(this.socketGateStatusStrip); - this.Controls.Add(this.textBox1); - this.Name = "SocketServerGatePluginUserControl"; - this.Size = new System.Drawing.Size(217, 181); - this.Load += new System.EventHandler(this.SocketServerGatePluginUserControl_Load); - this.socketGateStatusStrip.ResumeLayout(false); - this.socketGateStatusStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.StatusStrip socketGateStatusStrip; - private System.Windows.Forms.ToolStripStatusLabel clientsCountToolStripStatusLabel; - private System.Windows.Forms.Timer clientCountTimer; - private System.Windows.Forms.CheckBox autoScrollCheckBox; - } -} Deleted: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-28 11:29:06 UTC (rev 285) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-28 12:23:27 UTC (rev 286) @@ -1,65 +0,0 @@ -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.SocketServerGatePlugin; - -namespace SocketServerGatePlugin -{ - public partial class SocketServerGatePluginUserControl : UserControl - { - public SocketServerGatePluginUserControl() - { - InitializeComponent(); - } - - delegate void AddTextCallback(string text); - public void AddText(string text) - { - if (this.textBox1.InvokeRequired) - { - AddTextCallback d = new AddTextCallback(AddText); - this.Invoke(d, new object[] { text }); - } - else - { - textBox1.Text += text; - if (autoScrollCheckBox.Checked) - { - textBox1.Select(textBox1.Text.Length, 0); - textBox1.ScrollToCaret(); - } - } - } - - delegate void UpdateClientsCountStatusCallback(int clientsCount); - public void UpdateClientsCountStatus(int clientsCount) - { - if (this.socketGateStatusStrip.InvokeRequired) - { - UpdateClientsCountStatusCallback d = new UpdateClientsCountStatusCallback(UpdateClientsCountStatus); - this.Invoke(d, new object[] { clientsCount }); - } - else - { - clientsCountToolStripStatusLabel.Text = "CountOfClients: "; - clientsCountToolStripStatusLabel.Text += clientsCount.ToString(); - } - } - - private void clientCountTimer_Tick(object sender, EventArgs e) - { - SocketServerGate gate = SocketServerGate.GetInstance(); - int count = gate.CountClients(); - UpdateClientsCountStatus(count); - } - - private void SocketServerGatePluginUserControl_Load(object sender, EventArgs e) - { - clientCountTimer.Enabled = true; - } - } -} Deleted: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-28 11:29:06 UTC (rev 285) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-28 12:23:27 UTC (rev 286) @@ -1,126 +0,0 @@ -<?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> - <metadata name="socketGateStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> - <metadata name="clientCountTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>178, 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-06-28 11:28:59
|
Revision: 285 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=285&view=rev Author: brus07 Date: 2008-06-28 04:29:06 -0700 (Sat, 28 Jun 2008) Log Message: ----------- Change class name Modified Paths: -------------- ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-28 11:13:25 UTC (rev 284) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-28 11:29:06 UTC (rev 285) @@ -32,12 +32,12 @@ void RunLoadDll(Object ob) { - kernel.AddControl += new EventHandler<AcmContester.Mediator.Library.MediatorKernel.ControlEventArds>(kernel_AddControl); + kernel.AddControl += new EventHandler<AcmContester.Mediator.Library.MediatorKernel.ControlEventArgs>(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) + delegate void AddControlCallback(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArgs e); + void kernel_AddControl(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArgs e) { if (this.tabControl1.InvokeRequired) { Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-28 11:13:25 UTC (rev 284) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-28 11:29:06 UTC (rev 285) @@ -13,11 +13,11 @@ public Panel panel; - internal sealed class ControlEventArds : EventArgs + internal sealed class ControlEventArgs : EventArgs { Control control; string name; - public ControlEventArds(Control in_Control, string in_Name) + public ControlEventArgs(Control in_Control, string in_Name) { control = in_Control; name = in_Name; @@ -39,7 +39,7 @@ } - public event EventHandler<ControlEventArds> AddControl; + public event EventHandler<ControlEventArgs> AddControl; public void LoadLists() { @@ -50,7 +50,7 @@ plugin.onWorkingData += WorkingData; if (plugin.Control != null) { - this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + this.OnAddControl(new ControlEventArgs(plugin.Control, plugin.GetType().Name)); } } clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); @@ -60,14 +60,14 @@ plugin.onWorkingData += WorkingData; if (plugin.Control != null) { - this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + this.OnAddControl(new ControlEventArgs(plugin.Control, plugin.GetType().Name)); } } } - private void OnAddControl(ControlEventArds e) + private void OnAddControl(ControlEventArgs e) { - EventHandler<ControlEventArds> temp = AddControl; + EventHandler<ControlEventArgs> temp = AddControl; if (temp != null) temp(this, e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-28 11:13:18
|
Revision: 284 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=284&view=rev Author: brus07 Date: 2008-06-28 04:13:25 -0700 (Sat, 28 Jun 2008) Log Message: ----------- Logging in plugin textBox control socketServerGate work. Show in plugin statusBar count of clients. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 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 Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-27 09:38:51 UTC (rev 283) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-28 11:13:25 UTC (rev 284) @@ -39,15 +39,46 @@ 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); } } + + public class LogMessageEventArgs : EventArgs + { + public string message; + public LogMessageEventArgs(string mes) + { + message = mes; + } + } + + public event EventHandler<LogMessageEventArgs> LogMessage; + private void OnLogMessage(string p) + { + EventHandler<LogMessageEventArgs> temp = LogMessage; + if (temp != null) + temp(this, new LogMessageEventArgs(p)); + } + + protected void DataArrived(string message) { Result result = Result.CreateFromXml(message); dataContainer.Return(result); if (onDataArrived != null) onDataArrived(result.ToStringX()); + + + OnLogMessage("SocketServerGate::DataArrived(message)"); + OnLogMessage("\t " + result.res + " for " + result.Submit.id.ToString()); } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-27 09:38:51 UTC (rev 283) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-28 11:13:25 UTC (rev 284) @@ -13,7 +13,9 @@ socketServerGate = SocketServerGate.GetInstance(); socketServerGate.onDataArrived += DataArrived; - base.Control = new TestUserControl(); + base.Control = new SocketServerGatePluginUserControl(); + + socketServerGate.LogMessage += new EventHandler<SocketServerGate.LogMessageEventArgs>(socketServerGate_LogMessage); } public override void Send(string message) @@ -27,5 +29,17 @@ WorkingData("SocketServerGatePlugin::Send CountClients = " + socketServerGate.CountClients().ToString()); socketServerGate.Send(message); } + + private void AddTextToContorl(string message) + { + string result = DateTime.Now.ToLongTimeString() + "." + DateTime.Now.Millisecond.ToString(); + result += " " + message + Environment.NewLine; + ((SocketServerGatePluginUserControl)base.Control).AddText(result); + } + + void socketServerGate_LogMessage(object sender, SocketServerGate.LogMessageEventArgs e) + { + AddTextToContorl(e.message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-27 09:38:51 UTC (rev 283) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-28 11:13:25 UTC (rev 284) @@ -1,6 +1,6 @@ namespace SocketServerGatePlugin { - partial class TestUserControl + partial class SocketServerGatePluginUserControl { /// <summary> /// Required designer variable. @@ -28,51 +28,72 @@ /// </summary> private void InitializeComponent() { - this.setButton = new System.Windows.Forms.Button(); + this.components = new System.ComponentModel.Container(); this.textBox1 = new System.Windows.Forms.TextBox(); - this.clearButton = new System.Windows.Forms.Button(); + this.socketGateStatusStrip = new System.Windows.Forms.StatusStrip(); + this.clientsCountToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.clientCountTimer = new System.Windows.Forms.Timer(this.components); + this.autoScrollCheckBox = new System.Windows.Forms.CheckBox(); + this.socketGateStatusStrip.SuspendLayout(); 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.Location = new System.Drawing.Point(3, 26); 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.Size = new System.Drawing.Size(211, 130); this.textBox1.TabIndex = 1; // - // clearButton + // socketGateStatusStrip // - 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); + this.socketGateStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.clientsCountToolStripStatusLabel}); + this.socketGateStatusStrip.Location = new System.Drawing.Point(0, 159); + this.socketGateStatusStrip.Name = "socketGateStatusStrip"; + this.socketGateStatusStrip.Size = new System.Drawing.Size(217, 22); + this.socketGateStatusStrip.TabIndex = 3; + this.socketGateStatusStrip.Text = "statusStrip1"; // - // TestUserControl + // clientsCountToolStripStatusLabel // + this.clientsCountToolStripStatusLabel.Name = "clientsCountToolStripStatusLabel"; + this.clientsCountToolStripStatusLabel.Size = new System.Drawing.Size(87, 17); + this.clientsCountToolStripStatusLabel.Text = "CountOfClients: "; + // + // clientCountTimer + // + this.clientCountTimer.Tick += new System.EventHandler(this.clientCountTimer_Tick); + // + // autoScrollCheckBox + // + this.autoScrollCheckBox.AutoSize = true; + this.autoScrollCheckBox.Checked = true; + this.autoScrollCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.autoScrollCheckBox.Enabled = false; + this.autoScrollCheckBox.Location = new System.Drawing.Point(3, 3); + this.autoScrollCheckBox.Name = "autoScrollCheckBox"; + this.autoScrollCheckBox.Size = new System.Drawing.Size(74, 17); + this.autoScrollCheckBox.TabIndex = 4; + this.autoScrollCheckBox.Text = "AutoScroll"; + this.autoScrollCheckBox.UseVisualStyleBackColor = true; + // + // SocketServerGatePluginUserControl + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.clearButton); + this.Controls.Add(this.autoScrollCheckBox); + this.Controls.Add(this.socketGateStatusStrip); this.Controls.Add(this.textBox1); - this.Controls.Add(this.setButton); - this.Name = "TestUserControl"; + this.Name = "SocketServerGatePluginUserControl"; + this.Size = new System.Drawing.Size(217, 181); + this.Load += new System.EventHandler(this.SocketServerGatePluginUserControl_Load); + this.socketGateStatusStrip.ResumeLayout(false); + this.socketGateStatusStrip.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -80,8 +101,10 @@ #endregion - private System.Windows.Forms.Button setButton; private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Button clearButton; + private System.Windows.Forms.StatusStrip socketGateStatusStrip; + private System.Windows.Forms.ToolStripStatusLabel clientsCountToolStripStatusLabel; + private System.Windows.Forms.Timer clientCountTimer; + private System.Windows.Forms.CheckBox autoScrollCheckBox; } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-27 09:38:51 UTC (rev 283) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-28 11:13:25 UTC (rev 284) @@ -5,24 +5,61 @@ using System.Data; using System.Text; using System.Windows.Forms; +using AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin; namespace SocketServerGatePlugin { - public partial class TestUserControl : UserControl + public partial class SocketServerGatePluginUserControl : UserControl { - public TestUserControl() + public SocketServerGatePluginUserControl() { InitializeComponent(); } - private void clearButton_Click(object sender, EventArgs e) + delegate void AddTextCallback(string text); + public void AddText(string text) { - textBox1.Text = ""; + if (this.textBox1.InvokeRequired) + { + AddTextCallback d = new AddTextCallback(AddText); + this.Invoke(d, new object[] { text }); + } + else + { + textBox1.Text += text; + if (autoScrollCheckBox.Checked) + { + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + } + } } - private void setButton_Click(object sender, EventArgs e) + delegate void UpdateClientsCountStatusCallback(int clientsCount); + public void UpdateClientsCountStatus(int clientsCount) { - textBox1.Text = "A"; + if (this.socketGateStatusStrip.InvokeRequired) + { + UpdateClientsCountStatusCallback d = new UpdateClientsCountStatusCallback(UpdateClientsCountStatus); + this.Invoke(d, new object[] { clientsCount }); + } + else + { + clientsCountToolStripStatusLabel.Text = "CountOfClients: "; + clientsCountToolStripStatusLabel.Text += clientsCount.ToString(); + } } + + private void clientCountTimer_Tick(object sender, EventArgs e) + { + SocketServerGate gate = SocketServerGate.GetInstance(); + int count = gate.CountClients(); + UpdateClientsCountStatus(count); + } + + private void SocketServerGatePluginUserControl_Load(object sender, EventArgs e) + { + clientCountTimer.Enabled = true; + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-27 09:38:51 UTC (rev 283) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-28 11:13:25 UTC (rev 284) @@ -117,4 +117,10 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="socketGateStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="clientCountTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>178, 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-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-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. |