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: <Or...@us...> - 2008-06-03 15:59:26
|
Revision: 206 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=206&view=rev Author: Oracle_ Date: 2008-06-03 08:59:35 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Removed Paths: ------------- ACMServer/branches/sharp tester/SourceTest/AdvAPI32.Lib Deleted: ACMServer/branches/sharp tester/SourceTest/AdvAPI32.Lib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-03 15:58:06
|
Revision: 205 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=205&view=rev Author: Oracle_ Date: 2008-06-03 08:58:14 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Added TestLibrary. Added Paths: ----------- ACMServer/branches/sharp tester/SourceTest/AdvAPI32.Lib here.txt ACMServer/branches/sharp tester/TestLibrary/ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/branches/sharp tester/TestLibrary/TestLibrary.def ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h ACMServer/branches/sharp tester/TestLibrary/TestLibrary.vcproj ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp ACMServer/branches/sharp tester/TestLibrary/stdafx.cpp ACMServer/branches/sharp tester/TestLibrary/stdafx.h ACMServer/branches/sharp tester/TestLibrary/targetver.h Added: ACMServer/branches/sharp tester/SourceTest/AdvAPI32.Lib here.txt =================================================================== Added: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,58 @@ +// TestLibrary.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" +#include "TestLibrary.h" +#include <new.h> +#include <stdio.h> + +TESTLIBRARY_API bool CheckCL(char* src, int cl, char*& details) +{ + details=new char[20]; + strcpy_s(details,20,"CheckCL from DLL\n"); + 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"); + return false; +} + +TESTLIBRARY_API void FreeChar(char* buf) +{ + delete[] buf; +} + +TESTLIBRARY_API bool CheckRTL(int usedrealtime, int realtimelimit) +{ + return (usedrealtime>realtimelimit); +} + +TESTLIBRARY_API bool CheckTL(int usedtime, int timelimit) +{ + return (usedtime>timelimit); +} + +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput) +{ + if (strcmp(output,rightoutput)==0) + return 0; + int curo=0; + for (int i=0;;i++,curo++) + { + if (output[curo]=='\0'&&rightoutput[i]!='\0') + return 1; + if (output[curo]!='\0'&&rightoutput[i]=='\0') + return 1; + if (output[curo]=='\0'&&rightoutput[i]=='\0') + return 3; + while ((output[curo]==' ')&&(output[curo]=='\n')&&(output[curo]=='\r')) + ++curo; + while ((rightoutput[i]==' ')&&(rightoutput[i]=='\n')&&(rightoutput[i]=='\r')) + ++i; + if (output[curo]!=rightoutput[i]) + return 1; + } +} Added: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.def =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.def (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.def 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,8 @@ +LIBRARY "TestLibrary" +EXPORTS +CheckCL +CheckDF +FreeChar +CheckRTL +CheckTL +CheckAnswer \ No newline at end of file Added: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,14 @@ + +#ifdef TESTLIBRARY_EXPORTS +#define TESTLIBRARY_API __declspec(dllexport) +#else +#define TESTLIBRARY_API __declspec(dllimport) +#endif + +TESTLIBRARY_API bool CheckCL(char* src, int cl, char*& details); +TESTLIBRARY_API bool CheckDF(char* src, int lang, char*& details); +TESTLIBRARY_API void FreeChar(char* buf); +TESTLIBRARY_API bool CheckRTL(int usedrealtime, int realtimelimit); +TESTLIBRARY_API bool CheckTL(int usedtime, int timelimit); +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput); + Added: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.vcproj =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.vcproj (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.vcproj 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="windows-1251"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="TestLibrary" + ProjectGUID="{2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}" + RootNamespace="TestLibrary" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTLIBRARY_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="2" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + ModuleDefinitionFile="TestLibrary.def" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TESTLIBRARY_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="2" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + ModuleDefinitionFile="TestLibrary.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\dllmain.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + CompileAsManaged="0" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + CompileAsManaged="0" + /> + </FileConfiguration> + </File> + <File + RelativePath=".\stdafx.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + </File> + <File + RelativePath=".\TestLibrary.cpp" + > + </File> + <File + RelativePath=".\TestLibrary.def" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\stdafx.h" + > + </File> + <File + RelativePath=".\targetver.h" + > + </File> + <File + RelativePath=".\TestLibrary.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + Added: ACMServer/branches/sharp tester/TestLibrary/stdafx.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/stdafx.cpp (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/stdafx.cpp 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// TestLibrary.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Added: ACMServer/branches/sharp tester/TestLibrary/stdafx.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/stdafx.h (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/stdafx.h 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include <windows.h> + + + +// TODO: reference additional headers your program requires here Added: ACMServer/branches/sharp tester/TestLibrary/targetver.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/targetver.h (rev 0) +++ ACMServer/branches/sharp tester/TestLibrary/targetver.h 2008-06-03 15:58:14 UTC (rev 205) @@ -0,0 +1,24 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-03 15:55:31
|
Revision: 204 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=204&view=rev Author: Oracle_ Date: 2008-06-03 08:55:38 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Added test library. Some new abilities was added to TSource. Modified Paths: -------------- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h ACMServer/branches/sharp tester/SourceTest.sln ACMServer/branches/sharp tester/tester/Program.cs Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-02 21:41:52 UTC (rev 203) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-03 15:55:38 UTC (rev 204) @@ -55,40 +55,42 @@ FState=ssNone; FCompPath=gcnew String(""); FRunAll=true; +lib=LoadLibraryA("TestLibrary.dll"); +FSecurity=new TSecure(); init(); } TSource::~TSource() { +if (lib!=NULL) + FreeLibrary(lib); +delete FSecurity; final(); } void TSource::CheckCL() { - HMODULE lib=NULL; try { lock(); - lib=LoadLibrary((LPCWSTR)"CheckCodeLimitDLL"); if (lib==NULL) { if (FSrc->Length>FLim.CodeLimit) - { FCompResult.res=crCL; - FCompResult.Details+="Used std checker for Code Limit\n"; - } + FCompResult.Details+="Used std checker for Code Limit\n"; } else { - TCheckCL prc=(TCheckCL)GetProcAddress(lib,"CheckCL"); - String^ buf; - if (prc(FSrc,buf)) FCompResult.res=crCL; - FCompResult.Details+=buf; + TCheckSrc prc=(TCheckSrc)GetProcAddress(lib,"CheckCL"); + char* buf,*bufA; + if (prc(bufA=StrToArr(FSrc),FLim.CodeLimit,buf)) FCompResult.res=crCL; + FreeArr(bufA); + FCompResult.Details+=gcnew String(buf); + TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + prc2(buf); } FState=ssCheckedCL; }__finally { - if (lib!=NULL) - FreeLibrary(lib); unlock(); } } @@ -98,7 +100,19 @@ try { lock(); - //MAIN SOURCE + if (lib==NULL) + { + 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; + FreeArr(bufA); + FCompResult.Details+=gcnew String(buf); + TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + prc2(buf); + } FState=ssCheckedDF; }__finally { @@ -273,13 +287,11 @@ TCheckAnsRes TSource::CheckAnswer(int index,String^ output) { - HMODULE lib=NULL; try { lock(); TTest t; LoadTest(index,t); - lib=LoadLibrary((LPCWSTR)"CheckAnswerDLL"); if (lib==NULL) { if (output!=t.output) @@ -287,13 +299,14 @@ return carAC; } else { + char* buf1,*buf2,*buf3; TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); - return prc(t.input,output,t.output); + TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output)); + FreeArr(buf1);FreeArr(buf2);FreeArr(buf3); + return res; } }__finally { - if (lib!=NULL) - FreeLibrary(lib); unlock(); } } @@ -327,12 +340,9 @@ return FALSE; if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) return FALSE; - return TRUE; } - - void DeletePrivileges(HANDLE proc) { HANDLE hToken; @@ -426,7 +436,7 @@ SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); - if (!CreateProcess(NULL,bufW=StrToArrW(FExePath),NULL,NULL,TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) + if (!FSecurity->RunProcess(bufW=StrToArrW(FExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,&si,&pi)) { FreeArr(bufW); it->points=0; @@ -471,6 +481,9 @@ it->Details="Size of output file excided OutputLimit"; break; } + QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); + if (lib==NULL) + { if ((int)(GetTickCount()-start)>FLim.RealTimeLimit) { TerminateJobObject(job,0); @@ -478,7 +491,6 @@ it->Details="Real time limit"; break; } - QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); if ((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)>FLim.TimeLimit*10000) { TerminateJobObject(job,0); @@ -486,6 +498,25 @@ it->Details="Time Limit"; break; } + } else + { + TCheckLim prc=(TCheckLim)GetProcAddress(lib,"CheckTL"); + if (prc((int)(acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart),(int)(FLim.TimeLimit*10000))) + { + TerminateJobObject(job,0); + it->res=trTL; + it->Details="Time Limit"; + break; + } + prc=(TCheckLim)GetProcAddress(lib,"CheckRTL"); + if (prc((int)(GetTickCount()-start),FLim.RealTimeLimit)) + { + TerminateJobObject(job,0); + it->res=trTL; + it->Details="Real time Limit"; + break; + } + } unsigned long len,key; HANDLE proc; @@ -674,5 +705,26 @@ } } +//------------------------------------------------------- +//-------------SECURITY CLASS---------------------------- +//------------------------------------------------------- + +TSecure::TSecure() +{ + +} + +TSecure::~TSecure() +{ + +} + +bool TSecure::RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation) +{ + if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) + return true; + return false; +} + }; Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-02 21:41:52 UTC (rev 203) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-03 15:55:38 UTC (rev 204) @@ -8,7 +8,7 @@ namespace SourceTest { - public ref struct TLimits + public ref struct TLimits { int OutputLimit; int TimeLimit; @@ -181,18 +181,35 @@ public enum TCheckAnsRes { - carAC, //accepted - carWA, //wrong answer - carIE, //internal error - carPE, //presentation error - carOE //output error + carAC=0, //accepted + carWA=1, //wrong answer + carIE=2, //internal error + carPE=3, //presentation error + carOE=4 //output error }; - typedef bool (*TCheckCL)(String^ src,String^ details); - typedef TCheckAnsRes (*TCheckAnswer)(String^ input, String^ output, String^ rightoutput); + public enum TLang + { + lCpp=0, + lPascal=1 + }; + typedef bool (*TCheckSrc)(char* src,int,char*& details); + typedef bool (*TCheckLim)(int,int); + typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput); + typedef void (*TFreeFunc)(char* buf); + public delegate void TTestHandler(int index, TResult^ res); + private class TSecure + { + private: + public: + TSecure(); + ~TSecure(); + bool RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + }; + public ref class TSource { private: @@ -200,7 +217,7 @@ String^ FExePath; String^ FProblemPath; String^ FCompPath; - String^ FTempPath; //this is the place were temp files will be created + String^ FTempPath; //this is the place where temporary files will be created bool FRunAll; TSourceState FState; TCompResult FCompResult; @@ -208,6 +225,16 @@ TSummary FSummary; TLimits FLim; TTestHandler^ FTestHandler; + TLang FLang; + TSecure *FSecurity; + HMODULE lib; //library that must export: + //bool CheckCL(char* src, int cl, char* details) - must check codelimit + //bool CheckDF(char* src, int lang, char* details) - must check DF + //bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL + //bool CheckTL(int usedtime, int timelimit) - must check TL + //int CheckAnswer(char* input, char* output, char* rightoutput) - 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 CRITICAL_SECTION* cs; //for multithreading void init() @@ -548,5 +575,37 @@ } } } + + property TLang Language + { + void set(TLang value) + { + try + { + lock(); + if (FState>=ssCheckedDF) + { + throw "Can not set Language if state is higher or equal ssCheckedDF"; + return; + } + FLang=value; + } __finally + { + unlock(); + } + } + + TLang get() + { + try + { + lock(); + return FLang; + }__finally + { + unlock(); + } + } + } }; } Modified: ACMServer/branches/sharp tester/SourceTest.sln =================================================================== --- ACMServer/branches/sharp tester/SourceTest.sln 2008-06-02 21:41:52 UTC (rev 203) +++ ACMServer/branches/sharp tester/SourceTest.sln 2008-06-03 15:55:38 UTC (rev 204) @@ -5,6 +5,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tester", "tester\tester.csproj", "{2D663DAB-3573-4CB6-95A0-2425635CFEC3}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLibrary", "TestLibrary\TestLibrary.vcproj", "{2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -35,6 +37,16 @@ {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Win32.ActiveCfg = Release|Any CPU + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Win32.ActiveCfg = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Win32.Build.0 = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Release|Any CPU.ActiveCfg = Release|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Release|Mixed Platforms.Build.0 = Release|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Release|Win32.ActiveCfg = Release|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: ACMServer/branches/sharp tester/tester/Program.cs =================================================================== --- ACMServer/branches/sharp tester/tester/Program.cs 2008-06-02 21:41:52 UTC (rev 203) +++ ACMServer/branches/sharp tester/tester/Program.cs 2008-06-03 15:55:38 UTC (rev 204) @@ -30,8 +30,8 @@ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-06-02 21:41:48
|
Revision: 203 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=203&view=rev Author: sem62 Date: 2008-06-02 14:41:52 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Fixed bug with showing compileQParts in template. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/template/global/compileQ.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-06-02 21:41:52 UTC (rev 203) @@ -83,15 +83,16 @@ template.setProperty("Caption", itemData.getCaption()); - Iterator<CompileQPart> iter = itemData.getParts().questionParts - .iterator(); + Iterator<CompileQPart> iter; + iter = itemData.getParts().questionParts.iterator(); + String answers = "\r\nsetProgrammingLanguage(\"" + itemData.getLanguge() + "\");\r\n"; while (iter.hasNext()) { CompileQPart part = iter.next(); answers += "addPart(\"" - + part.getAnswerText().replace("\"", "\\\"") + "\", " + + convertToParameter(part.getAnswerText()) + "\", " + part.getPartAttributes().isAnswer() + ", " + part.getPartAttributes().isReadOnly() + ", " + part.getPartAttributes().isVisible() + ");" + "\r\n"; @@ -101,6 +102,14 @@ template.updateResource(); } + private String convertToParameter(String answerText) { + answerText = answerText.replace("\"", "\\\""); + + answerText = answerText.replace("\n", "\\n"); + + return answerText; + } + @Override public boolean getShowSummaryPageMenuVisible() { return false; @@ -121,6 +130,6 @@ @Override public void showAnswerStatus(UserAnswerStatus answerStatus) { // TODO Auto-generated method stub - + } } \ No newline at end of file Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 21:41:52 UTC (rev 203) @@ -10,9 +10,6 @@ import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterModel; -import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; -import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureModel; -import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; import edu.lnu.FireFly.WebEditor.itemConfiguration.SummaryPageData; @@ -119,9 +116,9 @@ return ""; } - if (model.getClass() == SimpleQuestionModel.class - || model.getClass() == LectureModel.class - || model.getClass() == CompileQModel.class + if (model.getClass() != ChapterModel.class + || model.getClass() == OrganizationModel.class + || model.getClass() == SummaryPageModel.class ) { return "add(\"" + anItem.getTitle() + "\", \"" Modified: WebEditor/template/global/compileQ.js =================================================================== --- WebEditor/template/global/compileQ.js 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/template/global/compileQ.js 2008-06-02 21:41:52 UTC (rev 203) @@ -16,22 +16,36 @@ } function show(){ - for (i=0; i < parts.length; i++){ - if (parts[i].isVisible){ + for (i=0; i < parts.length; i++){ + var visible = parts[i].isVisible; + var readOnly = parts[i].isReadOnly; + var answer = parts[i].ispart; + + if (visible){ document.write("<div name='" + parts[i].id + "' id='" + parts[i].id + "'>"); - if (!parts[i].isReadOnly){ - document.write("<textarea rows='15' cols='60' id='part" + parts[i].id + "' name='part" + parts[i].id + "'>"); + if (!readOnly){ + document.write("<textarea rows='10' cols='60' id='part" + parts[i].id + "' name='part" + parts[i].id + "'>"); + } else { + if (answer){ + document.write("<pre>"); + } } + document.write(parts[i].text); - if (!parts[i].isReadOnly){ + + if (!readOnly){ document.write("</textarea>"); + } else { + if (answer){ + document.write("<pre>"); + } } document.write("<div>"); } } } -function check7Answer(frm){ +function checkAnswer(frm){ Terminate(); return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-02 21:02:20
|
Revision: 202 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=202&view=rev Author: brus07 Date: 2008-06-02 14:02:17 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Delete old element from form Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.cs Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-06-02 20:20:15 UTC (rev 201) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-06-02 21:02:17 UTC (rev 202) @@ -29,39 +29,15 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.button1 = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button4 = new System.Windows.Forms.Button(); - this.textBox3 = new System.Windows.Forms.TextBox(); - this.textBox4 = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // - // button1 - // - this.button1.Location = new System.Drawing.Point(202, 41); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 0; - this.button1.Text = "Send"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 81); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(290, 160); - this.textBox1.TabIndex = 1; - // // button2 // this.button2.Location = new System.Drawing.Point(12, 12); @@ -75,7 +51,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(199, 9); + this.label1.Location = new System.Drawing.Point(12, 76); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(23, 13); this.label1.TabIndex = 3; @@ -91,48 +67,13 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(318, 81); - this.textBox2.Multiline = true; - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(268, 160); - this.textBox2.TabIndex = 5; - // - // button4 - // - this.button4.Location = new System.Drawing.Point(12, 247); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(75, 23); - this.button4.TabIndex = 6; - this.button4.Text = "GetWeb"; - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click); - // - // textBox3 - // - this.textBox3.Location = new System.Drawing.Point(12, 276); - this.textBox3.Multiline = true; - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(574, 169); - this.textBox3.TabIndex = 7; - // - // textBox4 - // - this.textBox4.Location = new System.Drawing.Point(93, 250); - this.textBox4.Name = "textBox4"; - this.textBox4.Size = new System.Drawing.Size(493, 20); - this.textBox4.TabIndex = 8; - this.textBox4.Text = "http://acm.lviv.ua/fusion/acm/getsubmit.php?passw=master&type=GetSubmitInfo&id=35" + - "000"; - // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1}); - this.statusStrip1.Location = new System.Drawing.Point(0, 448); + this.statusStrip1.Location = new System.Drawing.Point(0, 138); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(598, 22); + this.statusStrip1.Size = new System.Drawing.Size(262, 22); this.statusStrip1.TabIndex = 9; this.statusStrip1.Text = "statusStrip1"; // @@ -151,17 +92,11 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(598, 470); + this.ClientSize = new System.Drawing.Size(262, 160); this.Controls.Add(this.statusStrip1); - this.Controls.Add(this.textBox4); - this.Controls.Add(this.textBox3); - this.Controls.Add(this.button4); - this.Controls.Add(this.textBox2); this.Controls.Add(this.button3); this.Controls.Add(this.label1); this.Controls.Add(this.button2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Gate"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); @@ -174,15 +109,9 @@ #endregion - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button3; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.Button button4; - private System.Windows.Forms.TextBox textBox3; - private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.Timer timer1; Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-02 20:20:15 UTC (rev 201) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-02 21:02:17 UTC (rev 202) @@ -14,31 +14,18 @@ { public partial class Form1 : Form { - // SocketServer socket = new SocketServer(); public Form1() { InitializeComponent(); string s = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())[0].ToString(); label1.Text += s; - //socket.onDataArrived += DataArrived; } - - private void button1_Click(object sender, EventArgs e) - { - //if (socket.CountClients() <= 0) - MessageBox.Show("Server: Bida"); - //socket.Send(textBox1.Text); - } - private void button2_Click(object sender, EventArgs e) { AcmContester.Mediator.Library.MediatorKernel kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.LoadLists(); - - //AcmContester.Mediator.Library.SocketGate sg = new AcmContester.Mediator.Library.SocketGate(); - //AcmContester.Mediator.Library.WebGate wg = new AcmContester.Mediator.Library.WebGate(); } private void button3_Click(object sender, EventArgs e) @@ -46,12 +33,6 @@ Disconnnect(); } - private void DataArrived(string message) - { - textBox2.Text += "\r\n" + message; - //TODO: doOther - } - private void Disconnnect() { AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); @@ -64,31 +45,6 @@ Disconnnect(); } - private void button4_Click(object sender, EventArgs e) - { - //AcmContester.Mediator.Library.Data.DataMediator d = AcmContester.Mediator.Library.Data.DataMediator.GetMediator(); - //d.DeleteOld(); - - TcpClient tcpClient = new TcpClient(); - tcpClient.Connect(textBox4.Text, 80); - NetworkStream netStream = tcpClient.GetStream(); - if (netStream.CanRead) - { - // Reads NetworkStream into a byte buffer. - byte[] bytes = new byte[tcpClient.ReceiveBufferSize]; - - // Read can return anything from 0 to numBytesToRead. - // This method blocks until at least one byte is read. - netStream.Read(bytes, 0, (int)tcpClient.ReceiveBufferSize); - - // Returns the data received from the host to the console. - string returndata = Encoding.UTF8.GetString(bytes); - - textBox3.Text = returndata; - - } - } - private void timer1_Tick(object sender, EventArgs e) { string mes = "CountOfClients: "; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-02 20:20:18
|
Revision: 201 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=201&view=rev Author: brus07 Date: 2008-06-02 13:20:15 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Added new branches LoadFromDll for LoadFromDll task Added Paths: ----------- ACMServer/branches/LoadFromDll/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-06-02 19:43:11
|
Revision: 200 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=200&view=rev Author: sem62 Date: 2008-06-02 12:42:49 -0700 (Mon, 02 Jun 2008) Log Message: ----------- * Fixed bug with removing unknown model item. Code moved to ItemModel. For ChapterModel need individual remove metod. * Some code refactorings (moved UnknownUserStatus to another package). Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersManager.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/UnknownModelAnswerStatus.java Removed Paths: ------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java Added: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersManager.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersManager.java 2008-06-02 19:42:49 UTC (rev 200) @@ -0,0 +1,89 @@ +package edu.lnu.FireFly.WebEditor.Data; + +import java.io.StringReader; +import java.util.Iterator; + +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import edu.lnu.FireFly.FFManifest.Manifest; +import edu.lnu.FireFly.FFManifest.item.Item; +import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; + +public class AnswersManager { + + private Document answers = null; + private Manifest manifest = null; + + private AnswersManager() { + } + + private static AnswersManager obj = null; + + public static AnswersManager getInstance() { + if (obj == null) { + obj = new AnswersManager(); + } + + return obj; + } + + /** + * update all answer items in answer.xml document. + * Modifying only items, that was created with this tool. + */ + private void updateAllOurAnswerItems(){ + + } + + @SuppressWarnings("unchecked") + private void deleteAnswersForNotExistingItems(){ + Element organization = answers.getRootElement().element("organization"); + + // FIXME need tested loop for working properly. + for (Iterator<Element> it = organization.elementIterator("item"); it.hasNext(); ){ + Element itemElement = it.next(); + String id = itemElement.attributeValue("id"); + + Item item = (Item)manifest.findItemByIdentifier(id); + + if (item == null){ + it.remove(); + } + } + } + + public void update(){ + deleteAnswersForNotExistingItems(); + updateAllOurAnswerItems(); + } + + public void load() { + String xml = WebEditorServiceClient.getInstance().getFileContent( + "answers.xml", "course"); + + try { + SAXReader reader = new SAXReader(); + answers = reader.read(new StringReader(xml)); + } catch (Exception e) { + e.printStackTrace(); + return; + } + } + + + + public void save() { + WebEditorServiceClient.getInstance().setFileContent("answers.xml", + answers.asXML()); + } + + public Manifest getManifest() { + return manifest; + } + + public void setManifest(Manifest manifest) { + this.manifest = manifest; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -1,8 +1,6 @@ package edu.lnu.FireFly.WebEditor.ItemModels.Chapter; import edu.lnu.FireFly.FFManifest.TreeItem; -import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; -import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.ChapterPropertiestsDlg; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; @@ -148,10 +146,7 @@ model.remove(item); } - TreeDataModel.getInstance().treeNodesDeleted(aChapter); - aChapter.getParent().removeChild(aChapter); - - SummaryPageManager.getInstance().updateSummaryPages(); + super.remove(aChapter); } public void setShowSummaryPage(TreeItem anItem, boolean state) { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -6,22 +6,26 @@ import java.net.URL; import java.util.UUID; +import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.Organization; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.item.sequencing.Sequencing; import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.MapInfo; import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objectives; +import edu.lnu.FireFly.FFManifest.parser.TestDocException; import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.Rte.Cmi; import edu.lnu.FireFly.Rte.CmiManager; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.Data.AnswersStatusManager; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; +import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; @@ -164,8 +168,77 @@ public abstract boolean isRemovable(); - public abstract void remove(TreeItem anItem); + public void remove(TreeItem anItem){ + TreeDataModel.getInstance().treeNodesDeleted(anItem); + anItem.getParent().removeChild(anItem); + deleteResource(anItem); + + SummaryPageManager.getInstance().updateSummaryPages(); + } + + /** + * Determine that we can delete resource, that mapped to item, + * or not. + * + * It goes about all manifest tree, and if exists at least one + * another item that using the same resource - it return false; + * + * @param anItem Item which resource we want to know that we can + * remove it or not. + * + * @return <b>true</b> if resource not have any more links and we + * can delete it and <b>false</b> if it haven't more links and we can delete it. + */ + private boolean canDeleteResource(TreeItem anItem) { + Manifest manifest = SummaryPageManager.getInstance().getManifest(); + + TreeItem root = null; + try { + root = manifest.getRoot(); + } catch (TestDocException e) { + e.printStackTrace(); + } + + return !isSubTreeUsingResource(root, getIdentifier(anItem), anItem); + } + + private boolean isSubTreeUsingResource(TreeItem root, String identifierref, + TreeItem exceptItem) { + if (root != exceptItem) { + if (getIdentifierRef(root).equals(identifierref)) { + return true; + } + } + + for (int i = 0; i < root.getChildCount(); i++) { + TreeItem newRoot = root.getChild(i); + + if (isSubTreeUsingResource(newRoot, identifierref, exceptItem)) { + return true; + } + } + + return false; + } + + private void deleteResource(TreeItem anItem) { + if (canDeleteResource(anItem)) { + Manifest manifest = SummaryPageManager.getInstance().getManifest(); + + String identifier = getIdentifierRef(anItem); + Resource resource = manifest.resources + .findResourceByIdentifier(identifier); + + WebEditorServiceClient.getInstance().deleteFile( + resource.getFullHref()); + + manifest.resources.deleteResource(identifier); + + SummaryPageManager.getInstance().updateSummaryPages(); + } + } + public void rename(TreeItem item, String newTitle) { ((Item) item).title = newTitle; TreeDataModel.getInstance().treeNodesChanged(item); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -2,14 +2,10 @@ import java.util.UUID; -import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; -import edu.lnu.FireFly.FFManifest.parser.TestDocException; -import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; -import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; @@ -52,65 +48,6 @@ } @Override - public void remove(TreeItem anItem) { - TreeDataModel.getInstance().treeNodesDeleted(anItem); - anItem.getParent().removeChild(anItem); - - deleteResource(anItem); - } - - private void deleteResource(TreeItem anItem) { - if (canDeleteResource(anItem)) { - Manifest manifest = SummaryPageManager.getInstance().getManifest(); - - String identifier = getIdentifierRef(anItem); - Resource resource = manifest.resources - .findResourceByIdentifier(identifier); - - WebEditorServiceClient.getInstance().deleteFile( - resource.getFullHref()); - - manifest.resources.deleteResource(identifier); - - SummaryPageManager.getInstance().updateSummaryPages(); - } - } - - private boolean isSubTreeUsingResource(TreeItem root, String identifierref, - TreeItem exceptItem) { - if (root != exceptItem) { - if (getIdentifierRef(root).equals(identifierref)) { - return true; - } - } - - for (int i = 0; i < root.getChildCount(); i++) { - TreeItem newRoot = root.getChild(i); - - if (isSubTreeUsingResource(newRoot, identifierref, exceptItem)) { - return true; - } - } - - return false; - } - - private boolean canDeleteResource(TreeItem anItem) { - // TODO need check links to resource from other items in course tree. - - Manifest manifest = SummaryPageManager.getInstance().getManifest(); - - TreeItem root = null; - try { - root = manifest.getRoot(); - } catch (TestDocException e) { - e.printStackTrace(); - } - - return !isSubTreeUsingResource(root, getIdentifier(anItem), anItem); - } - - @Override protected final void initializeDataForItem(Item anItem) { ItemData itemData = createItemDataInstance(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -10,6 +10,7 @@ import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterModel; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureModel; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; @@ -119,7 +120,9 @@ } if (model.getClass() == SimpleQuestionModel.class - || model.getClass() == LectureModel.class) { + || model.getClass() == LectureModel.class + || model.getClass() == CompileQModel.class + ) { return "add(\"" + anItem.getTitle() + "\", \"" + model.getModelName() + "\", \"" Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -1,107 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels; - -import edu.lnu.FireFly.FFManifest.TreeItem; -import edu.lnu.FireFly.FFManifest.item.Item; -import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; -import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; -import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; - -public class UnknownItemModel extends ItemModel { - - @Override - public double getAnswerRawScore(TreeItem anItem, String[] userAnswers) { - return 0; - } - - @Override - public void showAnswerStatus(UserAnswerStatus answerStatus) { - } - - @Override - public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { - return new UnknownModelAnswerStatus(anItem); - } - - @Override - public void addItem(TreeItem parent) { - System.out - .println("Can't doing this operation with unknown item model"); - } - - @Override - public boolean canAddToItem(TreeItem parent) { - return false; - } - - @Override - public boolean canConvertItem(TreeItem parent) { - return false; - } - - @Override - protected ItemData createItemDataInstance() { - System.out - .println("Can't doing this operation with unknown item model"); - return null; - } - - @Override - protected String getDefaultTitle() { - return "Unknown"; - } - - @Override - public boolean getLimitConditionsMenuVisible(TreeItem anItem) { - return anItem.getChildCount() == 0; - } - - @Override - public boolean getShowOnSummaryPageMenuVisible() { - return false; - } - - @Override - public boolean getShowSummaryPageMenuVisible() { - return false; - } - - @Override - protected void initializeDataForItem(Item anItem) { - System.out - .println("Can't doing this operation with unknown item model"); - } - - @Override - public boolean isRemovable() { - return true; - } - - @Override - public void remove(TreeItem anItem) { - anItem.getParent().removeChild(anItem); - TreeDataModel.getInstance().treeNodesDeleted(anItem); - } - -// @Override -// public boolean synchronizeItemWithResource(TreeItem anItem, String location) { -// return false; -// } - - @Override - public boolean updateItemResource(TreeItem item, boolean updateSummaryPages) { - return false; - } - - @Override - public double getAnswerMaxScore(TreeItem item) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getAnswerMinScore(TreeItem item) { - // TODO Auto-generated method stub - return 0; - } - -} Added: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-06-02 19:42:49 UTC (rev 200) @@ -0,0 +1,96 @@ +package edu.lnu.FireFly.WebEditor.ItemModels; + +import edu.lnu.FireFly.FFManifest.TreeItem; +import edu.lnu.FireFly.FFManifest.item.Item; +import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UnknownModelAnswerStatus; +import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; + +public class UnknownItemModel extends ItemModel { + + @Override + public double getAnswerRawScore(TreeItem anItem, String[] userAnswers) { + return 0; + } + + @Override + public void showAnswerStatus(UserAnswerStatus answerStatus) { + } + + @Override + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + return new UnknownModelAnswerStatus(anItem); + } + + @Override + public void addItem(TreeItem parent) { + System.out + .println("Can't doing this operation with unknown item model"); + } + + @Override + public boolean canAddToItem(TreeItem parent) { + return false; + } + + @Override + public boolean canConvertItem(TreeItem parent) { + return false; + } + + @Override + protected ItemData createItemDataInstance() { + System.out + .println("Can't doing this operation with unknown item model"); + return null; + } + + @Override + protected String getDefaultTitle() { + return "Unknown"; + } + + @Override + public boolean getLimitConditionsMenuVisible(TreeItem anItem) { + return anItem.getChildCount() == 0; + } + + @Override + public boolean getShowOnSummaryPageMenuVisible() { + return false; + } + + @Override + public boolean getShowSummaryPageMenuVisible() { + return false; + } + + @Override + protected void initializeDataForItem(Item anItem) { + System.out + .println("Can't doing this operation with unknown item model"); + } + + @Override + public boolean isRemovable() { + return true; + } + + @Override + public boolean updateItemResource(TreeItem item, boolean updateSummaryPages) { + return false; + } + + @Override + public double getAnswerMaxScore(TreeItem item) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public double getAnswerMinScore(TreeItem item) { + // TODO Auto-generated method stub + return 0; + } + +} Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java 2008-06-02 13:33:19 UTC (rev 199) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java 2008-06-02 19:42:49 UTC (rev 200) @@ -1,28 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels; - -import edu.lnu.FireFly.FFManifest.TreeItem; -import edu.lnu.FireFly.Rte.Cmi; -import edu.lnu.FireFly.Rte.ElementName; -import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; - -public class UnknownModelAnswerStatus extends UserAnswerStatus { - - public UnknownModelAnswerStatus(TreeItem anItem) { - super(anItem); - } - - @Override - public void updateRteFields(Cmi cmi) { - int interaction = 0; - String cmiElement = "interactions." + interaction + ".learner_response"; - - cmi.setValue(new ElementName(cmiElement), "{" - + Utils.getInstance().marge(getRawAnswer(), ",") + "}"); - } - - @Override - protected void updateValues() { - // TODO Auto-generated method stub - - } -} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/UnknownModelAnswerStatus.java (from rev 177, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/UnknownModelAnswerStatus.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/UnknownModelAnswerStatus.java 2008-06-02 19:42:49 UTC (rev 200) @@ -0,0 +1,28 @@ +package edu.lnu.FireFly.WebEditor.UserAnswerStatus; + +import edu.lnu.FireFly.FFManifest.TreeItem; +import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.ElementName; +import edu.lnu.FireFly.WebEditor.ItemModels.Utils; + +public class UnknownModelAnswerStatus extends UserAnswerStatus { + + public UnknownModelAnswerStatus(TreeItem anItem) { + super(anItem); + } + + @Override + public void updateRteFields(Cmi cmi) { + int interaction = 0; + String cmiElement = "interactions." + interaction + ".learner_response"; + + cmi.setValue(new ElementName(cmiElement), "{" + + Utils.getInstance().marge(getRawAnswer(), ",") + "}"); + } + + @Override + protected void updateValues() { + // TODO Auto-generated method stub + + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-02 13:33:17
|
Revision: 199 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=199&view=rev Author: brus07 Date: 2008-06-02 06:33:19 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Fixed bug with close form Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/SocketClient.cs ACMServer/trunk/MediatorSolution/Library/Connector/SocketServer.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs ACMServer/trunk/TesterSolution/Library/Connector/SocketClient.cs ACMServer/trunk/TesterSolution/Library/Connector/SocketServer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/SocketClient.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/MediatorSolution/Library/Connector/SocketClient.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -10,17 +10,25 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; + string ip = "127.0.0.1"; + int port = 4120; + public SocketClient() { } public SocketClient(string IP) { - client = new EasyClient(new ServerInfo(IP, 4120, true)); + this.ip = IP; + client = new EasyClient(new ServerInfo(this.ip, this.port, true)); client.DataArrived += DataArrived; } public void Connect() { + if (client == null) + { + client = new EasyClient(new ServerInfo(this.ip, this.port, true)); + } if (client.IsConnected == false) client.ConnectToServerAsync(); } @@ -28,6 +36,8 @@ { if (client.IsConnected == true) client.DisconnectFromServer(); + client.Dispose(); + client = null; } public void Send(string message) { @@ -42,6 +52,8 @@ } public bool IsConnected() { + if (client == null) + return false; return client.IsConnected; } } Modified: ACMServer/trunk/MediatorSolution/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/SocketServer.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/MediatorSolution/Library/Connector/SocketServer.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -5,8 +5,10 @@ { public class SocketServer { - EasyServer server = new EasyServer(4120,true); + int port = 4120; + EasyServer server; + public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; @@ -14,16 +16,24 @@ public SocketServer() { + server = new EasyServer(port, true); server.DataArrived += new DataArrived2Server_EventHandler(DataArrived); } public void Start() { + if (server == null) + server = new EasyServer(port, true); server.StartListen(); } public void Stop() { - server.StopListen(); + if (server != null) + { + server.StopListen(); + server.Dispose(); + server = null; + } } private void DataArrived(object Data, SocketStream DataSender) Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -43,7 +43,7 @@ private void button3_Click(object sender, EventArgs e) { - // socket.Stop(); + Disconnnect(); } private void DataArrived(string message) @@ -52,9 +52,16 @@ //TODO: doOther } + private void Disconnnect() + { + AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); + SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); + b2.Stop(); + } + private void Form1_FormClosing(object sender, FormClosingEventArgs e) { - // socket.Stop(); + Disconnnect(); } private void button4_Click(object sender, EventArgs e) Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -40,7 +40,16 @@ internal int CountClients() { + if (server == null) + return 0; return server.CountClients(); } + + internal void Stop() + { + if (server != null) + server.Stop(); + server = null; + } } } Modified: ACMServer/trunk/TesterSolution/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/TesterSolution/Library/Connector/SocketClient.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/TesterSolution/Library/Connector/SocketClient.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -10,17 +10,25 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; + string ip = "127.0.0.1"; + int port = 4120; + public SocketClient() { } public SocketClient(string IP) { - client = new EasyClient(new ServerInfo(IP, 4120, true)); + this.ip = IP; + client = new EasyClient(new ServerInfo(this.ip, this.port, true)); client.DataArrived += DataArrived; } public void Connect() { + if (client == null) + { + client = new EasyClient(new ServerInfo(this.ip, this.port, true)); + } if (client.IsConnected == false) client.ConnectToServerAsync(); } @@ -28,6 +36,8 @@ { if (client.IsConnected == true) client.DisconnectFromServer(); + client.Dispose(); + client = null; } public void Send(string message) { @@ -42,6 +52,8 @@ } public bool IsConnected() { + if (client == null) + return false; return client.IsConnected; } } Modified: ACMServer/trunk/TesterSolution/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Library/Connector/SocketServer.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/TesterSolution/Library/Connector/SocketServer.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -5,8 +5,10 @@ { public class SocketServer { - EasyServer server = new EasyServer(4120,true); + int port = 4120; + EasyServer server; + public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; @@ -14,16 +16,24 @@ public SocketServer() { + server = new EasyServer(port, true); server.DataArrived += new DataArrived2Server_EventHandler(DataArrived); } public void Start() { + if (server == null) + server = new EasyServer(port, true); server.StartListen(); } public void Stop() { - server.StopListen(); + if (server != null) + { + server.StopListen(); + server.Dispose(); + server = null; + } } private void DataArrived(object Data, SocketStream DataSender) Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-02 12:05:01 UTC (rev 198) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-02 13:33:19 UTC (rev 199) @@ -29,9 +29,19 @@ private void button2_Click(object sender, EventArgs e) { - socket.Disconnect(); + Disconnect(); } + private void Disconnect() + { + if (socket != null) + { + if (socket.IsConnected() == true) + socket.Disconnect(); + socket = null; + } + } + private void button3_Click(object sender, EventArgs e) { if (socket.IsConnected() == false) @@ -47,9 +57,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e) { - if (socket != null) - if (socket.IsConnected() == true) - socket.Disconnect(); + Disconnect(); } private void timer1_Tick(object sender, EventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-02 12:05:05
|
Revision: 198 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=198&view=rev Author: brus07 Date: 2008-06-02 05:05:01 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Update protocol version Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs ACMServer/trunk/TesterSolution/Checker/Class1.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-02 10:56:22 UTC (rev 197) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-02 12:05:01 UTC (rev 198) @@ -45,7 +45,9 @@ void Send2(string message) { - HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + message); + string res = (message.Split(' '))[0]; + string id = (message.Split(' '))[1]; + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; myRequest.GetResponse(); /* Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-02 10:56:22 UTC (rev 197) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-02 12:05:01 UTC (rev 198) @@ -6,12 +6,19 @@ class Result { Xml data; + Submit submit; + string temp; + public Result(string message) { //TODO - submit = new Submit(message); + string[] messages = message.Split(' '); + if (messages.Length != 3) + throw new Exception("Result.Result: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); + temp = messages[0]; + submit = new Submit(messages[1] + " " + messages[2]); } public Submit Submit @@ -25,7 +32,7 @@ public override string ToString() { //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML - return submit.ToString(); + return temp; } } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-02 10:56:22 UTC (rev 197) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-02 12:05:01 UTC (rev 198) @@ -7,12 +7,17 @@ { Xml data; + int id; string temp; public Submit(string message) { //TODO - temp = message; + string[] messages = message.Split(' '); + if (messages.Length != 2) + throw new Exception("Submit.Submit: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); + id = Convert.ToInt32(messages[0]); + temp = messages[1]; } //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML @@ -24,13 +29,14 @@ public override int GetHashCode() { //HACK: + /* int result = 0; for (int i = 0; i < temp.Length; i++) { result *= 991; result += (int)temp[i]; - } - return result; + }*/ + return id; } } } Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-02 10:56:22 UTC (rev 197) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-02 12:05:01 UTC (rev 198) @@ -8,6 +8,7 @@ { public static int GetResult(string code) { + code = (code.Split(' '))[1]; int res = 0; for (int i = 0; i < code.Length; i++) { Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-02 10:56:22 UTC (rev 197) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-02 12:05:01 UTC (rev 198) @@ -42,7 +42,7 @@ { textBox1.Text += "\r\n" + message; int result = Checker.Checker.GetResult(message); - socket.Send(result.ToString()); + socket.Send(result.ToString() + " " + message); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-02 10:56:19
|
Revision: 197 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=197&view=rev Author: brus07 Date: 2008-06-02 03:56:22 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Work with real site. It's test mode. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-01 23:03:03 UTC (rev 196) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-02 10:56:22 UTC (rev 197) @@ -1,6 +1,8 @@ using System; using System.Threading; using System.Windows.Forms; +using System.Net; +using System.IO; namespace AcmContester.Library.Connector.Getter { @@ -8,6 +10,16 @@ { public void Send(string message) { + Send2(message); + } + + public object GetInfoFromSite() + { + return GetInfoFromSite2(); + } + + void Send1(string message) + { WebBrowser webBrowser = new WebBrowser(); webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); webBrowser.Navigate("http://127.0.0.1/d/a.php?p=321"); @@ -16,7 +28,7 @@ Mutex mut = new Mutex(); string document = ""; - public object GetInfoFromSite() + object GetInfoFromSite1() { WebBrowser webBrowser = new WebBrowser(); webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); @@ -30,5 +42,30 @@ document = ((WebBrowser)sender).DocumentText; mut.ReleaseMutex(); } + + void Send2(string message) + { + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + message); + myRequest.Method = "GET"; + myRequest.GetResponse(); + /* + WebResponse myResponse = myRequest.GetResponse(); + StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); + string result = sr.ReadToEnd(); + sr.Close(); + myResponse.Close(); + */ + } + string GetInfoFromSite2() + { + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/get.php"); + myRequest.Method = "GET"; + WebResponse myResponse = myRequest.GetResponse(); + StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); + string result = sr.ReadToEnd(); + sr.Close(); + myResponse.Close(); + return result; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-01 23:02:59
|
Revision: 196 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=196&view=rev Author: brus07 Date: 2008-06-01 16:03:03 -0700 (Sun, 01 Jun 2008) Log Message: ----------- Rename interface to IGetter Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs Added Paths: ----------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IGetter.cs Removed Paths: ------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-01 22:59:03 UTC (rev 195) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-01 23:03:03 UTC (rev 196) @@ -39,7 +39,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Getter\FileGetter.cs" /> - <Compile Include="Getter\IWebGetter.cs" /> + <Compile Include="Getter\IGetter.cs" /> <Compile Include="Getter\WebGetter.cs" /> <Compile Include="SocketClient.cs" /> <Compile Include="SocketServer.cs" /> Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs 2008-06-01 22:59:03 UTC (rev 195) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs 2008-06-01 23:03:03 UTC (rev 196) @@ -2,7 +2,7 @@ namespace AcmContester.Library.Connector.Getter { - class FileGetter: IWebGetter + class FileGetter: IGetter { public object GetInfoFromSite() { Copied: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IGetter.cs (from rev 195, ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs) =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IGetter.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IGetter.cs 2008-06-01 23:03:03 UTC (rev 196) @@ -0,0 +1,9 @@ + +namespace AcmContester.Library.Connector.Getter +{ + interface IGetter + { + object GetInfoFromSite(); + void Send(string message); + } +} Deleted: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs 2008-06-01 22:59:03 UTC (rev 195) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs 2008-06-01 23:03:03 UTC (rev 196) @@ -1,10 +0,0 @@ -using System; - -namespace AcmContester.Library.Connector.Getter -{ - interface IWebGetter - { - object GetInfoFromSite(); - void Send(string message); - } -} Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-01 22:59:03 UTC (rev 195) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-01 23:03:03 UTC (rev 196) @@ -4,7 +4,7 @@ namespace AcmContester.Library.Connector.Getter { - class WebGetter: IWebGetter + class WebGetter: IGetter { public void Send(string message) { Modified: ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-06-01 22:59:03 UTC (rev 195) +++ ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-06-01 23:03:03 UTC (rev 196) @@ -11,7 +11,7 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; - private IWebGetter getter = new WebGetter(); + private IGetter getter = new WebGetter(); public WebConnector() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-01 22:58:58
|
Revision: 195 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=195&view=rev Author: brus07 Date: 2008-06-01 15:59:03 -0700 (Sun, 01 Jun 2008) Log Message: ----------- Added interface for Getter. For get information from web. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs Added Paths: ----------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-01 12:03:25 UTC (rev 194) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-01 22:59:03 UTC (rev 195) @@ -34,9 +34,13 @@ </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Getter\FileGetter.cs" /> + <Compile Include="Getter\IWebGetter.cs" /> + <Compile Include="Getter\WebGetter.cs" /> <Compile Include="SocketClient.cs" /> <Compile Include="SocketServer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> Added: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/FileGetter.cs 2008-06-01 22:59:03 UTC (rev 195) @@ -0,0 +1,41 @@ +using System; + +namespace AcmContester.Library.Connector.Getter +{ + class FileGetter: IWebGetter + { + public object GetInfoFromSite() + { + try + { + string res = ""; + using (System.IO.StreamReader sr = new System.IO.StreamReader("a.txt")) + { + res = sr.ReadToEnd(); + } + if (res.Length == 0) + return null; + return res; + } + catch (Exception) + { + } + return null; + } + + public void Send(string message) + { + try + { + using (System.IO.StreamWriter sr = new System.IO.StreamWriter("b.txt", true)) + { + sr.WriteLine(DateTime.Now.ToLongTimeString() + ": " + message); + } + } + catch (Exception) + { + } + //TODO: + } + } +} Added: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/IWebGetter.cs 2008-06-01 22:59:03 UTC (rev 195) @@ -0,0 +1,10 @@ +using System; + +namespace AcmContester.Library.Connector.Getter +{ + interface IWebGetter + { + object GetInfoFromSite(); + void Send(string message); + } +} Added: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-01 22:59:03 UTC (rev 195) @@ -0,0 +1,34 @@ +using System; +using System.Threading; +using System.Windows.Forms; + +namespace AcmContester.Library.Connector.Getter +{ + class WebGetter: IWebGetter + { + public void Send(string message) + { + WebBrowser webBrowser = new WebBrowser(); + webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); + webBrowser.Navigate("http://127.0.0.1/d/a.php?p=321"); + } + + + Mutex mut = new Mutex(); + string document = ""; + public object GetInfoFromSite() + { + WebBrowser webBrowser = new WebBrowser(); + webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); + webBrowser.Navigate("http://127.0.0.1/d/a.php?p=321"); + mut.WaitOne(); + return document; + } + + void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) + { + document = ((WebBrowser)sender).DocumentText; + mut.ReleaseMutex(); + } + } +} Modified: ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-06-01 12:03:25 UTC (rev 194) +++ ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-06-01 22:59:03 UTC (rev 195) @@ -1,5 +1,6 @@ using System; using System.Timers; +using AcmContester.Library.Connector.Getter; namespace AcmContester.Library.Connector { @@ -10,6 +11,8 @@ public delegate void DataArrivedDelegate(string s); public event DataArrivedDelegate onDataArrived; + private IWebGetter getter = new WebGetter(); + public WebConnector() { timer.Interval = 10 * 1000; @@ -22,7 +25,7 @@ private void OnTimedEvent(object source, ElapsedEventArgs e) { timer.Enabled = false; - object ob = GetInfoFromSite(); + object ob = getter.GetInfoFromSite(); if (ob != null) { DataArrived(ob); @@ -38,38 +41,9 @@ } } - private object GetInfoFromSite() - { - try - { - string res = ""; - using (System.IO.StreamReader sr = new System.IO.StreamReader("a.txt")) - { - res = sr.ReadToEnd(); - } - if (res.Length == 0) - return null; - return res; - } - catch(Exception) - { - } - return null; - } - public void Send(string message) { - try - { - using (System.IO.StreamWriter sr = new System.IO.StreamWriter("b.txt", true)) - { - sr.WriteLine(DateTime.Now.ToLongTimeString() + ": " + message); - } - } - catch (Exception) - { - } - //TODO: + getter.Send(message); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-01 12:03:17
|
Revision: 194 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=194&view=rev Author: brus07 Date: 2008-06-01 05:03:25 -0700 (Sun, 01 Jun 2008) Log Message: ----------- Deleted empty Connector folder Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj Modified: ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-06-01 11:16:18 UTC (rev 193) +++ ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-06-01 12:03:25 UTC (rev 194) @@ -87,9 +87,6 @@ <Name>LibraryExtention</Name> </ProjectReference> </ItemGroup> - <ItemGroup> - <Folder Include="Library\Connector\" /> - </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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-01 11:16:16
|
Revision: 193 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=193&view=rev Author: brus07 Date: 2008-06-01 04:16:18 -0700 (Sun, 01 Jun 2008) Log Message: ----------- Added DataContainer (DataMediator) to SocketServerPlugin Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/DataMediator.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj Removed Paths: ------------- ACMServer/trunk/MediatorSolution/Mediator/Library/Connector/ ACMServer/trunk/MediatorSolution/Mediator/Library/SocketGate.cs ACMServer/trunk/MediatorSolution/Mediator/Library/WebGate.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Library/Connector/WebConnector.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -63,7 +63,7 @@ { using (System.IO.StreamWriter sr = new System.IO.StreamWriter("b.txt", true)) { - sr.WriteLine(message); + sr.WriteLine(DateTime.Now.ToLongTimeString() + ": " + message); } } catch (Exception) Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -59,7 +59,7 @@ private void button4_Click(object sender, EventArgs e) { - AcmContester.Mediator.Library.Data.DataMediator d = AcmContester.Mediator.Library.Data.DataMediator.GetMediator(); + //AcmContester.Mediator.Library.Data.DataMediator d = AcmContester.Mediator.Library.Data.DataMediator.GetMediator(); //d.DeleteOld(); TcpClient tcpClient = new TcpClient(); Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/DataMediator.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/DataMediator.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/DataMediator.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -4,26 +4,12 @@ namespace AcmContester.Mediator.Library.Data { - /// <summary> - /// Pattern: Singleton - /// </summary> class DataMediator { - static DataMediator instance = new DataMediator(); - const int secondToLive = 60; Dictionary<int, DateTime> d = new Dictionary<int, DateTime>(); - private DataMediator() - { - } - - public static DataMediator GetMediator() - { - return instance; - } - /// <summary> /// \xDF\xEA\xF9\xEE \xF1\xE0\xE1\xEC\xB3\xF2 \xF3 \xF7\xE5\xF0\xE7\xB3 \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xFC\xF1\xFF \xE1\xB3\xEB\xFC\xF8\xE5 \xED\xB3\xE6 secondToLive \xF1\xE5\xEA\xF3\xED\xE4, \xF2\xEE \xE2\xB3\xED \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xE8\xE4\xE0\xEB\xFF\xBA\xF2\xFC\xF1\xFF \xE7 \xED\xE5\xBF /// </summary> @@ -34,7 +20,7 @@ foreach(KeyValuePair<int,DateTime> elem in d) { TimeSpan ts = now - elem.Value; - if (ts.Seconds > secondToLive) + if (ts.TotalSeconds > secondToLive) { keysToDelete.Add(elem.Key); } @@ -50,36 +36,24 @@ return d.ContainsKey(id); } - public void Add(Submit data) + public bool Add(Submit data) { + DeleteOld(); if (Contains(data.GetHashCode()) == false) { d.Add(data.GetHashCode(), DateTime.Now); - SendToTester(data); + return true; } - DeleteOld(); + return false; } public void Return(Result data) { + DeleteOld(); if (Contains(data.Submit.GetHashCode()) == true) { d.Remove(data.Submit.GetHashCode()); } - SendToWeb(data); - DeleteOld(); } - - private void SendToTester(Submit data) - { - SocketGate gate = new SocketGate(); - gate.SendToClient(data); - } - - private void SendToWeb(Result data) - { - WebGate gate = new WebGate(); - gate.SendToWeb(data); - } } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -9,7 +9,7 @@ public abstract void Send(string message); - protected void DataArrived(string message) + protected virtual void DataArrived(string message) { if (onDataArrived != null) onDataArrived(message); Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -1,14 +1,19 @@ using System; using AcmContester.Mediator.Library.Plugins; using AcmContester.Library.Connector; +using AcmContester.Mediator.Library.Data; namespace AcmContester.Mediator.Library.Plugins.SocketGate { + /// <summary> + /// Pattern: Singleton + /// </summary> class SocketServerPlugin : BaseMediatorPlugin { private static SocketServerPlugin instance = new SocketServerPlugin(); private SocketServer server = new SocketServer(); + private DataMediator dataContainer = new DataMediator(); private SocketServerPlugin() { @@ -23,9 +28,16 @@ public override void Send(string message) { - server.Send(message); + if (dataContainer.Add(new Submit(message))) + server.Send(message); } + protected override void DataArrived(string message) + { + dataContainer.Return(new Result(message)); + base.DataArrived(message); + } + internal int CountClients() { return server.CountClients(); Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -4,6 +4,9 @@ namespace AcmContester.Mediator.Library.Plugins.WebGate { + /// <summary> + /// Pattern: Singleton + /// </summary> class WebGatePlugin: BaseMediatorPlugin { private static WebGatePlugin instance = new WebGatePlugin(); Deleted: ACMServer/trunk/MediatorSolution/Mediator/Library/SocketGate.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/SocketGate.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/SocketGate.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -1,31 +0,0 @@ -using System; -using AcmContester.Library.Connector; -using AcmContester.AcmLibraryExtention; -using AcmContester.Mediator.Library.Data; -using AcmContester.Mediator.Library.Connector; - -namespace AcmContester.Mediator.Library -{ - class SocketGate - { - SocketServerSingleton server = SocketServerSingleton.GetServer(); - - DataMediator mediator = DataMediator.GetMediator(); - - public SocketGate() - { - server.onDataArrived += DataArrived; - } - - public void SendToClient(Submit data) - { - server.Send(data.ToString()); - } - - private void DataArrived(string message) - { - //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE7\xF0\xEE\xE1\xE8\xF2\xE8 \xEF\xE5\xF0\xE5\xE2\xB3\xF0\xEA\xF3 \xF9\xEE \xF1\xE0\xEC\xE5 \xEF\xF0\xE8\xE9\xEC\xE0\xBA\xF2\xFC\xF1\xFF \xE2\xB3\xE4 Socket'\xE0, \xE1\xEE \xEC\xEE\xE6\xE5 \xE1\xF3\xF2\xE8 \xED\xE5 \xF2\xB3\xEB\xFC\xEA\xE8 Result - mediator.Return(new Result(message)); - } - } -} Deleted: ACMServer/trunk/MediatorSolution/Mediator/Library/WebGate.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/WebGate.cs 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/WebGate.cs 2008-06-01 11:16:18 UTC (rev 193) @@ -1,29 +0,0 @@ -using System; -using AcmContester.Mediator.Library.Data; -using AcmContester.Mediator.Library.Connector; - -namespace AcmContester.Mediator.Library -{ - class WebGate - { - WebConnectorSingleton webConnector = WebConnectorSingleton.GetWebConnector(); - - DataMediator mediator = DataMediator.GetMediator(); - - public WebGate() - { - webConnector.onDataArrived += DataArrived; - } - - public void SendToWeb(Result data) - { - webConnector.Send(data.ToString()); - } - - private void DataArrived(string message) - { - //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE7\xF0\xEE\xE1\xE8\xF2\xE8 \xEF\xE5\xF0\xE5\xE2\xB3\xF0\xEA\xF3 \xF9\xEE \xF1\xE0\xEC\xE5 \xEF\xF0\xE8\xE9\xEC\xE0\xBA\xF2\xFC\xF1\xFF \xE2\xB3\xE4 Web'\xE0, \xE1\xEE \xEC\xEE\xE6\xE5 \xE1\xF3\xF2\xE8 \xED\xE5 \xF2\xB3\xEB\xFC\xEA\xE8 Submit. \xD2\xE0\xEA\xEE\xE6 \xEC\xEE\xE6\xE5 \xE1\xF3\xF2\xE8 \xE4\xE5\xEA\xB3\xEB\xFC\xEA\xE0 Submit'\xB3\xE2 - mediator.Add(new Submit(message)); - } - } -} Modified: ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-05-31 14:05:42 UTC (rev 192) +++ ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-06-01 11:16:18 UTC (rev 193) @@ -42,8 +42,6 @@ <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> - <Compile Include="Library\Connector\SocketServerSingleton.cs" /> - <Compile Include="Library\Connector\WebConnectorSignleton.cs" /> <Compile Include="Library\Data\DataMediator.cs" /> <Compile Include="Library\Data\Result.cs" /> <Compile Include="Library\Data\Submit.cs" /> @@ -53,8 +51,6 @@ <Compile Include="Library\Plugins\SocketGate\SocketServerPlugin.cs" /> <Compile Include="Library\Plugins\WebGate\CreaterMediatorPlugin.cs" /> <Compile Include="Library\Plugins\WebGate\WebGatePlugin.cs" /> - <Compile Include="Library\SocketGate.cs" /> - <Compile Include="Library\WebGate.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <EmbeddedResource Include="Form1.resx"> @@ -91,6 +87,9 @@ <Name>LibraryExtention</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <Folder Include="Library\Connector\" /> + </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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 14:05:42
|
Revision: 192 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=192&view=rev Author: brus07 Date: 2008-05-31 07:05:42 -0700 (Sat, 31 May 2008) Log Message: ----------- Added new architecture of mediator (Kernel, two list of plugins...) Added status bar with count of clients status Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.resx ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj Added Paths: ----------- ACMServer/trunk/MediatorSolution/Mediator/Library/MediatorKernel.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/CreaterMediatorPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/CreaterMediatorPlugin.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-05-31 14:02:51 UTC (rev 191) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -28,6 +28,7 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); @@ -37,6 +38,10 @@ this.button4 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); this.textBox4 = new System.Windows.Forms.TextBox(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // button1 @@ -109,7 +114,7 @@ this.textBox3.Location = new System.Drawing.Point(12, 276); this.textBox3.Multiline = true; this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(574, 182); + this.textBox3.Size = new System.Drawing.Size(574, 169); this.textBox3.TabIndex = 7; // // textBox4 @@ -121,11 +126,33 @@ this.textBox4.Text = "http://acm.lviv.ua/fusion/acm/getsubmit.php?passw=master&type=GetSubmitInfo&id=35" + "000"; // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 448); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(598, 22); + this.statusStrip1.TabIndex = 9; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); + this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(598, 470); + this.Controls.Add(this.statusStrip1); this.Controls.Add(this.textBox4); this.Controls.Add(this.textBox3); this.Controls.Add(this.button4); @@ -138,6 +165,8 @@ this.Name = "Form1"; this.Text = "Gate"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -154,6 +183,9 @@ private System.Windows.Forms.Button button4; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.Timer timer1; } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-05-31 14:02:51 UTC (rev 191) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -7,39 +7,43 @@ using System.Windows.Forms; using AcmContester.Library.Connector; using System.Net.Sockets; +using AcmContester.Mediator.Library.Plugins; +using AcmContester.Mediator.Library.Plugins.SocketGate; namespace Mediator { public partial class Form1 : Form { - SocketServer socket = new SocketServer(); + // SocketServer socket = new SocketServer(); public Form1() { InitializeComponent(); string s = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())[0].ToString(); label1.Text += s; - socket.onDataArrived += DataArrived; + //socket.onDataArrived += DataArrived; } private void button1_Click(object sender, EventArgs e) { - if (socket.CountClients() <= 0) + //if (socket.CountClients() <= 0) MessageBox.Show("Server: Bida"); - socket.Send(textBox1.Text); + //socket.Send(textBox1.Text); } private void button2_Click(object sender, EventArgs e) { - AcmContester.Mediator.Library.SocketGate sg = new AcmContester.Mediator.Library.SocketGate(); - AcmContester.Mediator.Library.WebGate wg = new AcmContester.Mediator.Library.WebGate(); - //socket.Start(); + AcmContester.Mediator.Library.MediatorKernel kernel = new AcmContester.Mediator.Library.MediatorKernel(); + kernel.LoadLists(); + + //AcmContester.Mediator.Library.SocketGate sg = new AcmContester.Mediator.Library.SocketGate(); + //AcmContester.Mediator.Library.WebGate wg = new AcmContester.Mediator.Library.WebGate(); } private void button3_Click(object sender, EventArgs e) { - socket.Stop(); + // socket.Stop(); } private void DataArrived(string message) @@ -50,7 +54,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e) { - socket.Stop(); + // socket.Stop(); } private void button4_Click(object sender, EventArgs e) @@ -77,5 +81,18 @@ } } + + private void timer1_Tick(object sender, EventArgs e) + { + string mes = "CountOfClients: "; + + AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); + SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); + if (b2 != null) + mes += b2.CountClients().ToString(); + else + mes += "0"; + toolStripStatusLabel1.Text = mes; + } } } \ No newline at end of file Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.resx =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.resx 2008-05-31 14:02:51 UTC (rev 191) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.resx 2008-05-31 14:05:42 UTC (rev 192) @@ -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="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>127, 17</value> + </metadata> </root> \ No newline at end of file Added: ACMServer/trunk/MediatorSolution/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/MediatorKernel.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/MediatorKernel.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,41 @@ +using System; +using System.Collections; +using AcmContester.Mediator.Library.Plugins; + +namespace AcmContester.Mediator.Library +{ + class MediatorKernel + { + ArrayList clientSideList = new ArrayList(); + ArrayList testerSideList = new ArrayList(); + + public void LoadLists() + { + //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE2\xE8\xF2\xFF\xE3\xF3\xE2\xE0\xF2\xE8 \xE4\xE0\xED\xB3 \xB3\xE7 \xEF\xE0\xEF\xEE\xEA \xF3 \xFF\xEA\xE8\xE9\xF5 \xEC\xE0\xFE\xF2\xFC \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xE8\xF1\xFF \xE2\xB3\xE4\xEF\xEE\xE2\xB3\xE4\xED\xB3 dll \xE4\xEE \xEA\xEE\xE6\xED\xEE\xE3\xEE \xEF\xEB\xE0\xE3\xB3\xED\xF3 + AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin webCreater = new AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin(); + BaseMediatorPlugin b1 = webCreater.GetInstance(); + b1.onDataArrived += DataArrivedFromClentList; + clientSideList.Add(b1); + + AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); + BaseMediatorPlugin b2 = socketCreater.GetInstance(); + b2.onDataArrived += DataArrivedFromTesterList; + testerSideList.Add(b2); + } + + private void DataArrivedFromClentList(string message) + { + for (int index = 0; index < testerSideList.Count; index++) + { + ((BaseMediatorPlugin)testerSideList[index]).Send(message); + } + } + private void DataArrivedFromTesterList(string message) + { + for (int index = 0; index < clientSideList.Count; index++) + { + ((BaseMediatorPlugin)clientSideList[index]).Send(message); + } + } + } +} Added: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/BaseMediatorPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,18 @@ +using System; + +namespace AcmContester.Mediator.Library.Plugins +{ + public abstract class BaseMediatorPlugin + { + public delegate void DataArrived_EventHandler(string message); + public event DataArrived_EventHandler onDataArrived; + + public abstract void Send(string message); + + protected void DataArrived(string message) + { + if (onDataArrived != null) + onDataArrived(message); + } + } +} Added: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/CreaterMediatorPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/CreaterMediatorPlugin.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/CreaterMediatorPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,12 @@ +using System; + +namespace AcmContester.Mediator.Library.Plugins.SocketGate +{ + public class CreaterMediatorPlugin + { + public BaseMediatorPlugin GetInstance() + { + return SocketServerPlugin.GetInstance(); ; + } + } +} Added: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/SocketGate/SocketServerPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,34 @@ +using System; +using AcmContester.Mediator.Library.Plugins; +using AcmContester.Library.Connector; + +namespace AcmContester.Mediator.Library.Plugins.SocketGate +{ + class SocketServerPlugin : BaseMediatorPlugin + { + private static SocketServerPlugin instance = new SocketServerPlugin(); + + private SocketServer server = new SocketServer(); + + private SocketServerPlugin() + { + server.Start(); + server.onDataArrived += DataArrived; + } + + public static SocketServerPlugin GetInstance() + { + return instance; + } + + public override void Send(string message) + { + server.Send(message); + } + + internal int CountClients() + { + return server.CountClients(); + } + } +} Added: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/CreaterMediatorPlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/CreaterMediatorPlugin.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/CreaterMediatorPlugin.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,12 @@ +using System; + +namespace AcmContester.Mediator.Library.Plugins.WebGate +{ + public class CreaterMediatorPlugin + { + public BaseMediatorPlugin GetInstance() + { + return WebGatePlugin.GetInstance(); ; + } + } +} Added: ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs (rev 0) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Plugins/WebGate/WebGatePlugin.cs 2008-05-31 14:05:42 UTC (rev 192) @@ -0,0 +1,28 @@ +using System; +using AcmContester.Mediator.Library.Plugins; +using AcmContester.Library.Connector; + +namespace AcmContester.Mediator.Library.Plugins.WebGate +{ + class WebGatePlugin: BaseMediatorPlugin + { + private static WebGatePlugin instance = new WebGatePlugin(); + + private WebConnector connector = new WebConnector(); + + private WebGatePlugin() + { + connector.onDataArrived += DataArrived; + } + + public static WebGatePlugin GetInstance() + { + return instance; + } + + public override void Send(string message) + { + connector.Send(message); + } + } +} Modified: ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-05-31 14:02:51 UTC (rev 191) +++ ACMServer/trunk/MediatorSolution/Mediator/Mediator.csproj 2008-05-31 14:05:42 UTC (rev 192) @@ -47,6 +47,12 @@ <Compile Include="Library\Data\DataMediator.cs" /> <Compile Include="Library\Data\Result.cs" /> <Compile Include="Library\Data\Submit.cs" /> + <Compile Include="Library\MediatorKernel.cs" /> + <Compile Include="Library\Plugins\BaseMediatorPlugin.cs" /> + <Compile Include="Library\Plugins\SocketGate\CreaterMediatorPlugin.cs" /> + <Compile Include="Library\Plugins\SocketGate\SocketServerPlugin.cs" /> + <Compile Include="Library\Plugins\WebGate\CreaterMediatorPlugin.cs" /> + <Compile Include="Library\Plugins\WebGate\WebGatePlugin.cs" /> <Compile Include="Library\SocketGate.cs" /> <Compile Include="Library\WebGate.cs" /> <Compile Include="Program.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 14:02:45
|
Revision: 191 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=191&view=rev Author: brus07 Date: 2008-05-31 07:02:51 -0700 (Sat, 31 May 2008) Log Message: ----------- Fixed bug with connected status Modified Paths: -------------- ACMServer/trunk/TesterSolution/Tester/Form1.cs Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-05-31 12:48:00 UTC (rev 190) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-05-31 14:02:51 UTC (rev 191) @@ -61,7 +61,8 @@ else toolStripStatusLabel1.Text = "not connected"; } - toolStripStatusLabel1.Text = "not connected"; + else + toolStripStatusLabel1.Text = "null"; } } } \ 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-05-31 12:47:52
|
Revision: 190 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=190&view=rev Author: brus07 Date: 2008-05-31 05:48:00 -0700 (Sat, 31 May 2008) Log Message: ----------- Added StatusBar for information about connection status Modified Paths: -------------- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs ACMServer/trunk/TesterSolution/Tester/Form1.resx Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-05-31 10:56:13 UTC (rev 189) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-05-31 12:48:00 UTC (rev 190) @@ -28,12 +28,17 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.textBox2 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // textBox1 @@ -41,7 +46,7 @@ this.textBox1.Location = new System.Drawing.Point(12, 90); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(268, 171); + this.textBox1.Size = new System.Drawing.Size(268, 158); this.textBox1.TabIndex = 0; // // button1 @@ -89,11 +94,33 @@ this.textBox3.TabIndex = 5; this.textBox3.Text = "127.0.0.1"; // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 251); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(292, 22); + this.statusStrip1.TabIndex = 6; + this.statusStrip1.Text = "statusStrip1"; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); + this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 273); + this.Controls.Add(this.statusStrip1); this.Controls.Add(this.textBox3); this.Controls.Add(this.button3); this.Controls.Add(this.textBox2); @@ -103,6 +130,8 @@ this.Name = "Form1"; this.Text = "Tester"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -116,6 +145,9 @@ private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button button3; private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; } } Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-05-31 10:56:13 UTC (rev 189) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-05-31 12:48:00 UTC (rev 190) @@ -47,8 +47,21 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e) { - if (socket.IsConnected() == true) - socket.Disconnect(); + if (socket != null) + if (socket.IsConnected() == true) + socket.Disconnect(); } + + private void timer1_Tick(object sender, EventArgs e) + { + if (socket != null) + { + if (socket.IsConnected() == true) + toolStripStatusLabel1.Text = "CONNECTED"; + else + toolStripStatusLabel1.Text = "not connected"; + } + toolStripStatusLabel1.Text = "not connected"; + } } } \ No newline at end of file Modified: ACMServer/trunk/TesterSolution/Tester/Form1.resx =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.resx 2008-05-31 10:56:13 UTC (rev 189) +++ ACMServer/trunk/TesterSolution/Tester/Form1.resx 2008-05-31 12:48:00 UTC (rev 190) @@ -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="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>127, 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-05-31 10:56:14
|
Revision: 189 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=189&view=rev Author: brus07 Date: 2008-05-31 03:56:13 -0700 (Sat, 31 May 2008) Log Message: ----------- *.sou files added to ignore list Property Changed: ---------------- ACMServer/trunk/MediatorSolution/ ACMServer/trunk/TesterSolution/ Property changes on: ACMServer/trunk/MediatorSolution ___________________________________________________________________ Name: svn:ignore - *.Load + *.Load *.suo Property changes on: ACMServer/trunk/TesterSolution ___________________________________________________________________ Name: svn:ignore - *.Load + *.Load *.suo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 10:51:10
|
Revision: 188 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=188&view=rev Author: brus07 Date: 2008-05-31 03:51:16 -0700 (Sat, 31 May 2008) Log Message: ----------- Deleted *.sou files Removed Paths: ------------- ACMServer/trunk/MediatorSolution/AcmContester.suo ACMServer/trunk/TesterSolution/AcmContester.suo Deleted: ACMServer/trunk/MediatorSolution/AcmContester.suo =================================================================== (Binary files differ) Deleted: ACMServer/trunk/TesterSolution/AcmContester.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 10:47:28
|
Revision: 187 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=187&view=rev Author: brus07 Date: 2008-05-31 03:47:36 -0700 (Sat, 31 May 2008) Log Message: ----------- Deleted extra files Modified Paths: -------------- ACMServer/trunk/MediatorSolution/AcmContester.sln ACMServer/trunk/MediatorSolution/AcmContester.suo ACMServer/trunk/TesterSolution/AcmContester.sln ACMServer/trunk/TesterSolution/AcmContester.suo Removed Paths: ------------- ACMServer/trunk/AcmContester.sln ACMServer/trunk/AcmContester.suo ACMServer/trunk/Checker/ ACMServer/trunk/Library/ ACMServer/trunk/Mediator/ ACMServer/trunk/MediatorSolution/Checker/ ACMServer/trunk/MediatorSolution/Tester/ ACMServer/trunk/Resource/ ACMServer/trunk/Tester/ ACMServer/trunk/TesterSolution/Mediator/ ACMServer/trunk/TesterSolution/MediatorSolution/ Deleted: ACMServer/trunk/AcmContester.sln =================================================================== --- ACMServer/trunk/AcmContester.sln 2008-05-31 10:37:41 UTC (rev 186) +++ ACMServer/trunk/AcmContester.sln 2008-05-31 10:47:36 UTC (rev 187) @@ -1,50 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{5AC26E6C-CFBB-4262-B07E-71C9B5288630}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Connector", "Library\Connector\Connector.csproj", "{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediator", "Mediator\Mediator.csproj", "{60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{3C6F91E7-56AA-4138-8A3F-FE70897153DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker\Checker.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryExtention", "Library\LibraryExtention\LibraryExtention.csproj", "{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Release|Any CPU.Build.0 = Release|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.Build.0 = Release|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Release|Any CPU.Build.0 = Release|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.ActiveCfg = Release|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.Build.0 = Release|Any CPU - {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {5AC26E6C-CFBB-4262-B07E-71C9B5288630} - {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {5AC26E6C-CFBB-4262-B07E-71C9B5288630} - EndGlobalSection -EndGlobal Deleted: ACMServer/trunk/AcmContester.suo =================================================================== (Binary files differ) Modified: ACMServer/trunk/MediatorSolution/AcmContester.sln =================================================================== --- ACMServer/trunk/MediatorSolution/AcmContester.sln 2008-05-31 10:37:41 UTC (rev 186) +++ ACMServer/trunk/MediatorSolution/AcmContester.sln 2008-05-31 10:47:36 UTC (rev 187) @@ -7,10 +7,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediator", "Mediator\Mediator.csproj", "{60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{3C6F91E7-56AA-4138-8A3F-FE70897153DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker\Checker.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryExtention", "Library\LibraryExtention\LibraryExtention.csproj", "{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}" EndProject Global @@ -27,14 +23,6 @@ {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.Build.0 = Release|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Release|Any CPU.Build.0 = Release|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.ActiveCfg = Release|Any CPU - {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.Build.0 = Release|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8135069-F8BA-4E5D-835F-3FF3F350AA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU Modified: ACMServer/trunk/MediatorSolution/AcmContester.suo =================================================================== (Binary files differ) Modified: ACMServer/trunk/TesterSolution/AcmContester.sln =================================================================== --- ACMServer/trunk/TesterSolution/AcmContester.sln 2008-05-31 10:37:41 UTC (rev 186) +++ ACMServer/trunk/TesterSolution/AcmContester.sln 2008-05-31 10:47:36 UTC (rev 187) @@ -5,8 +5,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Connector", "Library\Connector\Connector.csproj", "{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediator", "Mediator\Mediator.csproj", "{60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{3C6F91E7-56AA-4138-8A3F-FE70897153DA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker\Checker.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}" @@ -23,10 +21,6 @@ {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Release|Any CPU.ActiveCfg = Release|Any CPU {211DD6A5-2D73-439E-8722-ED2C89ED1DDB}.Release|Any CPU.Build.0 = Release|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60AAB414-BF4A-4A67-9FF2-D04C3B4BBA9B}.Release|Any CPU.Build.0 = Release|Any CPU {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {3C6F91E7-56AA-4138-8A3F-FE70897153DA}.Release|Any CPU.ActiveCfg = Release|Any CPU Modified: ACMServer/trunk/TesterSolution/AcmContester.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 10:37:35
|
Revision: 186 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=186&view=rev Author: brus07 Date: 2008-05-31 03:37:41 -0700 (Sat, 31 May 2008) Log Message: ----------- Separate project. Create project. Added Paths: ----------- ACMServer/trunk/TesterSolution/ Copied: ACMServer/trunk/TesterSolution (from rev 185, ACMServer/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-31 10:34:42
|
Revision: 185 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=185&view=rev Author: brus07 Date: 2008-05-31 03:34:49 -0700 (Sat, 31 May 2008) Log Message: ----------- Separate project. Create MediatorSolution project. Added Paths: ----------- ACMServer/trunk/MediatorSolution/ Copied: ACMServer/trunk/MediatorSolution (from rev 184, ACMServer/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-31 10:19:47
|
Revision: 184 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=184&view=rev Author: sem62 Date: 2008-05-31 03:19:53 -0700 (Sat, 31 May 2008) Log Message: ----------- added code for saving / loading ioRecords to / from config.xml Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java 2008-05-31 09:03:39 UTC (rev 183) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java 2008-05-31 10:19:53 UTC (rev 184) @@ -6,10 +6,33 @@ import org.dom4j.Element; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQIOModel; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQIORecord; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPart; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPartsTableModel; public class CompileQData extends ItemData { + private String caption = ""; + + private String languge = "Any"; + private CompileQPartsTableModel parts = new CompileQPartsTableModel(); + + private CompileQIOModel ioRecords = new CompileQIOModel(); + + public String getCaption() { + return caption; + } + public CompileQIOModel getIoRecords() { + return ioRecords; + } + + public String getLanguge() { + return languge; + } + + public CompileQPartsTableModel getParts() { + return parts; + } + @Override public Element marshal() { Element root = DocumentHelper.createElement("ItemData"); @@ -38,21 +61,37 @@ partElement.setText(part.getAnswerText()); } + Element ioRecordsElemenet = root.addElement("ioRecords"); + for (int i=0; i < ioRecords.ioRecords.size(); i++){ + CompileQIORecord record = ioRecords.ioRecords.get(i); + + Element ioRecordElemenet = ioRecordsElemenet.addElement("IORecord"); + + ioRecordElemenet.addAttribute("number", String.valueOf(i)); + Element ioInput = ioRecordElemenet.addElement("Input"); + Element ioOutput = ioRecordElemenet.addElement("Output"); + + ioInput.add(DocumentHelper.createCDATA(record.getInputData())); + ioOutput.add(DocumentHelper.createCDATA(record.getOutputData())); + } + return root; } - private String caption = ""; - private String languge = "Any"; + public void setCaption(String caption) { + this.caption = caption; + } - public String getCaption() { - return caption; + public void setIoRecords(CompileQIOModel ioRecords) { + this.ioRecords = ioRecords; } - private CompileQPartsTableModel parts = new CompileQPartsTableModel(); - private CompileQIOModel ioRecords = new CompileQIOModel(); + public void setLanguge(String languge) { + this.languge = languge; + } - public void setCaption(String caption) { - this.caption = caption; + public void setParts(CompileQPartsTableModel parts) { + this.parts = parts; } @Override @@ -88,6 +127,26 @@ getParts().questionParts.add(part); } + + Element ioRecordsElement = root.element("ioRecords"); + Iterator<Element> ioIter = ioRecordsElement.elementIterator("IORecord"); + ioRecords.ioRecords.clear(); + while (ioIter.hasNext()) { + Element ioElement = ioIter.next(); + + int index = Integer.valueOf(ioElement.attributeValue("number")); + + CompileQIORecord record = new CompileQIORecord(); + + record.setInputData(ioElement.elementText("Input")); + record.setOutputData(ioElement.elementText("Output")); + + while (index >= ioRecords.ioRecords.size()){ + ioRecords.ioRecords.add(new CompileQIORecord()); + } + + ioRecords.ioRecords.set(index, record); + } } catch (Exception e) { e.printStackTrace(); return false; @@ -95,28 +154,4 @@ return true; } - - public CompileQPartsTableModel getParts() { - return parts; - } - - public void setParts(CompileQPartsTableModel parts) { - this.parts = parts; - } - - public String getLanguge() { - return languge; - } - - public void setLanguge(String languge) { - this.languge = languge; - } - - public CompileQIOModel getIoRecords() { - return ioRecords; - } - - public void setIoRecords(CompileQIOModel ioRecords) { - this.ioRecords = ioRecords; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-31 09:03:54
|
Revision: 183 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=183&view=rev Author: sem62 Date: 2008-05-31 02:03:39 -0700 (Sat, 31 May 2008) Log Message: ----------- Code refactorings. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ChapterItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemDataFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/LectureData.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SummaryPageData.java Removed Paths: ------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-31 09:03:39 UTC (rev 183) @@ -14,7 +14,7 @@ import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objectives; import edu.lnu.FireFly.FFManifest.resource.Resources; import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel; -import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ChapterItemData; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; public class ManifestFactory { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-31 09:03:39 UTC (rev 183) @@ -26,10 +26,10 @@ import javax.swing.table.TableCellEditor; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; -import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQData; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQIOModel; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPartsTableModel; +import edu.lnu.FireFly.WebEditor.itemConfiguration.CompileQData; /** * Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java 2008-05-31 09:03:39 UTC (rev 183) @@ -7,8 +7,8 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureData; import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureModel; +import edu.lnu.FireFly.WebEditor.itemConfiguration.LectureData; /** * Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-31 09:03:39 UTC (rev 183) @@ -17,8 +17,8 @@ import javax.swing.table.DefaultTableColumnModel; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionAnswersDataModel; -import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionData; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; +import edu.lnu.FireFly.WebEditor.itemConfiguration.SimpleQuestionData; /** * Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,108 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels.Chapter; - -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; - -public class ChapterItemData extends ItemData { - private boolean showSummaryPage = true; - - @Override - public Element marshal() { - Element root = DocumentHelper.createElement("ItemData"); - - root.addElement("ShowSummaryPage").setText( - String.valueOf(isShowSummaryPage())); - - root.addElement("ShowOnSummaryPage").setText( - String.valueOf(getShowOnSummaryPage())); - - root.addElement("Configuration").setText( - String.valueOf(getConfiguration())); - - return root; - } - - private boolean flow; - - private boolean choice; - - private boolean forwarOnly; - private boolean choiceExit; - private int configuration = ChapterItemData.CONFIGURATION_USER_DEFINED; - - public int getConfiguration() { - return configuration; - } - - public boolean isChoice() { - return choice; - } - - public boolean isChoiceExit() { - return choiceExit; - } - - public boolean isFlow() { - return flow; - } - - public boolean isForwarOnly() { - return forwarOnly; - } - - public boolean isShowSummaryPage() { - return showSummaryPage; - } - - public void setChoice(boolean choice) { - this.choice = choice; - } - - public void setChoiceExit(boolean choiceExit) { - this.choiceExit = choiceExit; - } - - public void setConfiguration(int configuration) { - this.configuration = configuration; - } - - public void setFlow(boolean flow) { - this.flow = flow; - } - - public void setForwarOnly(boolean forwarOnly) { - this.forwarOnly = forwarOnly; - } - - public void setShowSummaryPage(boolean showSummaryPage) { - this.showSummaryPage = showSummaryPage; - } - - @Override - public boolean unmarshal(Element root) { - try { - boolean showSP = Boolean.valueOf(root.elementTextTrim("ShowSummaryPage")); - setShowSummaryPage(showSP); - - boolean showOnSP = Boolean.valueOf(root - .elementTextTrim("ShowOnSummaryPage")); - setShowOnSummaryPage(showOnSP); - - int configuration = Integer.valueOf(root - .elementTextTrim("Configuration")); - setConfiguration(configuration); - - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - return true; - } - - public static final int CONFIGURATION_USER_DEFINED = 0; - public static final int CONFIGURATION_LECTURE = 1; - public static final int CONFIGURATION_EXAMINATION = 2; -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -4,12 +4,13 @@ import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.ChapterPropertiestsDlg; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ChapterItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; public class ChapterModel extends ResourcedItemModel { Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,120 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; - -import java.util.Iterator; - -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; - -public class CompileQData extends ItemData { - @Override - public Element marshal() { - Element root = DocumentHelper.createElement("ItemData"); - root.addElement("caption").setText(getCaption()); - - root.addElement("ShowOnSummaryPage").setText( - String.valueOf(getShowOnSummaryPage())); - - Element parts = root.addElement("parts"); - - parts.addAttribute("language", String.valueOf(getLanguge())); - - Iterator<CompileQPart> iter = getParts().questionParts.iterator(); - - while (iter.hasNext()) { - CompileQPart part = iter.next(); - - Element partElement = parts.addElement("part"); - partElement.addAttribute("isAnswer", String.valueOf(part - .getPartAttributes().isAnswer())); - partElement.addAttribute("isReadOnly", String.valueOf(part - .getPartAttributes().isReadOnly())); - partElement.addAttribute("isVivsble", String.valueOf(part - .getPartAttributes().isVisible())); - - partElement.setText(part.getAnswerText()); - } - - return root; - } - - private String caption = ""; - private String languge = "Any"; - - public String getCaption() { - return caption; - } - - private CompileQPartsTableModel parts = new CompileQPartsTableModel(); - private CompileQIOModel ioRecords = new CompileQIOModel(); - - public void setCaption(String caption) { - this.caption = caption; - } - - @Override - @SuppressWarnings("unchecked") - public boolean unmarshal(Element root) { - try { - Element answers = root.element("parts"); - - setCaption(root.elementTextTrim("caption")); - - boolean showOnSP = Boolean.valueOf(root - .elementTextTrim("ShowOnSummaryPage")); - setShowOnSummaryPage(showOnSP); - - setLanguge(answers.attributeValue("language")); - - getParts().questionParts.clear(); - - Iterator<Element> iter = answers.elementIterator("part"); - while (iter.hasNext()) { - Element partElement = iter.next(); - CompileQPart part = new CompileQPart(partElement.getText()); - - part.getPartAttributes().setAnswer( - partElement.attributeValue("isAnswer") - .equalsIgnoreCase("true")); - part.getPartAttributes().setReadOnly( - partElement.attributeValue("isReadOnly") - .equalsIgnoreCase("true")); - part.getPartAttributes().setVisible( - partElement.attributeValue("isVivsble") - .equalsIgnoreCase("true")); - - getParts().questionParts.add(part); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - return true; - } - - public CompileQPartsTableModel getParts() { - return parts; - } - - public void setParts(CompileQPartsTableModel parts) { - this.parts = parts; - } - - public String getLanguge() { - return languge; - } - - public void setLanguge(String languge) { - this.languge = languge; - } - - public CompileQIOModel getIoRecords() { - return ioRecords; - } - - public void setIoRecords(CompileQIOModel ioRecords) { - this.ioRecords = ioRecords; - } -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -7,11 +7,12 @@ import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.CompileQ.CompileQPropertiestsDlg; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.ScoredUserAnswerStatus; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.CompileQData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; public class CompileQModel extends ResourcedItemModel { Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,19 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels; - -import org.dom4j.Element; - -public abstract class ItemData { - private Boolean showOnSummaryPage = false; - - public Boolean getShowOnSummaryPage() { - return showOnSummaryPage; - } - - public void setShowOnSummaryPage(Boolean showOnSummaryPage) { - this.showOnSummaryPage = showOnSummaryPage; - } - - public abstract boolean unmarshal(Element root); - - public abstract Element marshal(); -} Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,45 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels; - -import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterItemData; -import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQData; -import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureData; -import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionData; -import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageData; - -public class ItemDataFactory { - private static ItemDataFactory obj = null; - - private ItemDataFactory(){} - - public static ItemDataFactory getInstance(){ - if (obj == null){ - obj = new ItemDataFactory(); - } - - return obj; - } - - public ItemData createItemData(String type){ - if (LectureData.class.getSimpleName().equalsIgnoreCase(type)){ - return new LectureData(); - } - - if (ChapterItemData.class.getSimpleName().equalsIgnoreCase(type)){ - return new ChapterItemData(); - } - - if (SimpleQuestionData.class.getSimpleName().equalsIgnoreCase(type)){ - return new SimpleQuestionData(); - } - - if (SummaryPageData.class.getSimpleName().equalsIgnoreCase(type)){ - return new SummaryPageData(); - } - - if (CompileQData.class.getSimpleName().equalsIgnoreCase(type)){ - return new CompileQData(); - } - - return null; - } -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -23,6 +23,7 @@ import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; public abstract class ItemModel { protected String modelName = "Abstract model"; Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,52 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels.Lecture; - -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; - -public class LectureData extends ItemData { - private String caption = ""; - private String content = ""; - - public String getCaption() { - return caption; - } - - public void setCaption(String caption) { - this.caption = caption; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - @Override - public boolean unmarshal(Element root) { - setCaption(root.elementTextTrim("caption")); - setContent(root.elementTextTrim("content")); - - boolean showOnSP = Boolean.valueOf(root - .elementTextTrim("ShowOnSummaryPage")); - - setShowOnSummaryPage(showOnSP); - - return true; - } - - @Override - public Element marshal() { - Element root = DocumentHelper.createElement("ItemData"); - root.addElement("caption").setText(getCaption()); - root.addElement("content").setText(getContent()); - - root.addElement("ShowOnSummaryPage").setText( - String.valueOf(getShowOnSummaryPage())); - - return root; - } -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -5,11 +5,12 @@ import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.LecturePropertiestsDlg; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.LectureUserAnswerStatus; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.LectureData; public class LectureModel extends ResourcedItemModel { @Override Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -11,6 +11,7 @@ import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; public abstract class ResourcedItemModel extends ItemModel { Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,100 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion; - -import java.util.Iterator; - -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; - -public class SimpleQuestionData extends ItemData { - @Override - public Element marshal() { - Element root = DocumentHelper.createElement("ItemData"); - root.addElement("caption").setText(getCaption()); - root.addElement("question").setText(getQuestion()); - - root.addElement("ShowOnSummaryPage").setText( - String.valueOf(getShowOnSummaryPage())); - - Element ans = root.addElement("answers"); - - ans.addAttribute("answerType", String.valueOf(getAnswers().getAnswerType())); - - Iterator<SimpleQuestionAnswer> iter = getAnswers().answers.iterator(); - - while (iter.hasNext()) { - SimpleQuestionAnswer answer = iter.next(); - - Element ansEl = ans.addElement("answer"); - ansEl - .addAttribute("point", String.valueOf(answer - .getAnswerPoint())); - ansEl.setText(answer.getAnswerText()); - } - - return root; - } - - private SimpleQuestionAnswersDataModel answers = new SimpleQuestionAnswersDataModel(); - private String caption = ""; - private String question = ""; - - public SimpleQuestionAnswersDataModel getAnswers() { - return answers; - } - - public void setAnswers(SimpleQuestionAnswersDataModel answers) { - this.answers = answers; - } - - public String getCaption() { - return caption; - } - - public void setCaption(String caption) { - this.caption = caption; - } - - public String getQuestion() { - return question; - } - - public void setQuestion(String question) { - this.question = question; - } - - @Override - @SuppressWarnings("unchecked") - public boolean unmarshal(Element root) { - try { - Element answers = root.element("answers"); - - setCaption(root.elementTextTrim("caption")); - setQuestion(root.elementTextTrim("question")); - - boolean showOnSP = Boolean.valueOf(root - .elementTextTrim("ShowOnSummaryPage")); - setShowOnSummaryPage(showOnSP); - - getAnswers().setAnswerType(Integer.valueOf(answers.attributeValue("answerType"))); - - getAnswers().answers.clear(); - - Iterator<Element> iter = answers.elementIterator("answer"); - while (iter.hasNext()) { - Element answer = iter.next(); - SimpleQuestionAnswer ans = new SimpleQuestionAnswer(answer - .getText()); - ans.setAnswerPoint(Double.valueOf(answer - .attributeValue("point"))); - getAnswers().answers.add(ans); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - return true; - } -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -8,11 +8,12 @@ import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.SimpleQuestionPropertiestsDlg; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.ScoredUserAnswerStatus; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.SimpleQuestionData; /** * @author Yura Deleted: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -1,27 +0,0 @@ -package edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel; - -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; - -public class SummaryPageData extends ItemData { - - @Override - public Element marshal() { - Element root = DocumentHelper.createElement("ItemData"); - - return root; - } - - @Override - public boolean unmarshal(Element root) { - // TODO Auto-generated method stub - return true; - } - - @Override - public Boolean getShowOnSummaryPage() { - return false; - } -} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -4,7 +4,6 @@ import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel; @@ -14,6 +13,8 @@ import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureModel; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.SummaryPageData; public class SummaryPageModel extends ResourcedItemModel { @Override Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-31 09:03:39 UTC (rev 183) @@ -4,6 +4,7 @@ import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; public class UnknownItemModel extends ItemModel { Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ChapterItemData.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ChapterItemData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ChapterItemData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,107 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + + +public class ChapterItemData extends ItemData { + private boolean showSummaryPage = true; + + @Override + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + + root.addElement("ShowSummaryPage").setText( + String.valueOf(isShowSummaryPage())); + + root.addElement("ShowOnSummaryPage").setText( + String.valueOf(getShowOnSummaryPage())); + + root.addElement("Configuration").setText( + String.valueOf(getConfiguration())); + + return root; + } + + private boolean flow; + + private boolean choice; + + private boolean forwarOnly; + private boolean choiceExit; + private int configuration = ChapterItemData.CONFIGURATION_USER_DEFINED; + + public int getConfiguration() { + return configuration; + } + + public boolean isChoice() { + return choice; + } + + public boolean isChoiceExit() { + return choiceExit; + } + + public boolean isFlow() { + return flow; + } + + public boolean isForwarOnly() { + return forwarOnly; + } + + public boolean isShowSummaryPage() { + return showSummaryPage; + } + + public void setChoice(boolean choice) { + this.choice = choice; + } + + public void setChoiceExit(boolean choiceExit) { + this.choiceExit = choiceExit; + } + + public void setConfiguration(int configuration) { + this.configuration = configuration; + } + + public void setFlow(boolean flow) { + this.flow = flow; + } + + public void setForwarOnly(boolean forwarOnly) { + this.forwarOnly = forwarOnly; + } + + public void setShowSummaryPage(boolean showSummaryPage) { + this.showSummaryPage = showSummaryPage; + } + + @Override + public boolean unmarshal(Element root) { + try { + boolean showSP = Boolean.valueOf(root.elementTextTrim("ShowSummaryPage")); + setShowSummaryPage(showSP); + + boolean showOnSP = Boolean.valueOf(root + .elementTextTrim("ShowOnSummaryPage")); + setShowOnSummaryPage(showOnSP); + + int configuration = Integer.valueOf(root + .elementTextTrim("Configuration")); + setConfiguration(configuration); + + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + return true; + } + + public static final int CONFIGURATION_USER_DEFINED = 0; + public static final int CONFIGURATION_LECTURE = 1; + public static final int CONFIGURATION_EXAMINATION = 2; +} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java (from rev 182, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/CompileQData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,122 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import java.util.Iterator; + +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQIOModel; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPart; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPartsTableModel; + +public class CompileQData extends ItemData { + @Override + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + root.addElement("caption").setText(getCaption()); + + root.addElement("ShowOnSummaryPage").setText( + String.valueOf(getShowOnSummaryPage())); + + Element parts = root.addElement("parts"); + + parts.addAttribute("language", String.valueOf(getLanguge())); + + Iterator<CompileQPart> iter = getParts().questionParts.iterator(); + + while (iter.hasNext()) { + CompileQPart part = iter.next(); + + Element partElement = parts.addElement("part"); + partElement.addAttribute("isAnswer", String.valueOf(part + .getPartAttributes().isAnswer())); + partElement.addAttribute("isReadOnly", String.valueOf(part + .getPartAttributes().isReadOnly())); + partElement.addAttribute("isVivsble", String.valueOf(part + .getPartAttributes().isVisible())); + + partElement.setText(part.getAnswerText()); + } + + return root; + } + + private String caption = ""; + private String languge = "Any"; + + public String getCaption() { + return caption; + } + + private CompileQPartsTableModel parts = new CompileQPartsTableModel(); + private CompileQIOModel ioRecords = new CompileQIOModel(); + + public void setCaption(String caption) { + this.caption = caption; + } + + @Override + @SuppressWarnings("unchecked") + public boolean unmarshal(Element root) { + try { + Element answers = root.element("parts"); + + setCaption(root.elementTextTrim("caption")); + + boolean showOnSP = Boolean.valueOf(root + .elementTextTrim("ShowOnSummaryPage")); + setShowOnSummaryPage(showOnSP); + + setLanguge(answers.attributeValue("language")); + + getParts().questionParts.clear(); + + Iterator<Element> iter = answers.elementIterator("part"); + while (iter.hasNext()) { + Element partElement = iter.next(); + CompileQPart part = new CompileQPart(partElement.getText()); + + part.getPartAttributes().setAnswer( + partElement.attributeValue("isAnswer") + .equalsIgnoreCase("true")); + part.getPartAttributes().setReadOnly( + partElement.attributeValue("isReadOnly") + .equalsIgnoreCase("true")); + part.getPartAttributes().setVisible( + partElement.attributeValue("isVivsble") + .equalsIgnoreCase("true")); + + getParts().questionParts.add(part); + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + return true; + } + + public CompileQPartsTableModel getParts() { + return parts; + } + + public void setParts(CompileQPartsTableModel parts) { + this.parts = parts; + } + + public String getLanguge() { + return languge; + } + + public void setLanguge(String languge) { + this.languge = languge; + } + + public CompileQIOModel getIoRecords() { + return ioRecords; + } + + public void setIoRecords(CompileQIOModel ioRecords) { + this.ioRecords = ioRecords; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java 2008-05-29 19:08:52 UTC (rev 182) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java 2008-05-31 09:03:39 UTC (rev 183) @@ -10,8 +10,6 @@ import org.dom4j.io.SAXReader; import edu.lnu.FireFly.FFManifest.TreeItem; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemDataFactory; import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; public class ItemConfigurationManager { Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemData.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,19 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import org.dom4j.Element; + +public abstract class ItemData { + private Boolean showOnSummaryPage = false; + + public Boolean getShowOnSummaryPage() { + return showOnSummaryPage; + } + + public void setShowOnSummaryPage(Boolean showOnSummaryPage) { + this.showOnSummaryPage = showOnSummaryPage; + } + + public abstract boolean unmarshal(Element root); + + public abstract Element marshal(); +} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemDataFactory.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemDataFactory.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemDataFactory.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,40 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + + +public class ItemDataFactory { + private static ItemDataFactory obj = null; + + private ItemDataFactory(){} + + public static ItemDataFactory getInstance(){ + if (obj == null){ + obj = new ItemDataFactory(); + } + + return obj; + } + + public ItemData createItemData(String type){ + if (LectureData.class.getSimpleName().equalsIgnoreCase(type)){ + return new LectureData(); + } + + if (ChapterItemData.class.getSimpleName().equalsIgnoreCase(type)){ + return new ChapterItemData(); + } + + if (SimpleQuestionData.class.getSimpleName().equalsIgnoreCase(type)){ + return new SimpleQuestionData(); + } + + if (SummaryPageData.class.getSimpleName().equalsIgnoreCase(type)){ + return new SummaryPageData(); + } + + if (CompileQData.class.getSimpleName().equalsIgnoreCase(type)){ + return new CompileQData(); + } + + return null; + } +} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/LectureData.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/LectureData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/LectureData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,51 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + + +public class LectureData extends ItemData { + private String caption = ""; + private String content = ""; + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + @Override + public boolean unmarshal(Element root) { + setCaption(root.elementTextTrim("caption")); + setContent(root.elementTextTrim("content")); + + boolean showOnSP = Boolean.valueOf(root + .elementTextTrim("ShowOnSummaryPage")); + + setShowOnSummaryPage(showOnSP); + + return true; + } + + @Override + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + root.addElement("caption").setText(getCaption()); + root.addElement("content").setText(getContent()); + + root.addElement("ShowOnSummaryPage").setText( + String.valueOf(getShowOnSummaryPage())); + + return root; + } +} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SimpleQuestionData.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SimpleQuestionData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SimpleQuestionData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,101 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import java.util.Iterator; + +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + +import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionAnswer; +import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionAnswersDataModel; + +public class SimpleQuestionData extends ItemData { + @Override + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + root.addElement("caption").setText(getCaption()); + root.addElement("question").setText(getQuestion()); + + root.addElement("ShowOnSummaryPage").setText( + String.valueOf(getShowOnSummaryPage())); + + Element ans = root.addElement("answers"); + + ans.addAttribute("answerType", String.valueOf(getAnswers().getAnswerType())); + + Iterator<SimpleQuestionAnswer> iter = getAnswers().answers.iterator(); + + while (iter.hasNext()) { + SimpleQuestionAnswer answer = iter.next(); + + Element ansEl = ans.addElement("answer"); + ansEl + .addAttribute("point", String.valueOf(answer + .getAnswerPoint())); + ansEl.setText(answer.getAnswerText()); + } + + return root; + } + + private SimpleQuestionAnswersDataModel answers = new SimpleQuestionAnswersDataModel(); + private String caption = ""; + private String question = ""; + + public SimpleQuestionAnswersDataModel getAnswers() { + return answers; + } + + public void setAnswers(SimpleQuestionAnswersDataModel answers) { + this.answers = answers; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public String getQuestion() { + return question; + } + + public void setQuestion(String question) { + this.question = question; + } + + @Override + @SuppressWarnings("unchecked") + public boolean unmarshal(Element root) { + try { + Element answers = root.element("answers"); + + setCaption(root.elementTextTrim("caption")); + setQuestion(root.elementTextTrim("question")); + + boolean showOnSP = Boolean.valueOf(root + .elementTextTrim("ShowOnSummaryPage")); + setShowOnSummaryPage(showOnSP); + + getAnswers().setAnswerType(Integer.valueOf(answers.attributeValue("answerType"))); + + getAnswers().answers.clear(); + + Iterator<Element> iter = answers.elementIterator("answer"); + while (iter.hasNext()) { + Element answer = iter.next(); + SimpleQuestionAnswer ans = new SimpleQuestionAnswer(answer + .getText()); + ans.setAnswerPoint(Double.valueOf(answer + .attributeValue("point"))); + getAnswers().answers.add(ans); + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + return true; + } +} Copied: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SummaryPageData.java (from rev 178, WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java) =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SummaryPageData.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/SummaryPageData.java 2008-05-31 09:03:39 UTC (rev 183) @@ -0,0 +1,26 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + + +public class SummaryPageData extends ItemData { + + @Override + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + + return root; + } + + @Override + public boolean unmarshal(Element root) { + // TODO Auto-generated method stub + return true; + } + + @Override + public Boolean getShowOnSummaryPage() { + return false; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-29 19:08:54
|
Revision: 182 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=182&view=rev Author: sem62 Date: 2008-05-29 12:08:52 -0700 (Thu, 29 May 2008) Log Message: ----------- Added all GUI element for editing CompileQ IO data. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIOModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIORecord.java Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-29 11:41:50 UTC (rev 181) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-29 19:08:52 UTC (rev 182) @@ -12,8 +12,10 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; +import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.LayoutStyle; +import javax.swing.ListSelectionModel; import javax.swing.ScrollPaneConstants; import javax.swing.WindowConstants; import javax.swing.GroupLayout.Alignment; @@ -25,6 +27,7 @@ import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQData; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQIOModel; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQPartsTableModel; @@ -47,18 +50,28 @@ private JPanel partsPanel; private JPanel testingDataPanel; private JScrollPane jScrollPane1; + private JScrollPane jScrollPane2; private PartsTable partsTable; + private JTable ioTable; private JTextField titleTextField; private JTextField captionTextField; private JTextField questionTextField; private JButton editCaptionInHtmlBtn; private JButton editQuestionInHtmlBtn; private JButton editAnswerVariantInHtmlEditor; + private JButton insertAnswerVariantBtn; private JButton deleteAnswerVariantBtn; private JButton moveUpAnswerVariantBtn; private JButton moveDownAnswerVariantBtn; + + private JButton insertIORecordBtn; + private JButton deleteIORecordBtn; + private JButton moveUpIORecordBtn; + private JButton moveDownIORecordBtn; + private CompileQPartsTableModel compileQTableDataModel; + private CompileQIOModel compileQIOTableModel; private JTextField currentAnswerVariant; @@ -84,7 +97,8 @@ return; } - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); String text = partsTable.getModel().getValueAt(selectedRow, 1) .toString(); @@ -100,12 +114,27 @@ return; } - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); compileQTableDataModel.insertRow(selectedRow); partsTable.getSelectionModel().setSelectionInterval( selectedRow + 1, selectedRow + 1); } + if (arg0.getSource() == insertIORecordBtn) { + int selectedRow = ioTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + stopCellEditing(partsTable); + stopCellEditing(ioTable); + compileQIOTableModel.insertRow(selectedRow); + ioTable.getSelectionModel().setSelectionInterval( + selectedRow + 1, selectedRow + 1); + } + if (arg0.getSource() == deleteAnswerVariantBtn) { int selectedRow = partsTable.getSelectedRow(); @@ -113,7 +142,8 @@ return; } - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); compileQTableDataModel.deleteRow(selectedRow); if (selectedRow >= compileQTableDataModel.getRowCount()) { @@ -123,6 +153,26 @@ partsTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow); } + + if (arg0.getSource() == deleteIORecordBtn) { + int selectedRow = ioTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + stopCellEditing(partsTable); + stopCellEditing(ioTable); + compileQIOTableModel.deleteRow(selectedRow); + + if (selectedRow >= compileQIOTableModel.getRowCount()) { + selectedRow--; + } + + ioTable.getSelectionModel().setSelectionInterval(selectedRow, + selectedRow); + } + if (arg0.getSource() == moveUpAnswerVariantBtn) { int selectedRow = partsTable.getSelectedRow(); @@ -130,13 +180,29 @@ return; } - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); if (compileQTableDataModel.moveUp(selectedRow)) { partsTable.getSelectionModel().setSelectionInterval( selectedRow - 1, selectedRow - 1); } } + if (arg0.getSource() == moveUpIORecordBtn) { + int selectedRow = ioTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + stopCellEditing(partsTable); + stopCellEditing(ioTable); + if (compileQIOTableModel.moveUp(selectedRow)) { + ioTable.getSelectionModel().setSelectionInterval( + selectedRow - 1, selectedRow - 1); + } + } + if (arg0.getSource() == moveDownAnswerVariantBtn) { int selectedRow = partsTable.getSelectedRow(); @@ -144,22 +210,38 @@ return; } - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); if (compileQTableDataModel.moveDown(selectedRow)) { partsTable.getSelectionModel().setSelectionInterval( selectedRow + 1, selectedRow + 1); } } + + if (arg0.getSource() == moveDownIORecordBtn) { + int selectedRow = ioTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + stopCellEditing(partsTable); + stopCellEditing(ioTable); + if (compileQIOTableModel.moveDown(selectedRow)) { + ioTable.getSelectionModel().setSelectionInterval( + selectedRow + 1, selectedRow + 1); + } + } } - public boolean stopCellEditing() { + public boolean stopCellEditing(JTable table) { try { - int column = partsTable.getEditingColumn(); + int column = table.getEditingColumn(); if (column > -1) { - TableCellEditor cellEditor = partsTable.getColumnModel() + TableCellEditor cellEditor = table.getColumnModel() .getColumn(column).getCellEditor(); if (cellEditor == null) { - cellEditor = partsTable.getDefaultEditor(partsTable + cellEditor = table.getDefaultEditor(table .getColumnClass(column)); } @@ -185,6 +267,7 @@ captionTextField.getText())); compileQTableDataModel = itemModel.getData(manifestItem).getParts(); + compileQIOTableModel = itemModel.getData(manifestItem).getIoRecords(); programmingLanguage.addItem("Any"); programmingLanguage.addItem("C++"); @@ -194,6 +277,7 @@ .getLanguge()); partsTable.setModel(compileQTableDataModel); + ioTable.setModel(compileQIOTableModel); DefaultTableColumnModel columnModel = (DefaultTableColumnModel) partsTable .getColumnModel(); @@ -212,6 +296,10 @@ columnModel.getColumn(2).setResizable(false); titleTextField.selectAll(); + + columnModel = (DefaultTableColumnModel) ioTable.getColumnModel(); + columnModel.getColumn(1).setCellEditor(multiLineTableCellEditor); + columnModel.getColumn(2).setCellEditor(multiLineTableCellEditor); } @Override @@ -229,6 +317,11 @@ add(tabbedPane); JPanel generalTab = new JPanel(); + ioTable = new JTable(); + ioTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + ioTable.setDefaultRenderer(String.class, new MultiLineCellRenderer()); + ioTable.setDefaultRenderer(PartNumber.class, + new PartNumberCellRenderer()); generalPanel = new JPanel(); titleLabel = new JLabel(); @@ -242,23 +335,34 @@ partsPanel = new JPanel(); testingDataPanel = new JPanel(); jScrollPane1 = new JScrollPane(); + jScrollPane2 = new JScrollPane(); cancelButton = new JButton("Cancel"); okButton = new JButton("Ok"); editCaptionInHtmlBtn = new JButton("..."); editQuestionInHtmlBtn = new JButton("..."); editAnswerVariantInHtmlEditor = new JButton("HTML Editor"); - insertAnswerVariantBtn = new JButton("Insert"); - deleteAnswerVariantBtn = new JButton("Delete"); programmingLanguage = new JComboBox(); moveDownAnswerVariantBtn = new JButton("Down"); moveUpAnswerVariantBtn = new JButton("Up"); + insertAnswerVariantBtn = new JButton("Insert"); + deleteAnswerVariantBtn = new JButton("Delete"); + moveDownIORecordBtn = new JButton("Down"); + moveUpIORecordBtn = new JButton("Up"); + insertIORecordBtn = new JButton("Insert"); + deleteIORecordBtn = new JButton("Delete"); + insertAnswerVariantBtn.addActionListener(this); deleteAnswerVariantBtn.addActionListener(this); moveDownAnswerVariantBtn.addActionListener(this); moveUpAnswerVariantBtn.addActionListener(this); + insertIORecordBtn.addActionListener(this); + deleteIORecordBtn.addActionListener(this); + moveDownIORecordBtn.addActionListener(this); + moveUpIORecordBtn.addActionListener(this); + currentAnswerVariant = new JTextField(); captionTextField.addActionListener(this); @@ -349,6 +453,10 @@ jScrollPane1 .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + jScrollPane2.setViewportView(ioTable); + jScrollPane2 + .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + GroupLayout jPanel4Layout = new GroupLayout(partsPanel); partsPanel.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup( @@ -523,13 +631,67 @@ 20, 20, 20)) .addContainerGap())); + GroupLayout jPanel5Layout = new GroupLayout(testingDataPanel); + testingDataPanel.setLayout(jPanel5Layout); + + jPanel5Layout + .setHorizontalGroup(jPanel5Layout + .createParallelGroup( + Alignment.TRAILING).addGroup( + jPanel5Layout.createSequentialGroup().addComponent( + moveUpIORecordBtn).addContainerGap(10, 10) + .addComponent(moveDownIORecordBtn).addContainerGap(10, + 10).addComponent(insertIORecordBtn) + .addContainerGap(10, 10) + .addComponent(deleteIORecordBtn).addContainerGap()) + .addGroup( + jPanel5Layout.createSequentialGroup().addContainerGap() + .addComponent(jScrollPane2, + GroupLayout.DEFAULT_SIZE, 364, + Short.MAX_VALUE).addContainerGap())); + + jPanel5Layout + .setVerticalGroup(jPanel5Layout + .createParallelGroup(Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap(10, 10) + .addGroup( + jPanel5Layout + .createParallelGroup(Alignment.BASELINE)) + .addContainerGap(10, 10) + .addComponent(jScrollPane2, + GroupLayout.DEFAULT_SIZE, 111, + Short.MAX_VALUE) + .addContainerGap(10, 10) + .addGroup( + jPanel5Layout + .createParallelGroup( + Alignment.BASELINE) + .addComponent( + moveUpIORecordBtn, + 20, 20, 20) + .addComponent( + moveDownIORecordBtn, + 20, 20, 20) + .addComponent( + insertIORecordBtn, + 20, 20, 20) + .addComponent( + deleteIORecordBtn, + 20, 20, 20)) + .addContainerGap())); + pack(); setSize(550, 600); } @Override protected void saveChanges() { - stopCellEditing(); + stopCellEditing(partsTable); + stopCellEditing(ioTable); + CompileQModel itemModel = new CompileQModel(); manifestItem.setTitle(titleTextField.getText()); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-29 11:41:50 UTC (rev 181) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-29 19:08:52 UTC (rev 182) @@ -47,6 +47,7 @@ } private CompileQPartsTableModel parts = new CompileQPartsTableModel(); + private CompileQIOModel ioRecords = new CompileQIOModel(); public void setCaption(String caption) { this.caption = caption; @@ -108,4 +109,12 @@ public void setLanguge(String languge) { this.languge = languge; } + + public CompileQIOModel getIoRecords() { + return ioRecords; + } + + public void setIoRecords(CompileQIOModel ioRecords) { + this.ioRecords = ioRecords; + } } Added: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIOModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIOModel.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIOModel.java 2008-05-29 19:08:52 UTC (rev 182) @@ -0,0 +1,150 @@ +package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.table.DefaultTableModel; + +import edu.lnu.FireFly.WebEditor.GUI.Dialogs.CompileQ.PartNumber; + +public class CompileQIOModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; + + public List<CompileQIORecord> ioRecords = new ArrayList<CompileQIORecord>(); + + @Override + public Class<?> getColumnClass(int col) { + switch (col) { + case 0: + return PartNumber.class; + default: + return String.class; + } + } + + @Override + public int getColumnCount() { + return 3; + } + + @Override + public String getColumnName(int arg0) { + switch (arg0) { + case 0: + return "#"; + case 1: + return "Input"; + default: + return "Output"; + } + } + + @Override + public int getRowCount() { + + if (ioRecords == null) { + return 0; + } + + return ioRecords.size() > 0 ? ioRecords.size() : 1; + } + + @Override + public Object getValueAt(int row, int col) { + if (row == ioRecords.size()) { + return null; + } + + switch (col) { + case 0: + return new PartNumber(row + 1); + case 1: + return ioRecords.get(row).getInputData(); + case 2: + return ioRecords.get(row).getOutputData(); + default: + return null; + } + } + + @Override + public boolean isCellEditable(int row, int col) { + switch (col) { + case 0: + return false; + case 1: + return true; + case 2: + return true; + default: + return false; + } + } + + @Override + public void setValueAt(Object value, int row, int col) { + if (row == ioRecords.size()) { + ioRecords.add(new CompileQIORecord()); + } + + String newValue = value.toString(); + + switch (col) { + case 1: + ioRecords.get(row).setInputData(newValue); + break; + case 2: + ioRecords.get(row).setOutputData(newValue); + break; + } + + fireTableRowsUpdated(row, row); + } + + public void deleteRow(int selectedRow) { + if (selectedRow < ioRecords.size() && selectedRow >= 0) { + ioRecords.remove(selectedRow); + fireTableRowsDeleted(selectedRow, selectedRow); + } + } + + public void insertRow(int selectedRow) { + if (selectedRow >= ioRecords.size()) { + selectedRow--; + } + + ioRecords.add(selectedRow + 1, new CompileQIORecord()); + fireTableRowsInserted(selectedRow + 1, selectedRow + 1); + } + + public boolean moveUp(int selectedRow) { + if (selectedRow < 1 || selectedRow >= ioRecords.size()) { + return false; + } + + CompileQIORecord answer = ioRecords.get(selectedRow); + ioRecords.set(selectedRow, ioRecords.get(selectedRow - 1)); + ioRecords.set(selectedRow - 1, answer); + + fireTableRowsUpdated(selectedRow - 1, selectedRow); + + return true; + } + + public boolean moveDown(int selectedRow) { + if (selectedRow < 0 || selectedRow >= ioRecords.size() - 1) { + return false; + } + + CompileQIORecord answer = ioRecords.get(selectedRow); + ioRecords.set(selectedRow, ioRecords.get(selectedRow + 1)); + ioRecords.set(selectedRow + 1, answer); + + fireTableRowsUpdated(selectedRow + 1, selectedRow); + + return true; + } +} Added: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIORecord.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIORecord.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQIORecord.java 2008-05-29 19:08:52 UTC (rev 182) @@ -0,0 +1,22 @@ +package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; + +public class CompileQIORecord { + private String inputData = ""; + private String outputData = ""; + + public String getInputData() { + return inputData; + } + + public void setInputData(String inputData) { + this.inputData = inputData; + } + + public String getOutputData() { + return outputData; + } + + public void setOutputData(String outputData) { + this.outputData = outputData; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |