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: <br...@us...> - 2008-06-26 21:07:33
|
Revision: 281 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=281&view=rev Author: brus07 Date: 2008-06-26 14:07:37 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Change size and type of field 'value' of table. Update view for source. Modified Paths: -------------- ACMServer/trunk/web/submit.php ACMServer/trunk/web/table.php ACMServer/trunk/web/update.php Added Paths: ----------- ACMServer/trunk/web/update3.0.0.2.sql Modified: ACMServer/trunk/web/submit.php =================================================================== --- ACMServer/trunk/web/submit.php 2008-06-26 18:22:52 UTC (rev 280) +++ ACMServer/trunk/web/submit.php 2008-06-26 21:07:37 UTC (rev 281) @@ -1,4 +1,4 @@ <FORM action = "insert.php" method=post> - Text: <INPUT name=text> + Text: <br><textarea name=text rows="20" wrap="VIRTUAL" cols="65"></textarea><br> <INPUT type=submit value=\xC2i\xE4i\xF1\xEB\xE0\xF2\xE8> </FROM> \ No newline at end of file Modified: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php 2008-06-26 18:22:52 UTC (rev 280) +++ ACMServer/trunk/web/table.php 2008-06-26 21:07:37 UTC (rev 281) @@ -63,6 +63,7 @@ for ($i=0; $i<3; $i++) { echo "\t\t<td>"; + $arr[$i] = $bodytag = str_replace("\r\n", "<br>", $arr[$i]); echo $arr[$i]; echo "</td>\n"; } Modified: ACMServer/trunk/web/update.php =================================================================== --- ACMServer/trunk/web/update.php 2008-06-26 18:22:52 UTC (rev 280) +++ ACMServer/trunk/web/update.php 2008-06-26 21:07:37 UTC (rev 281) @@ -2,6 +2,6 @@ require_once("connect.php"); - $sql = 'ALTER TABLE `v3_submits` ADD `usedMemory` VARCHAR( 20 ) NOT NULL, ADD `usedTime` VARCHAR( 20 ) NOT NULL '; + $sql = 'ALTER TABLE `v3_submits` CHANGE `value` `value` BLOB NOT NULL'; $result = MySql_Query ($sql); \ No newline at end of file Added: ACMServer/trunk/web/update3.0.0.2.sql =================================================================== --- ACMServer/trunk/web/update3.0.0.2.sql (rev 0) +++ ACMServer/trunk/web/update3.0.0.2.sql 2008-06-26 21:07:37 UTC (rev 281) @@ -0,0 +1,5 @@ +-- +-- Change type and length of field 'value' +-- + +ALTER TABLE `v3_submits` CHANGE `value` `value` BLOB NOT 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-06-26 18:22:45
|
Revision: 280 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=280&view=rev Author: brus07 Date: 2008-06-26 11:22:52 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Deleted CountClientStatus string from statusbar. Modified Paths: -------------- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Form1.resx Modified: ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-23 21:02:46 UTC (rev 279) +++ ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 18:22:52 UTC (rev 280) @@ -33,13 +33,10 @@ this.label1 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.timerCountSocketClients = new System.Windows.Forms.Timer(this.components); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); - this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // button2 @@ -75,25 +72,12 @@ // // statusStrip1 // - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1}); this.statusStrip1.Location = new System.Drawing.Point(0, 295); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(369, 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"; - // - // timerCountSocketClients - // - this.timerCountSocketClients.Enabled = true; - this.timerCountSocketClients.Tick += new System.EventHandler(this.timer1_Tick); - // // textBox1 // this.textBox1.Location = new System.Drawing.Point(12, 95); @@ -145,8 +129,6 @@ this.Text = "Gate"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -158,8 +140,6 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button3; private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private System.Windows.Forms.Timer timerCountSocketClients; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-23 21:02:46 UTC (rev 279) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 18:22:52 UTC (rev 280) @@ -77,20 +77,6 @@ Disconnnect(); } - 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; - } - private void Form1_Load(object sender, EventArgs e) { button2_Click(this, null); Modified: ACMServer/trunk/ACMServer/Mediator/Form1.resx =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.resx 2008-06-23 21:02:46 UTC (rev 279) +++ ACMServer/trunk/ACMServer/Mediator/Form1.resx 2008-06-26 18:22:52 UTC (rev 280) @@ -120,9 +120,6 @@ <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="timerCountSocketClients.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>127, 17</value> - </metadata> <metadata name="timerUpdateTextLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>300, 17</value> </metadata> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-23 21:03:59
|
Revision: 279 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=279&view=rev Author: brus07 Date: 2008-06-23 14:02:46 -0700 (Mon, 23 Jun 2008) Log Message: ----------- Transfer to web usedMemory and usedTime in testing result Modified Paths: -------------- ACMServer/trunk/ACMServer/Checker/Class1.cs ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/web/set.php ACMServer/trunk/web/table.php Added Paths: ----------- ACMServer/trunk/web/update.php ACMServer/trunk/web/update3.0.0.1.sql Modified: ACMServer/trunk/ACMServer/Checker/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-23 11:44:43 UTC (rev 278) +++ ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-23 21:02:46 UTC (rev 279) @@ -78,6 +78,8 @@ //TODO: Result result = new Result(submit); result.res = TSource.TestResultToString(c.Summary.res.res); + result.usedMemory = c.Summary.res.UsedMemory; + result.usedTime = c.Summary.res.UsedTime; return result.ToStringX(); } public static int GetResult1(string code) Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-23 11:44:43 UTC (rev 278) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-23 21:02:46 UTC (rev 279) @@ -39,18 +39,27 @@ { string res = ""; string id = ""; + string usedMemory = ""; + string usedTime = ""; try { //TODO: Result result = Result.CreateFromXml(message); res = result.res; id = result.Submit.id.ToString(); + usedMemory = result.usedMemory.ToString(); + usedTime = result.usedTime.ToString(); } catch (Exception) { return; } - HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/set.php?res=" + res + "&id=" + id); + string fullURL = fullPathToWebPages + "/set.php?"; + fullURL += "res=" + res; + fullURL += "&id=" + id; + fullURL += "&usedMemory=" + usedMemory; + fullURL += "&usedTime=" + usedTime; + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullURL); myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); myResponse.Close(); Modified: ACMServer/trunk/web/set.php =================================================================== --- ACMServer/trunk/web/set.php 2008-06-23 11:44:43 UTC (rev 278) +++ ACMServer/trunk/web/set.php 2008-06-23 21:02:46 UTC (rev 279) @@ -8,7 +8,7 @@ echo "<p>"; echo $id; $res = mysql_real_escape_string($res); - $Query = "UPDATE `v3_submits` SET `result` = \"$res\" WHERE `result` IS NULL AND `id` = $id LIMIT 1 ;"; + $Query = "UPDATE `v3_submits` SET `result` = \"$res\", `usedMemory`=$usedMemory, `usedTime`=$usedTime WHERE `result` IS NULL AND `id` = $id LIMIT 1 ;"; echo "<p>"; echo $Query; Modified: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php 2008-06-23 11:44:43 UTC (rev 278) +++ ACMServer/trunk/web/table.php 2008-06-23 21:02:46 UTC (rev 279) @@ -51,6 +51,12 @@ echo "\t\t<td>"; echo "<b>result</b>"; echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedMemory</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedTime</b>"; + echo "</td>\n"; echo "\t</tr>\n"; while($arr = mysql_fetch_array($result)) { echo "\t<tr>\n"; @@ -60,6 +66,12 @@ echo $arr[$i]; echo "</td>\n"; } + for ($i=3; $i<5; $i++) + { + echo "\t\t<td>"; + echo $arr[$i]/1000.0; + echo "</td>\n"; + } echo "\t</tr>\n"; } echo "</table>\n"; Added: ACMServer/trunk/web/update.php =================================================================== --- ACMServer/trunk/web/update.php (rev 0) +++ ACMServer/trunk/web/update.php 2008-06-23 21:02:46 UTC (rev 279) @@ -0,0 +1,7 @@ +<?php + + require_once("connect.php"); + + $sql = 'ALTER TABLE `v3_submits` ADD `usedMemory` VARCHAR( 20 ) NOT NULL, ADD `usedTime` VARCHAR( 20 ) NOT NULL '; + + $result = MySql_Query ($sql); \ No newline at end of file Added: ACMServer/trunk/web/update3.0.0.1.sql =================================================================== --- ACMServer/trunk/web/update3.0.0.1.sql (rev 0) +++ ACMServer/trunk/web/update3.0.0.1.sql 2008-06-23 21:02:46 UTC (rev 279) @@ -0,0 +1,5 @@ +-- +-- Insert new column to table +-- +ALTER TABLE `v3_submits` ADD `usedMemory` VARCHAR( 20 ) NOT NULL , +ADD `usedTime` VARCHAR( 20 ) NOT 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-06-23 11:46:45
|
Revision: 278 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=278&view=rev Author: brus07 Date: 2008-06-23 04:44:43 -0700 (Mon, 23 Jun 2008) Log Message: ----------- Automatic set current IP to textBox. Modified Paths: -------------- ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-22 23:19:59 UTC (rev 277) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-23 11:44:43 UTC (rev 278) @@ -18,6 +18,9 @@ public Form1() { InitializeComponent(); + + string ip = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())[0].ToString(); + textBox3.Text = ip; } private void button1_Click(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-22 23:19:53
|
Revision: 277 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=277&view=rev Author: brus07 Date: 2008-06-22 16:19:59 -0700 (Sun, 22 Jun 2008) Log Message: ----------- Set minimum length of log message to 5 character. Property Changed: ---------------- ACMServer/trunk/ ACMServer/trunk/ACMServer/ ACMServer/trunk/ACMServer/Checker/ ACMServer/trunk/ACMServer/Checker/Properties/ ACMServer/trunk/ACMServer/Library/ ACMServer/trunk/ACMServer/Library/Connector/ ACMServer/trunk/ACMServer/Library/Connector/Getter/ ACMServer/trunk/ACMServer/Library/Connector/Properties/ ACMServer/trunk/ACMServer/Library/Data/ ACMServer/trunk/ACMServer/Library/Data/Properties/ ACMServer/trunk/ACMServer/Library/LibraryExtention/ ACMServer/trunk/ACMServer/Library/LibraryExtention/Properties/ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/ ACMServer/trunk/ACMServer/Library/testData/ ACMServer/trunk/ACMServer/Library/testData/Properties/ ACMServer/trunk/ACMServer/Mediator/ ACMServer/trunk/ACMServer/Mediator/Library/ ACMServer/trunk/ACMServer/Mediator/Properties/ ACMServer/trunk/ACMServer/Plugins/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/Plugin1/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/Plugin1/Properties/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/Properties/ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/Properties/ ACMServer/trunk/ACMServer/Resource/ ACMServer/trunk/ACMServer/SAMPLE/ ACMServer/trunk/ACMServer/SAMPLE/Temp/ ACMServer/trunk/ACMServer/SAMPLE/Test/ ACMServer/trunk/ACMServer/SAMPLE/Test/test1/ ACMServer/trunk/ACMServer/SAMPLE/Test/test2/ ACMServer/trunk/ACMServer/SAMPLE/includeD7/ ACMServer/trunk/ACMServer/Tester/ ACMServer/trunk/ACMServer/Tester/Properties/ ACMServer/trunk/sharp tester/ ACMServer/trunk/sharp tester/SourceTest/ ACMServer/trunk/sharp tester/TestLibrary/ ACMServer/trunk/sharp tester/tester/ ACMServer/trunk/sharp tester/tester/Properties/ ACMServer/trunk/sharp tester/tester/SAMPLE/ ACMServer/trunk/sharp tester/tester/SAMPLE/Temp/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test1/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test2/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/ ACMServer/trunk/sharp tester/tester/SAMPLE/includeD7/ ACMServer/trunk/tasks/ ACMServer/trunk/web/ Property changes on: ACMServer/trunk ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Checker ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Checker/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/Connector ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/Connector/Getter ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/Connector/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/Data ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/Data/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/LibraryExtention ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/LibraryExtention/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/testData ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Library/testData/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Mediator ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Mediator/Library ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Mediator/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/Plugin1 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/Plugin1/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/PluginsFramework ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Resource ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE/Temp ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE/Test ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE/Test/test1 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE/Test/test2 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/SAMPLE/includeD7 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Tester ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/ACMServer/Tester/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/SourceTest ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/TestLibrary ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/Properties ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Temp ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test1 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test2 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/sharp tester/tester/SAMPLE/includeD7 ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/tasks ___________________________________________________________________ Name: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/web ___________________________________________________________________ Name: tsvn:logminsize + 5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-22 18:43:19
|
Revision: 276 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=276&view=rev Author: Oracle_ Date: 2008-06-22 11:43:23 -0700 (Sun, 22 Jun 2008) Log Message: ----------- Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp ACMServer/trunk/sharp tester/SourceTest/SourceTest.h ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-22 08:35:12 UTC (rev 275) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-22 18:43:23 UTC (rev 276) @@ -12,7 +12,6 @@ const wchar_t USER_NAME[]={L"TestingUser"}; //username for testing const wchar_t USER_PASSW[]={L"USER12345"}; //password of user for testing const int CONST_SLEEP=100; //constant used for waiting for files to be created/flushed on disk -const int MAX_THREAD=2; //maximum parallel threads namespace SourceTest { @@ -294,7 +293,7 @@ } FThreads.Clear(); - for (int i=0;i<min(MAX_THREAD,FTestCnt-1);i++) + for (int i=0;i<min(FLim.MaxThreads-1,FTestCnt-1);i++) AddThread(); for (int i=0;i<FThreads.Count;i++) ((Threading::Thread^)FThreads[i])->Join(INFINITE); @@ -671,7 +670,8 @@ } fopen_s(&f,buf=StrToArr(path),"rt"); fscanf_s(f,"CodeLimit: %d\nCompilationTimeLimit: %d\nMemoryLimit: %d\n",&FLim.CodeLimit,&FLim.CompilationTimeLimit,&FLim.MemoryLimit); - fscanf_s(f,"OutputLimit: %d\nRealTimeLimit: %d\nTimeLimit: %d",&FLim.OutputLimit,&FLim.RealTimeLimit,&FLim.TimeLimit); + fscanf_s(f,"OutputLimit: %d\nRealTimeLimit: %d\nTimeLimit: %d\n",&FLim.OutputLimit,&FLim.RealTimeLimit,&FLim.TimeLimit); + fscanf_s(f,"MaxThreads: %d",&FLim.MaxThreads); }__finally { fclose(f); Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-22 08:35:12 UTC (rev 275) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-22 18:43:23 UTC (rev 276) @@ -27,6 +27,7 @@ int RealTimeLimit; //maximum real time int CompilationTimeLimit; //maximum time for compilation int CodeLimit; //maximum source size + int MaxThreads; //maximum paralle threads TLimits() { @@ -294,7 +295,7 @@ void init() { cs=new CRITICAL_SECTION; - InitializeCriticalSection(cs); + InitializeCriticalSectionAndSpinCount(cs,100); } void lock() @@ -652,6 +653,7 @@ { lock(); FTempPath=value; + System::IO::Directory::CreateDirectory(FTempPath); }__finally { unlock(); Modified: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-22 08:35:12 UTC (rev 275) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-22 18:43:23 UTC (rev 276) @@ -4,3 +4,4 @@ OutputLimit: 1024 RealTimeLimit: 100000 TimeLimit: 500 +MaxThreads: 4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-22 10:53:07
|
Revision: 270 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=270&view=rev Author: Oracle_ Date: 2008-06-20 11:17:38 -0700 (Fri, 20 Jun 2008) Log Message: ----------- Added multithreading Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp ACMServer/trunk/sharp tester/SourceTest/SourceTest.h ACMServer/trunk/sharp tester/SourceTest.sln ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/trunk/sharp tester/tester/Program.cs ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt Added Paths: ----------- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/out.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/in.txt ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/out.txt Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-20 18:17:38 UTC (rev 270) @@ -10,6 +10,8 @@ const wchar_t USER_NAME[]={L"TestingUser"}; //username for testing const wchar_t USER_PASSW[]={L"USER12345"}; //password of user for testing +const int CONST_SLEEP=100; //constant used for waiting for files to be created/flushed on disk +const int MAX_THREAD=2; //maximum parallel threads namespace SourceTest { @@ -24,7 +26,6 @@ return (wchar_t*)System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str).ToPointer(); } - void FreeArr(char* buf) //destroys C++ string { System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); @@ -42,7 +43,6 @@ return %String(intg); } - bool FileExists(String^ path) //checks whether file exists or not { char* buf=StrToArr(path); @@ -54,6 +54,44 @@ return res; } +String^ ReadFullFile(String^ filename) +{ + HANDLE h; + wchar_t* bufW=StrToArrW(filename); + int cycle=0; + do + { + h=CreateFile(bufW,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL); + Sleep(1); + ++cycle; + } while (h==INVALID_HANDLE_VALUE&&cycle<100); + if (h==INVALID_HANDLE_VALUE) + return ""; + FreeArr(bufW); + DWORD size=GetFileSize(h,NULL); + char* res=new char[size+20];ZeroMemory(res,(size+2)*sizeof(char)); + char* buf=new char[size+20]; + DWORD curlen=0; + cycle=0; + do + { + ZeroMemory(buf, (size+20)*sizeof(char)); + DWORD rlen=0; + ReadFile(h,buf,size,&rlen,NULL); + curlen+=rlen; + strcat_s(res,size+10,buf); + Sleep(1); + ++cycle; + } while (curlen<size&&cycle<100); + CloseHandle(h); + String^ r=gcnew String(res); + delete[] res; + delete[] buf; + if (curlen<size) + return ""; + return r; +} + TSource::TSource() { FSrc=gcnew String(""); @@ -80,59 +118,47 @@ if (lib!=NULL) FreeLibrary(lib); delete FSecurity; +FRes.Clear(); +FThreads.Clear(); final(); } void TSource::CheckCL() //checking size of source { - try + if (lib==NULL) //no library was found { - lock(); - if (lib==NULL) //no library was found - { - if (FSrc->Length>FLim.CodeLimit) - FCompResult.res=crCL; - FCompResult.Details+="Used std checker for Code Limit\n"; - } else - { - TCheckSrc prc=(TCheckSrc)GetProcAddress(lib,"CheckCL"); - char* buf,*bufA; - if (prc(bufA=StrToArr(FSrc),FLim.CodeLimit,buf)) FCompResult.res=crCL; - FreeArr(bufA); - FCompResult.Details+=gcnew String(buf); - TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); - prc2(buf); - } - FState=ssCheckedCL; - }__finally + if (FSrc->Length>FLim.CodeLimit) + FCompResult.res=crCL; + FCompResult.Details+="Used std checker for Code Limit\n"; + } else { - unlock(); + 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; } void TSource::CheckDF() //checking for DF in source { - try + if (lib==NULL) //no library was found { - lock(); - if (lib==NULL) //no library was found - { - 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 + FCompResult.Details+="No checker for DF\n"; + } else { - unlock(); + 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; } void TSource::Compile() //compiles the source @@ -147,187 +173,210 @@ wchar_t* bufW; try { - lock(); - String^ srcpath=gcnew String(FTempPath+"source.txt"); - String^ outpath=gcnew String(FTempPath+"compoutput.txt"); - FExePath=FTempPath+"source.exe"; - - if (FileExists(FExePath)) //delete previsious source - { - DeleteFile((LPCTSTR)(bufW=StrToArrW(FExePath))); - FreeArr(bufW); - } - - si.cb=sizeof(si); - si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; - si.wShowWindow=FALSE; - si.hStdOutput=CreateFile(bufW=StrToArrW(outpath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); + String^ srcpath=gcnew String(FTempPath+"source.txt"); + String^ outpath=gcnew String(FTempPath+"compoutput.txt"); + FExePath=FTempPath+"source.exe"; + + if (FileExists(FExePath)) //delete previsious source + { + DeleteFile((LPCTSTR)(bufW=StrToArrW(FExePath))); FreeArr(bufW); - HANDLE src=CreateFile(bufW=StrToArrW(srcpath),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); - FreeArr(bufW); - DWORD len; - WriteFile(src,bufA=StrToArr(FSrc),FSrc->Length,&len,NULL); - FreeArr(bufA); - CloseHandle(src); - - Sleep(100); //waiting for file to flush on hard + Sleep(CONST_SLEEP); //waiting for file to destroy + } - DWORD start=GetTickCount(); - bufW=StrToArrW("\""+FCompPath+"\" \""+srcpath+"\" \""+FTempPath); - if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) - { - FreeArr(bufW); - FCompResult.res=crIE; - FCompResult.Details+="Can not run the compiler\n"; - return; - } + si.cb=sizeof(si); + si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; + si.wShowWindow=FALSE; + si.hStdOutput=CreateFile(bufW=StrToArrW(outpath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); + FreeArr(bufW); + HANDLE src=CreateFile(bufW=StrToArrW(srcpath),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); + FreeArr(bufW); + DWORD len; + WriteFile(src,bufA=StrToArr(FSrc),FSrc->Length,&len,NULL); + FreeArr(bufA); + CloseHandle(src); + + Sleep(CONST_SLEEP); //waiting for file to flush on hard + + DWORD start=GetTickCount(); + bufW=StrToArrW("\""+FCompPath+"\" \""+srcpath+"\" \""+FTempPath); + if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) + { FreeArr(bufW); - if (WaitForSingleObject(pi.hProcess,FLim.CompilationTimeLimit)==WAIT_TIMEOUT) - { - TerminateProcess(pi.hProcess,0); - FCompResult.res=crCTL; - FCompResult.UsedTime=FLim.CompilationTimeLimit; - FCompResult.Details+="Time out during compilation\n"; - return; - } - FCompResult.UsedTime=GetTickCount()-start; + FCompResult.res=crIE; + FCompResult.Details+="Can not run the compiler\n"; + return; + } + FreeArr(bufW); + if (WaitForSingleObject(pi.hProcess,FLim.CompilationTimeLimit)==WAIT_TIMEOUT) + { + TerminateProcess(pi.hProcess,0); + FCompResult.res=crCTL; + FCompResult.UsedTime=FLim.CompilationTimeLimit; + FCompResult.Details+="Time out during compilation\n"; + return; + } + FCompResult.UsedTime=GetTickCount()-start; - Sleep(100); //waiting for creating the file - CloseHandle(si.hStdOutput); + Sleep(CONST_SLEEP); //waiting for creating the file + + CloseHandle(si.hStdOutput); si.hStdOutput=NULL; - HANDLE oup=CreateFile(bufW=StrToArrW(outpath),GENERIC_READ,0,&sec,OPEN_EXISTING,0,NULL); - FreeArr(bufW); - DWORD size=GetFileSize(oup,NULL); - char* compres=new char[size+2]; compres[size+1]='\0'; - ReadFile(oup,compres,size,&len,NULL); - CloseHandle(oup); + if (!FileExists(FExePath)) //compilation error + { + FCompResult.res=crCE; + FCompResult.Details+="EXE file not found\n"+ReadFullFile(outpath); + return; + } - if (!FileExists(FExePath)) //compilation error - { - FCompResult.res=crCE; - FCompResult.Details+=gcnew String("EXE file not found\n")+gcnew String(compres); - delete[] compres; - return; - } + FCompResult.Details+=ReadFullFile(outpath); - FCompResult.Details+=gcnew String(compres); - delete[] compres; - }__finally { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); + if (pi.hProcess!=NULL) + CloseHandle(pi.hProcess); + if (pi.hThread!=NULL) + CloseHandle(pi.hThread); + if (si.hStdOutput!=NULL) + CloseHandle(si.hStdOutput); FState=ssCompiled; - unlock(); } } -void TSource::RunTests() //runs all tests of problem +void TSource::AddThread() { -try + Threading::Thread^ t=gcnew Threading::Thread(gcnew System::Threading::ThreadStart(this,&TSource::ThreadProc)); + FThreads.Add(t); + t->Start(); +} + +void TSource::ThreadProc() { + while (true) + { + if (!NeedTest) break; lock(); - int n=1; - while (FileExists(FProblemPath+"test"+ToStr(n)+"\\in.txt")||FileExists(FProblemPath+"test"+ToStr(n)+"\\out.txt")||FileExists(FProblemPath+"test"+ToStr(n)+"\\points.txt")) + ++CurrentTest; + int n=CurrentTest; + unlock(); + if (n<TestCnt()) { RunTest(n); - FSummary.res->points+=((TResult^)FRes[n-1])->points; - FSummary.res->UsedMemory=max(((TResult^)FRes[n-1])->UsedMemory,FSummary.res->UsedMemory); - FSummary.res->UsedTime=max(((TResult^)FRes[n-1])->UsedTime,FSummary.res->UsedTime); - FSummary.res->UsedRealTime=max(((TResult^)FRes[n-1])->UsedRealTime,FSummary.res->UsedRealTime); - if (((TResult^)FRes[n-1])->res!=trAC) + Summary->res->points+=Results[n-1]->points; + Summary->res->UsedMemory=max(Results[n-1]->UsedMemory,Summary->res->UsedMemory); + Summary->res->UsedTime=max(Results[n-1]->UsedTime,Summary->res->UsedTime); + Summary->res->UsedRealTime=max(Results[n-1]->UsedRealTime,Summary->res->UsedRealTime); + if (Results[n-1]->res!=trAC) { - FSummary.res->res=((TResult^)FRes[n-1])->res; - if (!FRunAll) break; + Summary->res->res=Results[n-1]->res; + if (!RunAll) { NeedTest=false; break; } } - n++; + } else + { + NeedTest=false; + break; } -}__finally + } +} + +void TSource::RunTests() //runs all tests of problem { + FState=ssIsRunning; + CurrentTest=0; + NeedTest=true; + FTestCnt=1; + FRes.Clear(); + while (FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\in.txt")||FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\out.txt")||FileExists(FProblemPath+"test"+ToStr(FTestCnt)+"\\points.txt")) + { + FRes.Add(%TResult()); + FTestCnt++; + } + + FThreads.Clear(); + for (int i=0;i<min(MAX_THREAD,FTestCnt-1);i++) + AddThread(); + for (int i=0;i<FThreads.Count;i++) + ((Threading::Thread^)FThreads[i])->Join(INFINITE); FState=ssFinish; - unlock(); } -} void TSource::LoadTest(int index,TTest% test) //loads test from file { -FILE* inp,*oup,*points; -char *bufA; try { lock(); - test.input=""; - test.output=""; - test.points=1; - - if (fopen_s(&inp,bufA=StrToArr(FProblemPath+"test"+ToStr(index)+"\\in.txt"),"rt")==0) - { - fseek(inp,0,SEEK_END); - int size=ftell(inp); - fseek(inp,0,SEEK_SET); - char* buf=new char[size+1];ZeroMemory(buf,(size+1)*sizeof(char)); - fread(buf,sizeof(char),size,inp); - test.input=gcnew String(buf); - } - FreeArr(bufA); - - if (fopen_s(&oup,bufA=StrToArr(FProblemPath+"\\test"+ToStr(index)+"\\out.txt"),"rt")==0) - { - fseek(oup,0,SEEK_END); - int size=ftell(inp); - fseek(oup,0,SEEK_SET); - char* buf=new char[size+1];ZeroMemory(buf,(size+1)*sizeof(char)); - fread(buf,sizeof(char),size,oup); - test.output=gcnew String(buf); - } - FreeArr(bufA); - - if (fopen_s(&points,bufA=StrToArr(FProblemPath+"\\test"+ToStr(index)+"\\points.txt"),"rt")==0) - { - fscanf_s(points,"%d",&test.points); - } - FreeArr(bufA); - + if (FileExists(FProblemPath+"test"+ToStr(index)+"\\in.txt")) + test.input=ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\in.txt"); else + test.input=""; + if (FileExists(FProblemPath+"test"+ToStr(index)+"\\out.txt")) + test.output=ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\out.txt"); else + test.output=""; + if (FileExists(FProblemPath+"test"+ToStr(index)+"\\points.txt")) + test.points.Parse(ReadFullFile(FProblemPath+"test"+ToStr(index)+"\\points.txt")); else + test.points=1; }__finally { - if (inp!=NULL) - fclose(inp); - if (oup!=NULL) - fclose(oup); - if (points!=NULL) - fclose(points); unlock(); } } TCheckAnsRes TSource::CheckAnswer(int index,String^ output, String^% Details) //checks answer for test { - try +try +{ + TTest t; + LoadTest(index,t); + lock(); + if (lib==NULL) //lib was not found { - lock(); - TTest t; - LoadTest(index,t); - if (lib==NULL) //lib was not found - { - if (output!=t.output) - return carWA; - return carAC; - } else - { - char* buf1,*buf2,*buf3,*buf4=NULL; - TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); - TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output),buf4); - Details+=gcnew String(buf4); - TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); - FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);prc2(buf4); - return res; - } - }__finally + if (output!=t.output) + return carWA; + return carAC; + } else { - unlock(); + char* buf1,*buf2,*buf3,*buf4=NULL; + TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); + TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output),buf4); + Details+=gcnew String(buf4); + TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);prc2(buf4); + return res; } +} __finally +{ + unlock(); } +} +bool TSource::CheckTL(int usedtime, int timelimit) +{ +try +{ + lock(); + if (lib==NULL) + return usedtime>timelimit; + TCheckLim prc=(TCheckLim)GetProcAddress(lib,"CheckTL"); + return prc(usedtime,timelimit); +}__finally +{ + unlock(); +} +} +bool TSource::CheckRTL(int usedrealtime, int realtimelimit) +{ +try +{ + lock(); + if (lib==NULL) + return usedrealtime>realtimelimit; + TCheckLim prc=(TCheckLim)GetProcAddress(lib,"CheckRTL"); + return prc(usedrealtime,realtimelimit); +}__finally +{ + unlock(); +} +} + void TSource::ProcessAll() //executes all actions needed to get Summary result for all tests { try @@ -375,63 +424,57 @@ sec.lpSecurityDescriptor=NULL; JOBOBJECT_BASIC_ACCOUNTING_INFORMATION acc; JOBOBJECT_EXTENDED_LIMIT_INFORMATION mem; -HANDLE job; -JOBOBJECT_ASSOCIATE_COMPLETION_PORT port; +HANDLE job=NULL; +JOBOBJECT_ASSOCIATE_COMPLETION_PORT port; ZeroMemory(&port,sizeof(port)); JOBOBJECT_BASIC_UI_RESTRICTIONS uilim; DWORD len=0; wchar_t* bufW; -char* bufA; try { - lock(); - FRes.Add(%TResult()); - TResult^ it=(TResult^)FRes[FRes.Count-1]; - it->res=trAC; - it->points=0; - it->Details=""; - it->UsedMemory=-1; - it->UsedRealTime=-1; - it->UsedTime=-1; - String^ inpath=FProblemPath+"test"+ToStr(index)+"\\in.txt"; - String^ oupath=FTempPath+"out.txt"; - String^ erpath=FTempPath+"err.txt"; - String^ pointpath=FProblemPath+"test"+ToStr(index)+"\\points.txt"; + Results[index-1]->res=trAC; + Results[index-1]->points=0; + Results[index-1]->Details=""; + Results[index-1]->UsedMemory=-1; + Results[index-1]->UsedRealTime=-1; + Results[index-1]->UsedTime=-1; + String^ inpath=ProblemPath+"test"+ToStr(index)+"\\in.txt"; + String^ oupath=TempPath+"out"+ToStr(index)+".txt"; + String^ erpath=TempPath+"err"+ToStr(index)+".txt"; + String^ pointpath=ProblemPath+"test"+ToStr(index)+"\\points.txt"; - FState=ssIsRunning; - - TTest t; - LoadTest(index,t); si.cb=sizeof(si); si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; si.wShowWindow=FALSE; - si.hStdInput=CreateFile(bufW=StrToArrW(inpath),GENERIC_READ,0,&sec,OPEN_EXISTING,0,NULL); FreeArr(bufW); + si.hStdInput=CreateFile(bufW=StrToArrW(inpath),GENERIC_READ,FILE_SHARE_READ,&sec,OPEN_EXISTING,0,NULL); FreeArr(bufW); si.hStdOutput=CreateFile(bufW=StrToArrW(oupath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); FreeArr(bufW); - si.hStdError=CreateFile(bufW=StrToArrW(erpath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); FreeArr(bufW); + si.hStdError=CreateFile(bufW=StrToArrW(erpath),GENERIC_WRITE,FILE_SHARE_WRITE,&sec,CREATE_ALWAYS,0,NULL); FreeArr(bufW); SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); - - if (!FSecurity->RunProcess(bufW=StrToArrW(FExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,&si,&pi,it->Details)) + lock(); + if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|HIGH_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details)) { FreeArr(bufW); - it->points=0; + Results[index-1]->points=0; int err=GetLastError(); if ((err==193)||(err==1455)) { - it->res=trRE; - it->Details+=gcnew String("Too large array"); + Results[index-1]->res=trRE; + Results[index-1]->Details+="Too large array"; } else { - it->res=trIE; - it->Details+=gcnew String("Can not start process"); + Results[index-1]->res=trIE; + Results[index-1]->Details+="Can not start process"; } + unlock(); return ; } FreeArr(bufW); + unlock(); job=CreateJobObject(NULL,NULL); mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY; - mem.ProcessMemoryLimit=FLim.MemoryLimit; + mem.ProcessMemoryLimit=Lim->MemoryLimit; SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem)); - port.CompletionKey=(void*)123; + port.CompletionKey=(void*)index; port.CompletionPort=CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); SetInformationJobObject(job,JobObjectAssociateCompletionPortInformation,&port,sizeof(port)); @@ -440,93 +483,74 @@ AssignProcessToJobObject(job,pi.hProcess); + SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL); + ResumeThread(pi.hThread); + DWORD start=GetTickCount(); while (true) { - if ((int)GetFileSize(si.hStdOutput,NULL)>FLim.OutputLimit) + if ((int)GetFileSize(si.hStdOutput,NULL)>Lim->OutputLimit) { TerminateJobObject(job,0); - it->res=trOL; - it->Details+=gcnew String("Size of output file excided OutputLimit"); + Results[index-1]->res=trOL; + Results[index-1]->Details+="Size of output file excided OutputLimit"; break; } QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); - if (lib==NULL) + if (CheckRTL((int)(GetTickCount()-start),Lim->RealTimeLimit)) { - if ((int)(GetTickCount()-start)>FLim.RealTimeLimit) - { TerminateJobObject(job,0); - it->res=trRTL; - it->Details+=gcnew String("Real time limit"); + Results[index-1]->res=trRTL; + Results[index-1]->Details+="Real time limit"; break; } - if ((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)>FLim.TimeLimit*10000) + if (CheckTL((int)(acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart),Lim->TimeLimit*10000)) { TerminateJobObject(job,0); - it->res=trTL; - it->Details+=gcnew String("Time Limit"); + Results[index-1]->res=trTL; + Results[index-1]->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+=gcnew String("Time Limit"); - break; - } - prc=(TCheckLim)GetProcAddress(lib,"CheckRTL"); - if (prc((int)(GetTickCount()-start),FLim.RealTimeLimit)) - { - TerminateJobObject(job,0); - it->res=trRTL; - it->Details+=gcnew String("Real time Limit"); - break; - } - } unsigned long len,key; HANDLE proc; - if (GetQueuedCompletionStatus(port.CompletionPort, &len, &key, (LPOVERLAPPED*)&proc, 1)) + if (GetQueuedCompletionStatus(port.CompletionPort, &len, &key, (LPOVERLAPPED*)&proc, 1)&&(key==index)) { DWORD code=0; bool needbreak=false; - if (key==123) switch(len) { case JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: GetExitCodeProcess(pi.hProcess,&code); if (code==5) { - it->res=trDF; - it->Details+=gcnew String("Access denied."); + Results[index-1]->res=trDF; + Results[index-1]->Details+="Access denied."; } else if (code!=0) { - it->res=trRE; - it->Details+=gcnew String("Runtime error #"+ToStr((int)code)); + Results[index-1]->res=trRE; + Results[index-1]->Details+="Runtime error #"+ToStr((int)code); } needbreak=true; break; case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: - it->res=trML; - it->Details+=gcnew String("Memory Limit"); + Results[index-1]->res=trML; + Results[index-1]->Details+="Memory Limit"; needbreak=true; break; case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: GetExitCodeProcess(pi.hProcess,&code); if (code==5) { - it->res=trDF; - it->Details+=gcnew String("Access denied."); + Results[index-1]->res=trDF; + Results[index-1]->Details+="Access denied."; } else if (code!=0) { - it->res=trRE; - it->Details+=gcnew String("Runtime error #"+ToStr((int)code)); + Results[index-1]->res=trRE; + Results[index-1]->Details+="Runtime error #"+ToStr((int)code); } needbreak=true; break; @@ -539,74 +563,74 @@ } Sleep(1); } - CloseHandle(si.hStdOutput); - CloseHandle(si.hStdInput); - Sleep(100); //waiting for file + SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL); + + CloseHandle(si.hStdOutput);si.hStdOutput=NULL; + CloseHandle(si.hStdInput);si.hStdInput=NULL; + Sleep(CONST_SLEEP); //waiting for file + QueryInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem),NULL); QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); - it->UsedMemory=mem.PeakProcessMemoryUsed; - it->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); - it->UsedRealTime=GetTickCount()-start; - if (it->res!=trAC) return; + Results[index-1]->UsedMemory=mem.PeakProcessMemoryUsed; + Results[index-1]->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); + Results[index-1]->UsedRealTime=GetTickCount()-start; + if (Results[index-1]->res!=trAC) return; if (!FileExists(oupath)) { - it->res=trWA; - it->Details+=gcnew String("No output file"); + Results[index-1]->res=trWA; + Results[index-1]->Details+="No output file"; return; } - HANDLE ouf=CreateFile(bufW=StrToArrW(oupath),GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL); FreeArr(bufW); - DWORD size=GetFileSize(ouf,NULL); - char* buf=new char[size+1]; ZeroMemory(buf,(size+1)*sizeof(char)); - ReadFile(ouf,buf,size,&len,NULL); - CloseHandle(ouf); + //Sleep(CONST_SLEEP); //waiting for closing all handles to this file - TCheckAnsRes r=CheckAnswer(index,gcnew String(buf),it->Details); - delete[] buf; + TCheckAnsRes r=CheckAnswer(index,ReadFullFile(oupath),Results[index-1]->Details); + if (r==carAC) { if (FileExists(pointpath)) - { - FILE* point; - fopen_s(&point,bufA=StrToArr(pointpath),"rt"); FreeArr(bufA); - fscanf_s(point,"%d",&it->points); - fclose(point); - } else it->points=1; + Results[index-1]->points.Parse(ReadFullFile(pointpath)); else + Results[index-1]->points=1; return ; } switch (r) { case carOE: - it->res=trOE; + Results[index-1]->res=trOE; break; case carPE: - it->res=trPE; + Results[index-1]->res=trPE; break; case carWA: - it->res=trWA; + Results[index-1]->res=trWA; break; case carIE: - it->res=trIE; + Results[index-1]->res=trIE; break; }; }__finally { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - CloseHandle(si.hStdInput); - CloseHandle(si.hStdOutput); - CloseHandle(si.hStdError); - CloseHandle(port.CompletionPort); - CloseHandle(job); - FState=ssTestComplete; - if (FTestHandler) - FTestHandler(index,(TResult^)FRes[index-1]); - unlock(); + if (pi.hProcess!=NULL) + CloseHandle(pi.hProcess); + if (pi.hThread!=NULL) + CloseHandle(pi.hThread); + if (si.hStdInput!=NULL) + CloseHandle(si.hStdInput); + if (si.hStdOutput!=NULL) + CloseHandle(si.hStdOutput); + if (si.hStdError!=NULL) + CloseHandle(si.hStdError); + if (port.CompletionPort!=NULL) + CloseHandle(port.CompletionPort); + if (job!=NULL) + CloseHandle(job); + if (TestHandler) + TestHandler(index,Results[index-1]); } } @@ -639,7 +663,6 @@ FILE* f; try { - lock(); if (FState!=ssNone) { throw "Can not load limits if state is higher than ssNone"; @@ -652,7 +675,6 @@ { fclose(f); FreeArr(buf); - unlock(); } } Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.h 2008-06-20 18:17:38 UTC (rev 270) @@ -202,6 +202,13 @@ (*compres)=(*value.compres); } + TSummary operator=(TSummary value) + { + (*res)=(*value.res); + (*compres)=(*value.compres); + return (value); + } + }; ///<summary> ///TTest holds information about one test @@ -262,18 +269,18 @@ private: String^ FSrc; //text of source String^ FExePath; //executable file - String^ FProblemPath; //path for problem + String^ FProblemPath; //path for problem *MT* String^ FCompPath; //path for compiler - String^ FTempPath; //this is the place where temporary files will be created - bool FRunAll; //if true then all tests will run (no matter on errors) - TSourceState FState; //state of source + String^ FTempPath; //this is the place where temporary files will be created + bool FRunAll; //if true then all tests will run (no matter on errors) + TSourceState FState; //state of source TCompResult FCompResult; //result of compilation - ArrayList FRes; //results of each test - TSummary FSummary; //summary results of all tests + ArrayList FRes; //results of each test *MT* + TSummary FSummary; //summary results of all tests *MT* TLimits FLim; //limits for testing - TTestHandler^ FTestHandler; //event, that occures when test is completed + TTestHandler^ FTestHandler; //event, that occures when test is completed *MT* TLang FLang; //language of source - TSecure *FSecurity; //security class + TSecure *FSecurity; //security class *MT* 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 @@ -305,6 +312,82 @@ DeleteCriticalSection(cs); delete cs; } + + void AddThread(); + void ThreadProc(); + int FCurrentTest; //current test for testing *MT* + bool FNeedTest; //if found WA, or all test completed *MT* + int FTestCnt; + ArrayList FThreads; + property int CurrentTest + { + void set(int value) + { + try + { + lock(); + FCurrentTest=value; + }__finally + { + unlock(); + } + } + + int get() + { + try + { + lock(); + return FCurrentTest; + }__finally + { + unlock(); + } + } + } + + property bool NeedTest + { + void set(bool value) + { + try + { + lock(); + FNeedTest=value; + }__finally + { + unlock(); + } + } + + bool get() + { + try + { + lock(); + return FNeedTest; + }__finally + { + unlock(); + } + } + } + + int TestCnt() + { + try + { + lock(); + return FTestCnt; + } __finally + { + unlock(); + } + } + + + bool CheckRTL(int usedrealtime, int realtimelimit); + bool CheckTL(int usedtime, int timelimit); public: TSource(); ~TSource(); @@ -329,17 +412,23 @@ try { lock(); - if (FState>=ssIsRunning) - { - throw "Can not set limits if state is ssIsRunning or higher"; - return ; - } FLim=(*value); } __finally { unlock(); } } + TLimits^ get() + { + try + { + lock(); + return %FLim; + } + __finally { + unlock(); + } + } } property String^ Src @@ -360,11 +449,6 @@ try { lock(); - if (FState!=ssNone) - { - throw "Can not set source unless state is ssNone"; - return; - } FSrc=value; } __finally { unlock(); @@ -379,11 +463,6 @@ try { lock(); - if (FState<ssCompiled) - { - throw "Can not get exepath unless state is ssCompiled or higher"; - return ""; - } return FExePath; }__finally{ unlock(); @@ -402,15 +481,11 @@ unlock(); } } + void set(String^ value) { try{ lock(); - if (FState>ssCompiled) - { - throw "Can not set problempath if state is ssIsRunning or higher"; - return ; - } FProblemPath=value; }__finally { unlock(); @@ -425,11 +500,6 @@ try { lock(); - if (FState==ssNone) - { - throw "Can not get compresult if state is ssNone"; - return %FCompResult; - } return %FCompResult; }__finally { unlock(); @@ -467,11 +537,6 @@ try { lock(); - if (FState<ssIsRunning) - { - throw "Can not get test results if state is lower than ssIsRunning"; - return (%TResult()); - } if (index>=FRes.Count) { throw "The index is not accesible"; @@ -493,17 +558,24 @@ try { lock(); - if (FState!=ssFinish) - { - throw "Can not get summary unlest state is ssFinish"; - return (%TSummary()); - } return (%FSummary); }__finally { unlock(); } }; + + void set(TSummary^ value) + { + try + { + lock(); + FSummary=(*value); + } + __finally { + unlock(); + } + } } property TTestHandler^ TestHandler @@ -552,11 +624,6 @@ try { lock(); - if (FState>ssCheckedDF) - { - throw "Can not set compiler path if state is higher than ssCheckedDF"; - return ; - } FCompPath=value; }__finally { @@ -599,11 +666,6 @@ try { lock(); - if (FState>=ssIsRunning) - { - throw "Can not set RunAll if state is higher or equal ssIsRunning"; - return; - } FRunAll=value; } __finally { @@ -631,11 +693,6 @@ try { lock(); - if (FState>=ssCheckedDF) - { - throw "Can not set Language if state is higher or equal ssCheckedDF"; - return; - } FLang=value; } __finally { Modified: ACMServer/trunk/sharp tester/SourceTest.sln =================================================================== --- ACMServer/trunk/sharp tester/SourceTest.sln 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/SourceTest.sln 2008-06-20 18:17:38 UTC (rev 270) @@ -2,6 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SourceTest", "SourceTest\SourceTest.vcproj", "{FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}" + ProjectSection(ProjectDependencies) = postProject + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4} = {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4} + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tester", "tester\tester.csproj", "{2D663DAB-3573-4CB6-95A0-2425635CFEC3}" EndProject @@ -18,11 +21,13 @@ EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Any CPU.Build.0 = Debug|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Win32.ActiveCfg = Debug|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Win32.Build.0 = Debug|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Any CPU.ActiveCfg = Release|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Any CPU.Build.0 = Release|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Mixed Platforms.Build.0 = Release|Win32 {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Win32.ActiveCfg = Release|Win32 @@ -32,17 +37,21 @@ {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Win32.ActiveCfg = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Win32.Build.0 = Debug|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Any CPU.Build.0 = Release|Any CPU {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 + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Win32.Build.0 = Release|Any CPU {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {2009FCA0-9B13-4D3D-8C89-DDCD3C40E4B4}.Debug|Any CPU.Build.0 = 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|Any CPU.Build.0 = 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 Modified: ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-20 18:17:38 UTC (rev 270) @@ -35,10 +35,13 @@ TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) { - Details=new char[30]; - strcpy(Details,"CheckAnswer from DLL\n"); if (strcmp(output,rightoutput)==0) return 0; + Details=new char[30]; + strcpy(Details,output); + strcat(Details," RIGHT: "); + strcat(Details,rightoutput); + strcat(Details,"\n"); int curo=0; for (int i=0;;i++,curo++) { Modified: ACMServer/trunk/sharp tester/tester/Program.cs =================================================================== --- ACMServer/trunk/sharp tester/tester/Program.cs 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/tester/Program.cs 2008-06-20 18:17:38 UTC (rev 270) @@ -6,6 +6,26 @@ namespace tester { + class MiniMax + { + public int min; + public int max; + public MiniMax() + { + min = 1000000000; + max = -1000000000; + } + public void update(int x) + { + min = Math.Min(min, x); + max = Math.Max(max, x); + } + public int diff() + { + return max - min; + } + }; + class Program { static void func(int x,TResult res) @@ -13,32 +33,52 @@ Console.WriteLine("test number {0}, result: {1}, details: {2}",x,TSource.TestResultToString(res.res),res.Details); } + const int INF = 1000000000; static void Main(string[] args) { - TSource c = new TSource(); - StreamReader s = new StreamReader("InData.txt",Encoding.Default); - String compiler = s.ReadLine(); - String problem = s.ReadLine(); - String temp = s.ReadLine(); - String source = s.ReadLine(); - s.Close(); - s=File.OpenText(source); - c.CompPath = compiler; - c.ProblemPath = problem; - c.LoadLimits(); - c.Src = s.ReadToEnd(); - s.Close(); - c.TempPath = temp; - c.TestHandler += new TTestHandler(func); - c.Language = (TLang)1; - c.ProcessAll(); - c.State = (TSourceState)6; - Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res),c.Summary.compres.Details,c.Summary.compres.UsedTime); - Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); - Console.WriteLine("Points: {0}", c.Summary.res.points); - Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); - Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); - Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + DateTime start=DateTime.Now; + MiniMax rt=new MiniMax(),t=new MiniMax(),mem=new MiniMax(),ct=new MiniMax(); + //for (int i = 0; i < 10000; i++) + { + TSource c = new TSource(); + StreamReader s = new StreamReader("InData.txt", Encoding.Default); + String compiler = s.ReadLine(); + String problem = s.ReadLine(); + String temp = s.ReadLine(); + String source = s.ReadLine(); + s.Close(); + s = File.OpenText(source); + c.CompPath = compiler; + c.ProblemPath = problem; + c.LoadLimits(); + c.Src = s.ReadToEnd(); + s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + c.Language = (TLang)1; + c.ProcessAll(); + c.State = (TSourceState)6; + Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res),c.Summary.compres.Details,c.Summary.compres.UsedTime); + Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + Console.WriteLine("Points: {0}", c.Summary.res.points); + Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + //Console.ReadKey(); + Console.WriteLine(" CompRes: {0}, TestRes: {1}", TSource.CompileResultToString(c.Summary.compres.res), TSource.TestResultToString(c.Summary.res.res)); + rt.update(c.Summary.res.UsedRealTime); + t.update(c.Summary.res.UsedTime); + ct.update(c.Summary.compres.UsedTime); + mem.update(c.Summary.res.UsedMemory); + /*if (c.Summary.res.res != 0) + { + System.Media.SystemSounds.Beep.Play(); + Console.ReadKey(); + }*/ + } + Console.WriteLine("Used Time: {0} ms", (System.DateTime.Now.Ticks - start.Ticks)/10000); + Console.WriteLine("MAX: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte", ct.max, t.max, rt.max, mem.max); + Console.WriteLine("Diff: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte",ct.diff(),t.diff(),rt.diff(),mem.diff()); Console.ReadKey(); } } Modified: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/limits.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -2,5 +2,5 @@ CompilationTimeLimit: 10000 MemoryLimit: 10000000 OutputLimit: 1024 -RealTimeLimit: 10000 -TimeLimit: 1000 +RealTimeLimit: 100000 +TimeLimit: 500 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test10/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test11/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test12/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test13/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test14/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test15/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test3/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test4/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test5/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test6/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test7/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test8/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/in.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/in.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/in.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/out.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/out.txt (rev 0) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/Test/test9/out.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -0,0 +1 @@ +1349 \ No newline at end of file Modified: ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt =================================================================== --- ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt 2008-06-20 14:07:46 UTC (rev 269) +++ ACMServer/trunk/sharp tester/tester/SAMPLE/source.txt 2008-06-20 18:17:38 UTC (rev 270) @@ -1,8 +1,18 @@ -program hello; -uses windows; -var a,b:integer; -begin -read(a,b); -while true do; -write(a+b); -end. \ No newline at end of file +uses Windows; var f:Thandle; begin f:=CreateFile('Hello.txt',GENERIC_WRITE,0,nil,CREATE_ALWAYS,0,0); if (f=INVALID_HANDLE_VALUE) then while true do; CloseHandle(f); end. +var a,b:Extended; +i:Integer; +x:array of Integer; +begin + read(a,b); + for i:=1 to 5700000 do + a:=sqrt(a)*sqrt(a)+((sqrt(a)*sqrt(a))/sqrt(a))/sqrt(a)-1; + for i:=1 to 180000000 do ; + for i:=1 to 20 do + begin + SetLength(x,5000000); + x[1237]:=2178; + x[5237]:=2174; + SetLength(x,0); + end; + write(a+b:0:0); +end. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-22 10:19:22
|
Revision: 273 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=273&view=rev Author: brus07 Date: 2008-06-21 06:22:31 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Add feature: can clear Result for submits from range; can view full table or last 20 submits; Modified Paths: -------------- ACMServer/trunk/web/table.php Added Paths: ----------- ACMServer/trunk/web/action.php Added: ACMServer/trunk/web/action.php =================================================================== --- ACMServer/trunk/web/action.php (rev 0) +++ ACMServer/trunk/web/action.php 2008-06-21 13:22:31 UTC (rev 273) @@ -0,0 +1,12 @@ +<a href=table.php>Table</a><br> + +<?php + + require_once("connect.php"); + + if (isset($empty) && $empty=1) + { + $sql = 'UPDATE `v3_submits` SET `result` = NULL WHERE `id` >= '.$from.' AND `id` <= '.$to; + $result = MySql_Query ($sql); + echo "Empty from $from to $to<br>"; + } Modified: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php 2008-06-21 12:59:37 UTC (rev 272) +++ ACMServer/trunk/web/table.php 2008-06-21 13:22:31 UTC (rev 273) @@ -1,12 +1,44 @@ <a href=submit.php>Submit</a><br> <a href=get.php>Get</a><br> +<?php + if (isset($full) != true || $full != 1) + { + echo "<a href=\"table.php?full=1\">Full table</a><br>"; + } + else + { + echo "<a href=\"table.php?full=0\">Small table</a><br>"; + } +?> <?php - require_once("connect.php"); - $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC LIMIT 0 , 20;"; + function getMax() + { + $sql = 'SELECT MAX(`id`) FROM `v3_submits`'; + $result = MySql_Query ($sql); + while($arr = mysql_fetch_array($result)) { + return $arr[0]; + } + return -1; + } +?> + +<FORM action = "action.php?empty=1" method=post> + Empty: <INPUT name=from value=<?php echo getMax();?> >- + <INPUT name=to value=<?php echo getMax();?> > + <INPUT type=submit value=run> +</FROM> + +<?php + $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC"; + if (isset($full) != true || $full != 1) + { + $Query .= " LIMIT 0 , 20;"; + } + $result = MySql_Query ($Query); echo "<table border=1>\n"; echo "\t<tr>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-22 10:01:43
|
Revision: 274 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=274&view=rev Author: brus07 Date: 2008-06-21 15:33:51 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Add commented define for easy compiling on different OS. Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-21 13:22:31 UTC (rev 273) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-21 22:33:51 UTC (rev 274) @@ -1,6 +1,7 @@ // This is the main DLL file. #include "stdafx.h" +//#define _WIN32_WINNT 0x0500 //need for easy compiling on different machine #include <stdio.h> #include "SourceTest.h" #include <LM.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-22 08:35:12
|
Revision: 275 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=275&view=rev Author: brus07 Date: 2008-06-22 01:35:12 -0700 (Sun, 22 Jun 2008) Log Message: ----------- Web surface sending data in XML format. Mediator can read data in XML format and work with submitList. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/web/connect.php ACMServer/trunk/web/get.php Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-22 08:35:12 UTC (rev 275) @@ -31,10 +31,13 @@ { if (base.CountClients() > 0) { - Submit submit = new Submit(message); - if (dataContainer.Add(submit) == true) + SubmitList submitList = SubmitList.CreateFromXml(message); + for (int index = 0; index < submitList.Items.Length; index++) { - base.Send(submit.ToString()); + if (dataContainer.Add(submitList.Items[index]) == true) + { + base.Send(submitList.Items[index].ToString()); + } } } } Modified: ACMServer/trunk/web/connect.php =================================================================== --- ACMServer/trunk/web/connect.php 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/web/connect.php 2008-06-22 08:35:12 UTC (rev 275) @@ -1,4 +1,5 @@ <? - @mysql_connect("127.0.0.1", "root", "root"); + @mysql_connect("localhost", "acm", "masterro"); + //@mysql_connect("127.0.0.1", "root", "root"); - mysql_select_db("test"); + mysql_select_db("acm"); Modified: ACMServer/trunk/web/get.php =================================================================== --- ACMServer/trunk/web/get.php 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/web/get.php 2008-06-22 08:35:12 UTC (rev 275) @@ -2,10 +2,22 @@ require_once("connect.php"); - $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL LIMIT 0 , 1;"; + $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL;"; $result = MySql_Query ($Query); - while($arr = mysql_fetch_array($result)) { - echo $arr[0]."$".$arr[1]; + $arr = mysql_fetch_array($result); + if ($arr != false) + { + header('Content-type: text/xml'); + echo "<?xml version=\"1.0\" encoding=\"utf-16\"?>"; + echo "<submitList xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; + do{ + echo "<submit>"; + echo "<id>".$arr[0]."</id>"; + echo "<sourceCode>".$arr[1]."</sourceCode>"; + echo "<language>2</language>"; + echo "</submit>"; + }while($arr = mysql_fetch_array($result)); + echo "</submitList>"; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-22 08:33:23
|
Revision: 271 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=271&view=rev Author: brus07 Date: 2008-06-21 04:48:54 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Submit and Result serialization XML format. This feature is using when sending information between modules. Modified Paths: -------------- ACMServer/trunk/ACMServer/Checker/Checker.csproj ACMServer/trunk/ACMServer/Checker/Class1.cs ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Library/Data/Result.cs ACMServer/trunk/ACMServer/Library/Data/Submit.cs ACMServer/trunk/ACMServer/Library/testData/data.xsd ACMServer/trunk/ACMServer/Library/testData/data.xsx ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Tester/Form1.cs Modified: ACMServer/trunk/ACMServer/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Checker/Checker.csproj 2008-06-21 11:48:54 UTC (rev 271) @@ -46,6 +46,10 @@ </Content> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Library\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> <ProjectReference Include="..\Library\LibraryExtention\LibraryExtention.csproj"> <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> <Name>LibraryExtention</Name> Modified: ACMServer/trunk/ACMServer/Checker/Class1.cs =================================================================== --- ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Checker/Class1.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -4,6 +4,7 @@ using SourceTest; using System.IO; using AcmContester.Library.LibraryExtention; +using AcmContester.Library.LibraryExtention.Data; namespace Checker { @@ -28,8 +29,11 @@ log.Loging(message, Log.Priority.INFO); log.Loging("", Log.Priority.INFO); - string code = message.Substring(message.IndexOf('$')+1); - string id = message.Substring(0, message.IndexOf('$')); + //TODO: + Submit submit = Submit.CreateFromXml(message); + string code = submit.sourceCode; + string id = submit.id.ToString(); + TSource c = new TSource(); StreamReader s = new StreamReader("InData.txt", Encoding.Default); String compiler = s.ReadLine(); @@ -67,9 +71,14 @@ if (c.Summary.compres.res != (TCompRes)0 ) { - return TSource.CompileResultToString(c.Summary.compres.res); + Result resulta = new Result(submit); + resulta.res = TSource.CompileResultToString(c.Summary.compres.res); + return resulta.ToStringX(); } - return TSource.TestResultToString(c.Summary.res.res); + //TODO: + Result result = new Result(submit); + result.res = TSource.TestResultToString(c.Summary.res.res); + return result.ToStringX(); } public static int GetResult1(string code) { Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-06-21 11:48:54 UTC (rev 271) @@ -51,6 +51,12 @@ <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -4,6 +4,7 @@ using System.Net; using System.IO; using System.Text; +using AcmContester.Library.LibraryExtention.Data; namespace AcmContester.Library.Connector.Getter { @@ -25,49 +26,25 @@ public void Send(string message) { checkAddress(); - Send2(message); + SendX(message); } public object GetInfoFromSite() { checkAddress(); - return GetInfoFromSite2(); + return GetInfoFromSiteX(); } - /* - void Send1(string message) + void SendX(string message) { - WebBrowser webBrowser = new WebBrowser(); - webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); - } - - Mutex mut = new Mutex(); - string document = ""; - object GetInfoFromSite1() - { - WebBrowser webBrowser = new WebBrowser(); - webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); - mut.WaitOne(); - return document; - } - - void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) - { - document = ((WebBrowser)sender).DocumentText; - mut.ReleaseMutex(); - } - */ - - void Send2(string message) - { string res = ""; string id = ""; try { - res = (message.Split('$'))[0]; - id = (message.Split('$'))[1]; + //TODO: + Result result = Result.CreateFromXml(message); + res = result.res; + id = result.Submit.id.ToString(); } catch (Exception) { @@ -78,7 +55,7 @@ WebResponse myResponse = myRequest.GetResponse(); myResponse.Close(); } - string GetInfoFromSite2() + string GetInfoFromSiteX() { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/get.php"); myRequest.Method = "GET"; Modified: ACMServer/trunk/ACMServer/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -8,7 +8,18 @@ public class Result { [XmlElement("submit", typeof(Submit))] - public Submit submit; + public Submit Submit + { + get + { + return submit; + } + set + { + submit = value; + } + } + private Submit submit; [XmlElement("res", typeof(string))] public string res; [XmlElement("result", typeof(int))] @@ -24,14 +35,10 @@ { } - public Submit Submit + public Result(Submit ssubmit) { - get - { - return submit; - } + submit = ssubmit; } - public Result(string message) { //TODO Modified: ACMServer/trunk/ACMServer/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -29,10 +29,25 @@ sourceCode = message.Substring(message.IndexOf('$')+1); } + public static Submit CreateFromXml(string message) + { + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submit"); + if (message == null || message == "") + return null; + string schema = Reader.ReadString("data.xsd"); + if (Xml.ValidateXmlWithSchema(message, schema) == false) + return null; + + Submit newList = XmlSerializer<Submit>.Load(message); + return newList; + } + //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML public override string ToString() { - return sourceCode; + //string result = sourceCode; + string result = XmlSerializer<Submit>.Serialization(this); + return result; } public override int GetHashCode() Modified: ACMServer/trunk/ACMServer/Library/testData/data.xsd =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsd 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsd 2008-06-21 11:48:54 UTC (rev 271) @@ -8,7 +8,7 @@ <xs:element name="language"> <!-- обмеження для ID мови програмування --> <xs:simpleType> - <xs:restriction base="xs:positiveInteger"> + <xs:restriction base="xs:int"> <xs:maxInclusive value="100" /> </xs:restriction> </xs:simpleType> @@ -26,13 +26,15 @@ </xs:element> <xs:complexType name="resultType"> <xs:sequence> - <xs:element name="submit" type="submitType" /> <xs:element name="res" type="xs:string" /> <xs:element name="result" type="xs:int" /> <xs:element name="usedTime" type="xs:double" /> <xs:element name="usedMemory" type="xs:double" /> + <xs:element name="submit" type="submitType" /> </xs:sequence> </xs:complexType> <xs:element name="result" type="resultType"> </xs:element> + <xs:element name="submit" type="submitType"> + </xs:element> </xs:schema> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Library/testData/data.xsx =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsx 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsx 2008-06-21 11:48:54 UTC (rev 271) @@ -1,26 +1,29 @@ <?xml version="1.0" encoding="utf-8"?> <!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.--> <XSDDesignerLayout Style="LeftRight" layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100"> - <submitType_XmlComplexType left="1317" top="1254" width="5292" height="2831" selected="0" zOrder="0" index="0" expanded="1"> - <language_XmlElement left="7243" top="2312" width="5292" height="714" selected="0" zOrder="1" index="2" expanded="1"> - <_x0028_language_x0029__XmlSimpleType left="13169" top="1254" width="5292" height="2831" selected="0" zOrder="4" index="0" expanded="1" /> + <submitType_XmlComplexType left="1317" top="1254" width="5292" height="2831" selected="0" zOrder="1" index="0" expanded="1"> + <language_XmlElement left="7243" top="2312" width="5292" height="714" selected="0" zOrder="2" index="2" expanded="1"> + <_x0028_language_x0029__XmlSimpleType left="13169" top="1254" width="5292" height="2831" selected="0" zOrder="5" index="0" expanded="1" /> </language_XmlElement> </submitType_XmlComplexType> - <submitList_XmlElement left="1317" top="4593" width="5292" height="2831" selected="0" zOrder="7" index="1" expanded="1"> - <_x0028_group1_x0029__XmlSequence left="7243" top="4593" width="5292" height="2831" selected="0" zOrder="9" index="0" expanded="1"> - <submit_XmlElement left="13169" top="4593" width="5292" height="2831" selected="0" zOrder="12" index="0" expanded="1"> - <language_XmlElement left="19095" top="5585" width="5292" height="714" selected="0" zOrder="32" index="2" expanded="0" /> + <submitList_XmlElement left="1317" top="4593" width="5292" height="2831" selected="0" zOrder="8" index="1" expanded="1"> + <_x0028_group1_x0029__XmlSequence left="7243" top="4593" width="5292" height="2831" selected="0" zOrder="10" index="0" expanded="1"> + <submit_XmlElement left="13169" top="4593" width="5292" height="2831" selected="0" zOrder="13" index="0" expanded="1"> + <language_XmlElement left="19095" top="5651" width="5292" height="714" selected="0" zOrder="16" index="2" expanded="0" /> </submit_XmlElement> </_x0028_group1_x0029__XmlSequence> </submitList_XmlElement> - <resultType_XmlComplexType left="1317" top="7932" width="5292" height="2831" selected="0" zOrder="14" index="2" expanded="1"> - <submit_XmlElement left="7243" top="7932" width="5292" height="2831" selected="0" zOrder="16" index="0" expanded="1"> - <language_XmlElement left="13169" top="8924" width="5292" height="714" selected="0" zOrder="28" index="2" expanded="0" /> + <resultType_XmlComplexType left="1317" top="7932" width="5292" height="2831" selected="0" zOrder="19" index="2" expanded="1"> + <submit_XmlElement left="7243" top="7932" width="5292" height="2831" selected="0" zOrder="21" index="0" expanded="1"> + <language_XmlElement left="13169" top="8990" width="5292" height="714" selected="0" zOrder="24" index="2" expanded="0" /> </submit_XmlElement> </resultType_XmlComplexType> - <result_XmlElement left="1317" top="11271" width="5292" height="2831" selected="0" zOrder="18" index="3" expanded="1"> - <submit_XmlElement left="7243" top="11271" width="5292" height="2831" selected="0" zOrder="21" index="0" expanded="1"> - <language_XmlElement left="13169" top="12263" width="5292" height="714" selected="0" zOrder="24" index="2" expanded="0" /> + <result_XmlElement left="1317" top="11271" width="5292" height="2831" selected="0" zOrder="27" index="3" expanded="1"> + <submit_XmlElement left="7243" top="11271" width="5292" height="2831" selected="0" zOrder="29" index="0" expanded="1"> + <language_XmlElement left="13169" top="12329" width="5292" height="714" selected="0" zOrder="32" index="2" expanded="0" /> </submit_XmlElement> </result_XmlElement> + <submit_XmlElement left="2910" top="14393" width="5292" height="2831" selected="0" zOrder="35" index="4" expanded="1"> + <language_XmlElement left="8836" top="15385" width="5292" height="714" selected="0" zOrder="37" index="2" expanded="0" /> + </submit_XmlElement> </XSDDesignerLayout> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -11,8 +11,8 @@ { private static SocketServerGate instance = new SocketServerGate(); - public delegate void DataArrivedDelegate(string s); - public event DataArrivedDelegate onDataArrived; + public new delegate void DataArrivedDelegate(string s); + public new event DataArrivedDelegate onDataArrived; DataMediator dataContainer = new DataMediator(); @@ -27,22 +27,24 @@ return instance; } - public void Send(string message) + public new void Send(string message) { if (base.CountClients() > 0) { - if (dataContainer.Add(new Submit(message)) == true) + Submit submit = new Submit(message); + if (dataContainer.Add(submit) == true) { - base.Send(message); + base.Send(submit.ToString()); } } } protected void DataArrived(string message) { - dataContainer.Return(new Result(message)); + Result result = Result.CreateFromXml(message); + dataContainer.Return(result); if (onDataArrived != null) - onDataArrived(message); + onDataArrived(result.ToStringX()); } } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-20 18:17:38 UTC (rev 270) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-21 11:48:54 UTC (rev 271) @@ -80,7 +80,7 @@ fullLog += "\r\n\t->"; fullLog += result; } - socket.Send(result.ToString() + "$" + message); + socket.Send(result); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) @@ -103,8 +103,15 @@ private void Form1_Load(object sender, EventArgs e) { - StreamWriter sw = File.AppendText("testerlog.txt"); - Log log = Log.GetLog(sw, Log.Priority.EMPTY); + try + { + StreamWriter sw = File.AppendText("testerlog.txt"); + Log log = Log.GetLog(sw, Log.Priority.EMPTY); + } + catch (Exception) + { + fullLog += "\r\n\tLogFile can't open. Working without logging to LogFile."; + } } private void textBox1_TextChanged(object sender, EventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-21 16:44:32
|
Revision: 272 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=272&view=rev Author: brus07 Date: 2008-06-21 05:59:37 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Start WebProject for web surface. Added Paths: ----------- ACMServer/trunk/web/ ACMServer/trunk/web/connect.php ACMServer/trunk/web/get.php ACMServer/trunk/web/insert.php ACMServer/trunk/web/set.php ACMServer/trunk/web/submit.php ACMServer/trunk/web/table.php Added: ACMServer/trunk/web/connect.php =================================================================== --- ACMServer/trunk/web/connect.php (rev 0) +++ ACMServer/trunk/web/connect.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,4 @@ +<? + @mysql_connect("127.0.0.1", "root", "root"); + + mysql_select_db("test"); Added: ACMServer/trunk/web/get.php =================================================================== --- ACMServer/trunk/web/get.php (rev 0) +++ ACMServer/trunk/web/get.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,11 @@ +<?php + + require_once("connect.php"); + + $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL LIMIT 0 , 1;"; + + $result = MySql_Query ($Query); + + while($arr = mysql_fetch_array($result)) { + echo $arr[0]."$".$arr[1]; + } \ No newline at end of file Added: ACMServer/trunk/web/insert.php =================================================================== --- ACMServer/trunk/web/insert.php (rev 0) +++ ACMServer/trunk/web/insert.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,13 @@ +<?php + + require_once("connect.php"); + + if (isset($text)) + { + echo $text; + echo "<p>"; + echo mysql_real_escape_string($text); + $Query = "INSERT INTO `v3_submits` ( `id` , `value` , `result` ) VALUES ('', '".mysql_real_escape_string($text)."', NULL);"; + + $result = MySql_Query ($Query); + } Added: ACMServer/trunk/web/set.php =================================================================== --- ACMServer/trunk/web/set.php (rev 0) +++ ACMServer/trunk/web/set.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,16 @@ +<?php + + require_once("connect.php"); + + if (isset($res) && isset($id)) + { + echo $res; + echo "<p>"; + echo $id; + $res = mysql_real_escape_string($res); + $Query = "UPDATE `v3_submits` SET `result` = \"$res\" WHERE `result` IS NULL AND `id` = $id LIMIT 1 ;"; + + echo "<p>"; + echo $Query; + $result = MySql_Query ($Query); + } \ No newline at end of file Added: ACMServer/trunk/web/submit.php =================================================================== --- ACMServer/trunk/web/submit.php (rev 0) +++ ACMServer/trunk/web/submit.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,4 @@ +<FORM action = "insert.php" method=post> + Text: <INPUT name=text> + <INPUT type=submit value=\xC2i\xE4i\xF1\xEB\xE0\xF2\xE8> +</FROM> \ No newline at end of file Added: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php (rev 0) +++ ACMServer/trunk/web/table.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,33 @@ +<a href=submit.php>Submit</a><br> +<a href=get.php>Get</a><br> + +<?php + + require_once("connect.php"); + + $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC LIMIT 0 , 20;"; + + $result = MySql_Query ($Query); + echo "<table border=1>\n"; + echo "\t<tr>\n"; + echo "\t\t<td>"; + echo "<b>id</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>value</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>result</b>"; + echo "</td>\n"; + echo "\t</tr>\n"; + while($arr = mysql_fetch_array($result)) { + echo "\t<tr>\n"; + for ($i=0; $i<3; $i++) + { + echo "\t\t<td>"; + echo $arr[$i]; + echo "</td>\n"; + } + echo "\t</tr>\n"; + } + echo "</table>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-20 14:08:32
|
Revision: 269 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=269&view=rev Author: brus07 Date: 2008-06-20 07:07:46 -0700 (Fri, 20 Jun 2008) Log Message: ----------- Added Xml functionality to Data module. Can load/save data through Xml. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/Data/Result.cs ACMServer/trunk/ACMServer/Library/Data/Submit.cs ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj ACMServer/trunk/ACMServer/Library/testData/Program.cs ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/testData/submitList.xml ACMServer/trunk/ACMServer/Library/testData/testData.csproj Added Paths: ----------- ACMServer/trunk/ACMServer/Library/LibraryExtention/Reader.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlSerializer.cs ACMServer/trunk/ACMServer/Library/testData/data.xsd ACMServer/trunk/ACMServer/Library/testData/data.xsx ACMServer/trunk/ACMServer/Library/testData/result.xml Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/testData/submitList.xsd Modified: ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] Modified: ACMServer/trunk/ACMServer/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -1,20 +1,27 @@ using System; +using System.Xml.Serialization; using AcmContester.AcmLibraryExtention.XML; namespace AcmContester.Library.LibraryExtention.Data { + [XmlRoot("result")] public class Result { - Submit submit; + [XmlElement("submit", typeof(Submit))] + public Submit submit; + [XmlElement("res", typeof(string))] + public string res; + [XmlElement("result", typeof(int))] + public int result; + [XmlElement("usedTime", typeof(double))] + public double usedTime; + [XmlElement("usedMemory", typeof(int))] + public int usedMemory; string temp; - public Result(string message) + private Result() { - //TODO - temp = message.Substring(0, message.IndexOf('$')); - string s = message.Substring(message.IndexOf('$') + 1); - submit = new Submit(s); } public Submit Submit @@ -25,10 +32,35 @@ } } + public Result(string message) + { + //TODO + temp = message.Substring(0, message.IndexOf('$')); + string s = message.Substring(message.IndexOf('$') + 1); + submit = new Submit(s); + } + + public static Result CreateFromXml(string message) + { + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "result"); + if (message == null || message == "") + return null; + string schema = Reader.ReadString("data.xsd"); + if (Xml.ValidateXmlWithSchema(message, schema) == false) + return null; + + Result result = XmlSerializer<Result>.Load(message); + return result; + } + public override string ToString() { - //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML return temp; } + public string ToStringX() + { + string result = XmlSerializer<Result>.Serialization(this); + return result; + } } } Modified: ACMServer/trunk/ACMServer/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -1,33 +1,38 @@ using System; using AcmContester.AcmLibraryExtention.XML; using System.IO; +using System.Xml; +using System.Xml.Serialization; namespace AcmContester.Library.LibraryExtention.Data { + [XmlRoot("submit")] public class Submit { - int id; - string sourceCode; - int language; + [XmlElement("id", typeof(int))] + public int id; + [XmlElement("sourceCode", typeof(string))] + public string sourceCode; + [XmlElement("language", typeof(int))] + public int language; string temp; + public Submit() + { + } + public Submit(string message) { - //TODO - TextReader reader = new StreamReader("submitList.xsd"); - string schema = reader.ReadToEnd(); - bool good = Xml.ValidateXmlWithSchema(message, schema); - if (good == false) - throw new Exception("Submit: ValidateXmlWithSchema - error"); - //id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); - //temp = message.Substring(message.IndexOf('$')+1); + //TODO: + id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); + sourceCode = message.Substring(message.IndexOf('$')+1); } //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML public override string ToString() { - return temp; + return sourceCode; } public override int GetHashCode() Modified: ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -1,8 +1,55 @@ using System; +using System.Xml.Serialization; +using System.Collections; +using AcmContester.AcmLibraryExtention.XML; -namespace Data +namespace AcmContester.Library.LibraryExtention.Data { - class SubmitList + [XmlRoot("submitList")] + public class SubmitList { + ArrayList listSubmits; + + private SubmitList() + { + listSubmits = new ArrayList(); + } + + public static SubmitList CreateFromXml(string message) + { + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); + if (message == null || message == "") + return null; + string schema = Reader.ReadString("data.xsd"); + if (Xml.ValidateXmlWithSchema(message, schema) == false) + return null; + + SubmitList newList = XmlSerializer<SubmitList>.Load(message); + return newList; + } + public override string ToString() + { + string result = XmlSerializer<SubmitList>.Serialization(this); + return result; + } + + [XmlElement("submit", typeof(Submit))] + public Submit[] Items + { + get + { + Submit[] submits = new Submit[listSubmits.Count]; + listSubmits.CopyTo(submits); + return submits; + } + set + { + if (value == null) return; + Submit[] submits = (Submit[])value; + listSubmits.Clear(); + foreach (Submit item in submits) + listSubmits.Add(item); + } + } } } Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj 2008-06-20 14:07:46 UTC (rev 269) @@ -35,7 +35,9 @@ <ItemGroup> <Compile Include="Log.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Reader.cs" /> <Compile Include="XML\Xml.cs" /> + <Compile Include="XML\XmlSerializer.cs" /> <Compile Include="XML\XmlValidator.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> Added: ACMServer/trunk/ACMServer/Library/LibraryExtention/Reader.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/Reader.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/Reader.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace AcmContester.Library.LibraryExtention +{ + public class Reader + { + static Dictionary<string, string> strings = new Dictionary<string, string>(); + public static string ReadString(string fileName, bool cash) + { + string text = null; + if (cash == false || strings.ContainsKey(fileName) == false) + { + text = ReadString(fileName); + if (cash == true) + strings[fileName] = text; + } + if (cash == true) + { + text = strings[fileName]; + } + return text; + } + + public static string ReadString(string fileName) + { + TextReader reader = new StreamReader(fileName); + return reader.ReadToEnd(); + } + } +} Added: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlSerializer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlSerializer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlSerializer.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace AcmContester.AcmLibraryExtention.XML +{ + public class XmlSerializer<T> where T : class + { + public static string Serialization(Object ob) + { + // Serialization + System.Xml.Serialization.XmlSerializer s = new System.Xml.Serialization.XmlSerializer(typeof(T)); + StringBuilder sb = new StringBuilder(); + TextWriter w = new StringWriter(sb); + s.Serialize(w, ob); + w.Close(); + return sb.ToString(); + } + + public static T Load(string message) + { + // Deserialization + T result; + TextReader r = new StringReader(message); + System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); + result = (T)serializer.Deserialize(r); + r.Close(); + return result; + } + } +} Modified: ACMServer/trunk/ACMServer/Library/testData/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Program.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/testData/Program.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -1,7 +1,6 @@ using System; +using AcmContester.Library.LibraryExtention; using AcmContester.Library.LibraryExtention.Data; -using System.IO; -using AcmContester.AcmLibraryExtention.XML; namespace testData { @@ -9,12 +8,25 @@ { static void Main(string[] args) { - string message = (new StreamReader("submitList.xml")).ReadToEnd(); - message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); - if (message != null && message != "") + DateTime start = DateTime.Now; + for (int i = 0; i < 1; i++) { - Submit submit = new Submit(message); + string submitListMessage = Reader.ReadString("submitList.xml"); + SubmitList submitList = SubmitList.CreateFromXml(submitListMessage); + string s1 = submitList.ToString(); + if (submitListMessage != s1) + throw new Exception(); + + string resultMessage = Reader.ReadString("result.xml"); + Result result = Result.CreateFromXml(resultMessage); + string s2 = result.ToStringX(); + if (resultMessage != s2) + throw new Exception(); + if (i % 100 == 0) + Console.WriteLine(i); } + TimeSpan dur = DateTime.Now - start; + Console.WriteLine(dur.ToString()); } } } Modified: ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs 2008-06-19 23:03:23 UTC (rev 268) +++ ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs 2008-06-20 14:07:46 UTC (rev 269) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] Copied: ACMServer/trunk/ACMServer/Library/testData/data.xsd (from rev 268, ACMServer/trunk/ACMServer/Library/testData/submitList.xsd) =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsd (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsd 2008-06-20 14:07:46 UTC (rev 269) @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<xs:schema id="XMLSchema1" elementFormDefault="qualified" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:complexType name="submitType"> + <xs:sequence maxOccurs="1"> + <!-- потрібно щоб ці записи могли слідувати у довільному порядку --> + <xs:element name="id" type="xs:positiveInteger" /> + <xs:element name="sourceCode" type="xs:string" /> + <xs:element name="language"> + <!-- обмеження для ID мови програмування --> + <xs:simpleType> + <xs:restriction base="xs:positiveInteger"> + <xs:maxInclusive value="100" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="submitList"> + <xs:complexType> + <xs:sequence> + <xs:sequence> + <xs:element name="submit" type="submitType" maxOccurs="unbounded" minOccurs="0" /> + </xs:sequence> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:complexType name="resultType"> + <xs:sequence> + <xs:element name="submit" type="submitType" /> + <xs:element name="res" type="xs:string" /> + <xs:element name="result" type="xs:int" /> + <xs:element name="usedTime" type="xs:double" /> + <xs:element name="usedMemory" type="xs:double" /> + </xs:sequence> + </xs:complexType> + <xs:element name="result" type="resultType"> + </xs:element> +</xs:schema> \ No newline at end of file Added: ACMServer/trunk/ACMServer/Library/testData/data.xsx =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/data.xsx (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/data.xsx 2008-06-20 14:07:46 UTC (rev 269) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.--> +<XSDDesignerLayout Style="LeftRight" layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100"> + <submitType_XmlComplexType left="1317" top="1254" width="5292" height="2831" selected="0" zOrder="0" index="0" expanded="1"> + <language_XmlElement left="7243" top="2312" width="5292" height="714" selected="0" zOrder="1" index="2" expanded="1"> + <_x0028_language_x0029__XmlSimpleType left="13169" top="1254" width="5292" height="2831" selected="0" zOrder="4" index="0" expanded="1" /> + </language_XmlElement> + </submitType_XmlComplexType> + <submitList_XmlElement left="1317" top="4593" width="5292" height="2831" selected="0" zOrder="7" index="1" expanded="1"> + <_x0028_group1_x0029__XmlSequence left="7243" top="4593" width="5292" height="2831" selected="0" zOrder="9" index="0" expanded="1"> + <submit_XmlElement left="13169" top="4593" width="5292" height="2831" selected="0" zOrder="12" index="0" expanded="1"> + <language_XmlElement left="19095" top="5585" width="5292" height="714" selected="0" zOrder="32" index="2" expanded="0" /> + </submit_XmlElement> + </_x0028_group1_x0029__XmlSequence> + </submitList_XmlElement> + <resultType_XmlComplexType left="1317" top="7932" width="5292" height="2831" selected="0" zOrder="14" index="2" expanded="1"> + <submit_XmlElement left="7243" top="7932" width="5292" height="2831" selected="0" zOrder="16" index="0" expanded="1"> + <language_XmlElement left="13169" top="8924" width="5292" height="714" selected="0" zOrder="28" index="2" expanded="0" /> + </submit_XmlElement> + </resultType_XmlComplexType> + <result_XmlElement left="1317" top="11271" width="5292" height="2831" selected="0" zOrder="18" index="3" expanded="1"> + <submit_XmlElement left="7243" top="11271" width="5292" height="2831" selected="0" zOrder="21" index="0" expanded="1"> + <language_XmlElement left="13169" top="12263" width="5292" height="714" selected="0" zOrder="24" index="2" expanded="0" /> + </submit_XmlElement> + </result_XmlElement> +</XSDDesignerLayout> \ No newline at end of file Added: ACMServer/trunk/ACMServer/Library/testData/result.xml =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/result.xml (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/result.xml 2008-06-20 14:07:46 UTC (rev 269) @@ -0,0 +1,23 @@ +\xFF\xFE< |
From: <br...@us...> - 2008-06-19 23:03:16
|
Revision: 268 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=268&view=rev Author: brus07 Date: 2008-06-19 16:03:23 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Added test solution for testing Data. Working whit XML for Submit/Result. Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln ACMServer/trunk/ACMServer/Library/Data/Data.csproj ACMServer/trunk/ACMServer/Library/Data/Submit.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs ACMServer/trunk/ACMServer/Library/testData/ ACMServer/trunk/ACMServer/Library/testData/Program.cs ACMServer/trunk/ACMServer/Library/testData/Properties/ ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/testData/submitList.xml ACMServer/trunk/ACMServer/Library/testData/submitList.xsd ACMServer/trunk/ACMServer/Library/testData/testData.csproj Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 23:03:23 UTC (rev 268) @@ -23,6 +23,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testData", "Library\testData\testData.csproj", "{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -61,6 +63,10 @@ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.Build.0 = Debug|Any CPU {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.ActiveCfg = Release|Any CPU {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.Build.0 = Release|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -69,6 +75,7 @@ {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} + {4EB54D66-105B-4CFD-8883-CBE7CA70AFA5} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} Modified: ACMServer/trunk/ACMServer/Library/Data/Data.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 23:03:23 UTC (rev 268) @@ -29,12 +29,14 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.XML" /> </ItemGroup> <ItemGroup> <Compile Include="DataMediator.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Result.cs" /> <Compile Include="Submit.cs" /> + <Compile Include="SubmitList.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj"> Modified: ACMServer/trunk/ACMServer/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -7,36 +7,21 @@ public class Submit { int id; + string sourceCode; + int language; + string temp; public Submit(string message) { //TODO - message = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"+ -@"<submitList> - <submit> - <id>123</id> - <sourceCode>asd asd asd asd</sourceCode> - <language>2</language> - </submit> - <submit> - <id>123</id> - <sourceCode>asd asd asd asd</sourceCode> - <language>2</language> - </submit> - <submit> - <id>123</id> - <sourceCode>asd asd asd asd</sourceCode> - <language>0</language> - </submit> -</submitList> -"; - TextReader reader = new StreamReader("submit.xsd"); + TextReader reader = new StreamReader("submitList.xsd"); string schema = reader.ReadToEnd(); - string xml = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); - bool good = Xml.ValidateXmlWithSchema(xml, schema); - id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); - temp = message.Substring(message.IndexOf('$')+1); + bool good = Xml.ValidateXmlWithSchema(message, schema); + if (good == false) + throw new Exception("Submit: ValidateXmlWithSchema - error"); + //id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); + //temp = message.Substring(message.IndexOf('$')+1); } //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML Added: ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/SubmitList.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,8 @@ +using System; + +namespace Data +{ + class SubmitList + { + } +} Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -38,8 +38,19 @@ { //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); XmlDocument document = new XmlDocument(); - document.LoadXml(fullXml); - return document.SelectSingleNode("descendant::" + xmlPath).OuterXml; + string result = null; + try + { + document.LoadXml(fullXml); + XmlNode node = document.SelectSingleNode("descendant::" + xmlPath); + if (node != null) + result = node.OuterXml; + } + catch (XmlException ex) + { + throw ex; + } + return result; } public static bool ValidateXmlWithSchema(string xml, string schema) Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs 2008-06-19 15:15:40 UTC (rev 267) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -20,8 +20,9 @@ public bool Validate(string xmlSchema) { XmlSchema schema = new XmlSchema(); - XmlSchema.Read(new StringReader(xmlSchema), ValidationCallBack); + schema = XmlSchema.Read(new StringReader(xmlSchema), ValidationXmlSchemaCallBack); + // Create the XmlSchemaSet class. XmlSchemaSet schemas = new XmlSchemaSet(); @@ -32,7 +33,7 @@ XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Schema; settings.Schemas = schemas; - settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); + settings.ValidationEventHandler += new ValidationEventHandler(ValidationXmlCallBack); // Create the XmlReader object. XmlReader reader = XmlReader.Create(new StringReader(xmlDocument), settings); @@ -45,16 +46,15 @@ return validity; } - // Happen validation errors. - private void ValidationCallBack1(object sender, ValidationEventArgs e) + // Happen validation errors when read XmlSchema + private void ValidationXmlSchemaCallBack(object sender, ValidationEventArgs e) { throw new XmlSchemaException(e.Message); } - // Happen validation errors. - private void ValidationCallBack(object sender, ValidationEventArgs e) + // Happen validation errors when read Xml + private void ValidationXmlCallBack(object sender, ValidationEventArgs e) { - //Console.WriteLine("Validation Error: {0}", e.Message); validity = false; } } Property changes on: ACMServer/trunk/ACMServer/Library/testData ___________________________________________________________________ Name: svn:ignore + bin obj testData.csproj.user Added: ACMServer/trunk/ACMServer/Library/testData/Program.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Program.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/Program.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,20 @@ +using System; +using AcmContester.Library.LibraryExtention.Data; +using System.IO; +using AcmContester.AcmLibraryExtention.XML; + +namespace testData +{ + class Program + { + static void Main(string[] args) + { + string message = (new StreamReader("submitList.xml")).ReadToEnd(); + message = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); + if (message != null && message != "") + { + Submit submit = new Submit(message); + } + } + } +} Added: ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/Properties/AssemblyInfo.cs 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("testData")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("testData")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5359de90-a5a3-44e7-87e0-ce0156aa22eb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/ACMServer/Library/testData/submitList.xml =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/submitList.xml (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/submitList.xml 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<submitList> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>2</language> + </submit> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>2</language> + </submit> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>1</language> + </submit> +</submitList> Added: ACMServer/trunk/ACMServer/Library/testData/submitList.xsd =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/submitList.xsd (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/submitList.xsd 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<xs:schema id="XMLSchema1" elementFormDefault="qualified" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:complexType name="submitType"> + <xs:sequence maxOccurs="1"> + <!-- потрібно щоб ці записи могли слідувати у довільному порядку --> + <xs:element name="id" type="xs:positiveInteger"/> + <xs:element name="sourceCode" type="xs:string" /> + <xs:element name="language"> + <!-- обмеження для ID мови програмування --> + <xs:simpleType> + <xs:restriction base="xs:positiveInteger"> + <xs:maxInclusive value="100" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:element name="submitList"> + <xs:complexType> + <xs:sequence> + <xs:sequence> + <xs:element name="submit" type="submitType" maxOccurs="unbounded" minOccurs="0" /> + </xs:sequence> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> \ No newline at end of file Added: ACMServer/trunk/ACMServer/Library/testData/testData.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/testData/testData.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Library/testData/testData.csproj 2008-06-19 23:03:23 UTC (rev 268) @@ -0,0 +1,66 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>testData</RootNamespace> + <AssemblyName>testData</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> + <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="submitList.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> + <ItemGroup> + <None Include="submitList.xsd"> + <SubType>Designer</SubType> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-19 15:16:08
|
Revision: 267 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=267&view=rev Author: brus07 Date: 2008-06-19 08:15:40 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Deleted not used testRun project Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugins/testRun/ Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:43:49 UTC (rev 266) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 15:15:40 UTC (rev 267) @@ -17,8 +17,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsFramework", "Plugins\PluginsFramework\PluginsFramework.csproj", "{69FB4176-F298-4AF7-B714-B6758AA9A58E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testRun", "Plugins\testRun\testRun.csproj", "{A855D392-4817-4408-80CE-61D8C8E77322}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebGatePlugin", "Plugins\MediatorPlugins\WebGatePlugin\WebGatePlugin.csproj", "{20B192BC-FD4D-4ED5-90F5-B5994F995238}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketServerGatePlugin", "Plugins\MediatorPlugins\SocketServerGatePlugin\SocketServerGatePlugin.csproj", "{9462E3BD-67AD-4887-BF4C-8B6A25048941}" @@ -51,10 +49,6 @@ {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Debug|Any CPU.Build.0 = Debug|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.ActiveCfg = Release|Any CPU {69FB4176-F298-4AF7-B714-B6758AA9A58E}.Release|Any CPU.Build.0 = Release|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A855D392-4817-4408-80CE-61D8C8E77322}.Release|Any CPU.Build.0 = Release|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Debug|Any CPU.Build.0 = Debug|Any CPU {20B192BC-FD4D-4ED5-90F5-B5994F995238}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -77,7 +71,6 @@ {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} - {A855D392-4817-4408-80CE-61D8C8E77322} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {B75187D7-2032-44F3-AC12-20804C7229AC} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} {20B192BC-FD4D-4ED5-90F5-B5994F995238} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} {9462E3BD-67AD-4887-BF4C-8B6A25048941} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-19 14:43:41
|
Revision: 266 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=266&view=rev Author: brus07 Date: 2008-06-19 07:43:49 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Create new project for DataModule and moved one to this project Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln ACMServer/trunk/ACMServer/ACMTester.sln ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj Added Paths: ----------- ACMServer/trunk/ACMServer/Library/Data/ ACMServer/trunk/ACMServer/Library/Data/Data.csproj ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs ACMServer/trunk/ACMServer/Library/Data/Properties/ ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/Data/Result.cs ACMServer/trunk/ACMServer/Library/Data/Submit.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/ Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:24:30 UTC (rev 265) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-06-19 14:43:49 UTC (rev 266) @@ -23,6 +23,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketServerGatePlugin", "Plugins\MediatorPlugins\SocketServerGatePlugin\SocketServerGatePlugin.csproj", "{9462E3BD-67AD-4887-BF4C-8B6A25048941}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -61,6 +63,10 @@ {9462E3BD-67AD-4887-BF4C-8B6A25048941}.Debug|Any CPU.Build.0 = Debug|Any CPU {9462E3BD-67AD-4887-BF4C-8B6A25048941}.Release|Any CPU.ActiveCfg = Release|Any CPU {9462E3BD-67AD-4887-BF4C-8B6A25048941}.Release|Any CPU.Build.0 = Release|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -68,6 +74,7 @@ GlobalSection(NestedProjects) = preSolution {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890} {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} {A855D392-4817-4408-80CE-61D8C8E77322} = {D80861F5-3751-4D49-884B-1A10FE1BCB07} Modified: ACMServer/trunk/ACMServer/ACMTester.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMTester.sln 2008-06-19 14:24:30 UTC (rev 265) +++ ACMServer/trunk/ACMServer/ACMTester.sln 2008-06-19 14:43:49 UTC (rev 266) @@ -11,6 +11,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checker", "Checker\Checker.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Library\Data\Data.csproj", "{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.ActiveCfg = Release|Any CPU {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.Build.0 = Release|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -40,5 +46,6 @@ GlobalSection(NestedProjects) = preSolution {211DD6A5-2D73-439E-8722-ED2C89ED1DDB} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0} {A8135069-F8BA-4E5D-835F-3FF3F350AA5D} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0} + {30C0EFA3-36A8-4C6F-8FEC-28F771D4933F} = {72651BCE-2999-49F0-8B33-4F6E4EE824D0} EndGlobalSection EndGlobal Property changes on: ACMServer/trunk/ACMServer/Library/Data ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/ACMServer/Library/Data/Data.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Data.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/Data.csproj 2008-06-19 14:43:49 UTC (rev 266) @@ -0,0 +1,53 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Data</RootNamespace> + <AssemblyName>Data</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="DataMediator.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Result.cs" /> + <Compile Include="Submit.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Copied: ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs (from rev 262, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/DataMediator.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/DataMediator.cs 2008-06-19 14:43:49 UTC (rev 266) @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Collections; + +namespace AcmContester.Library.LibraryExtention.Data +{ + public class DataMediator + { + const int secondToLive = 60; + + Dictionary<int, DateTime> d = new Dictionary<int, DateTime>(); + + /// <summary> + /// \xDF\xEA\xF9\xEE \xF1\xE0\xE1\xEC\xB3\xF2 \xF3 \xF7\xE5\xF0\xE7\xB3 \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xFC\xF1\xFF \xE1\xB3\xEB\xFC\xF8\xE5 \xED\xB3\xE6 secondToLive \xF1\xE5\xEA\xF3\xED\xE4, \xF2\xEE \xE2\xB3\xED \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xE8\xE4\xE0\xEB\xFF\xBA\xF2\xFC\xF1\xFF \xE7 \xED\xE5\xBF + /// </summary> + private void DeleteOld() + { + DateTime now = DateTime.Now; + ArrayList keysToDelete = new ArrayList(); + foreach(KeyValuePair<int,DateTime> elem in d) + { + TimeSpan ts = now - elem.Value; + if (ts.TotalSeconds > secondToLive) + { + keysToDelete.Add(elem.Key); + } + } + foreach (int key in keysToDelete) + { + d.Remove(key); + } + } + + private bool Contains(int id) + { + return d.ContainsKey(id); + } + + public bool Add(Submit data) + { + DeleteOld(); + if (Contains(data.GetHashCode()) == false) + { + d.Add(data.GetHashCode(), DateTime.Now); + return true; + } + return false; + } + + public void Return(Result data) + { + DeleteOld(); + if (Contains(data.Submit.GetHashCode()) == true) + { + d.Remove(data.Submit.GetHashCode()); + } + } + } +} Added: ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/Properties/AssemblyInfo.cs 2008-06-19 14:43:49 UTC (rev 266) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Data")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("Data")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f7c27001-7067-40b6-b145-a1dfe887b41d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Copied: ACMServer/trunk/ACMServer/Library/Data/Result.cs (from rev 262, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Result.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Result.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/Result.cs 2008-06-19 14:43:49 UTC (rev 266) @@ -0,0 +1,34 @@ +using System; +using AcmContester.AcmLibraryExtention.XML; + +namespace AcmContester.Library.LibraryExtention.Data +{ + public class Result + { + Submit submit; + + string temp; + + public Result(string message) + { + //TODO + temp = message.Substring(0, message.IndexOf('$')); + string s = message.Substring(message.IndexOf('$') + 1); + submit = new Submit(s); + } + + public Submit Submit + { + get + { + return submit; + } + } + + public override string ToString() + { + //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML + return temp; + } + } +} Copied: ACMServer/trunk/ACMServer/Library/Data/Submit.cs (from rev 264, ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/Data/Submit.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/Data/Submit.cs 2008-06-19 14:43:49 UTC (rev 266) @@ -0,0 +1,53 @@ +using System; +using AcmContester.AcmLibraryExtention.XML; +using System.IO; + +namespace AcmContester.Library.LibraryExtention.Data +{ + public class Submit + { + int id; + string temp; + + public Submit(string message) + { + //TODO + message = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"+ +@"<submitList> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>2</language> + </submit> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>2</language> + </submit> + <submit> + <id>123</id> + <sourceCode>asd asd asd asd</sourceCode> + <language>0</language> + </submit> +</submitList> +"; + TextReader reader = new StreamReader("submit.xsd"); + string schema = reader.ReadToEnd(); + string xml = Xml.GetOuterXmlOfSingleNodeFromXpath(message, "submitList"); + bool good = Xml.ValidateXmlWithSchema(xml, schema); + id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); + temp = message.Substring(message.IndexOf('$')+1); + } + + //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML + public override string ToString() + { + return temp; + } + + public override int GetHashCode() + { + return id; + } + } +} Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-19 14:24:30 UTC (rev 265) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-19 14:43:49 UTC (rev 266) @@ -1,6 +1,6 @@ using System; using AcmContester.Library.Connector; -using AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data; +using AcmContester.Library.LibraryExtention.Data; namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin { Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-19 14:24:30 UTC (rev 265) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-19 14:43:49 UTC (rev 266) @@ -31,9 +31,6 @@ <Reference Include="System" /> </ItemGroup> <ItemGroup> - <Compile Include="Data\DataMediator.cs" /> - <Compile Include="Data\Result.cs" /> - <Compile Include="Data\Submit.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SocketServerGate.cs" /> <Compile Include="SocketServerGatePlugin.cs" /> @@ -43,6 +40,10 @@ <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> <Name>Connector</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Library\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Library\LibraryExtention\LibraryExtention.csproj"> <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> <Name>LibraryExtention</Name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-19 14:24:35
|
Revision: 265 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=265&view=rev Author: brus07 Date: 2008-06-19 07:24:30 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Start to work with XMLSchema Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj Added Paths: ----------- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj 2008-06-18 14:29:02 UTC (rev 264) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/LibraryExtention.csproj 2008-06-19 14:24:30 UTC (rev 265) @@ -35,7 +35,8 @@ <ItemGroup> <Compile Include="Log.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Xml.cs" /> + <Compile Include="XML\Xml.cs" /> + <Compile Include="XML\XmlValidator.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Copied: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs (from rev 264, ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs) =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/Xml.cs 2008-06-19 14:24:30 UTC (rev 265) @@ -0,0 +1,51 @@ +using System; +using System.Collections; +using System.Xml; + +namespace AcmContester.AcmLibraryExtention.XML +{ + public class Xml + { + XmlDocument document = new XmlDocument(); + + string name; + string xmlDeclaration = ""; + + public string Name + { + get + { + return name; + } + } + + public Xml(string str) + { + document.LoadXml(str); + if (document.ChildNodes[0].NodeType == XmlNodeType.XmlDeclaration) + { + xmlDeclaration = document.ChildNodes[0].OuterXml; + document.RemoveChild(document.FirstChild); + } + name = document.FirstChild.Name; + } + public override string ToString() + { + return document.OuterXml; + } + + public static string GetOuterXmlOfSingleNodeFromXpath(string fullXml, string xmlPath) + { + //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); + XmlDocument document = new XmlDocument(); + document.LoadXml(fullXml); + return document.SelectSingleNode("descendant::" + xmlPath).OuterXml; + } + + public static bool ValidateXmlWithSchema(string xml, string schema) + { + XmlValidator validator = new XmlValidator(xml); + return validator.Validate(schema); + } + } +} Added: ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/XML/XmlValidator.cs 2008-06-19 14:24:30 UTC (rev 265) @@ -0,0 +1,61 @@ +using System; +using System.Xml.Schema; +using System.Xml; +using System.IO; + +namespace AcmContester.AcmLibraryExtention.XML +{ + class XmlValidator + { + string xmlDocument; + + bool validity; + + public XmlValidator(string xml) + { + xmlDocument = xml; + } + + + public bool Validate(string xmlSchema) + { + XmlSchema schema = new XmlSchema(); + XmlSchema.Read(new StringReader(xmlSchema), ValidationCallBack); + + // Create the XmlSchemaSet class. + XmlSchemaSet schemas = new XmlSchemaSet(); + + // Add the schema to the collection. + schemas.Add(schema); + + // Set the validation settings. + XmlReaderSettings settings = new XmlReaderSettings(); + settings.ValidationType = ValidationType.Schema; + settings.Schemas = schemas; + settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); + + // Create the XmlReader object. + XmlReader reader = XmlReader.Create(new StringReader(xmlDocument), settings); + + validity = true; + + // Parse the file. + while (reader.Read() && validity) ; + + return validity; + } + + // Happen validation errors. + private void ValidationCallBack1(object sender, ValidationEventArgs e) + { + throw new XmlSchemaException(e.Message); + } + + // Happen validation errors. + private void ValidationCallBack(object sender, ValidationEventArgs e) + { + //Console.WriteLine("Validation Error: {0}", e.Message); + validity = false; + } + } +} Deleted: ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-18 14:29:02 UTC (rev 264) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-19 14:24:30 UTC (rev 265) @@ -1,42 +0,0 @@ -using System; -using System.Collections; -using System.Xml; - -namespace AcmContester.AcmLibraryExtention -{ - public class Xml - { - XmlDocument document = new XmlDocument(); - - string name; - - public string Name - { - get - { - return name; - } - } - - public Xml(string str) - { - document.LoadXml(str); - //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); - } - public override string ToString() - { - return document.OuterXml; - } - - public Xml[] GetElements() - { - XmlNodeList nodes = document.ChildNodes; - Xml[] result = new Xml[nodes.Count]; - for (int index = 0; index < nodes.Count; index++) - { - result[index] = new Xml(nodes[index].OuterXml); - } - 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-18 14:29:06
|
Revision: 264 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=264&view=rev Author: brus07 Date: 2008-06-18 07:29:02 -0700 (Wed, 18 Jun 2008) Log Message: ----------- Attempt to used XmlDocument in Submit, but now it don't work. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-18 13:22:31 UTC (rev 263) +++ ACMServer/trunk/ACMServer/Library/LibraryExtention/Xml.cs 2008-06-18 14:29:02 UTC (rev 264) @@ -1,14 +1,14 @@ using System; using System.Collections; +using System.Xml; namespace AcmContester.AcmLibraryExtention { public class Xml { - string data; + XmlDocument document = new XmlDocument(); string name; - Xml[] elements; public string Name { @@ -20,25 +20,23 @@ public Xml(string str) { - data = str; - + document.LoadXml(str); + //XmlNodeList nodes = doc.SelectNodes("descendant::root/submit"); } public override string ToString() { - return data; + return document.OuterXml; } public Xml[] GetElements() { - /* - ArrayList arr = new ArrayList(); - Xml[] result = new Xml[arr.Count]; - for (int index = 0; index < arr.Count; index++) + XmlNodeList nodes = document.ChildNodes; + Xml[] result = new Xml[nodes.Count]; + for (int index = 0; index < nodes.Count; index++) { - result[index] = (Xml)arr[index]; + result[index] = new Xml(nodes[index].OuterXml); } - */ - return elements; + return result; } } -} \ No newline at end of file +} Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs 2008-06-18 13:22:31 UTC (rev 263) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/Data/Submit.cs 2008-06-18 14:29:02 UTC (rev 264) @@ -3,7 +3,7 @@ namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin.Data { - class Submit + public class Submit { Xml data; @@ -13,6 +13,7 @@ public Submit(string message) { //TODO + //data = new Xml(message); id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); temp = message.Substring(message.IndexOf('$')+1); } @@ -25,14 +26,6 @@ public override int GetHashCode() { - //HACK: - /* - int result = 0; - for (int i = 0; i < temp.Length; i++) - { - result *= 991; - result += (int)temp[i]; - }*/ return id; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-18 13:22:23
|
Revision: 263 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=263&view=rev Author: brus07 Date: 2008-06-18 06:22:31 -0700 (Wed, 18 Jun 2008) Log Message: ----------- LoadingList of Dlls work in ThreadPool, because don't waint this in start program Modified Paths: -------------- ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-17 15:36:50 UTC (rev 262) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-18 13:22:31 UTC (rev 263) @@ -28,6 +28,12 @@ { kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.onWorkingData += WorkingData; + System.Threading.ThreadPool.QueueUserWorkItem(RunLoadDll); + //kernel.LoadLists(); + } + + void RunLoadDll(Object ob) + { kernel.LoadLists(); } @@ -61,7 +67,8 @@ private void Disconnnect() { - kernel.SendToAll("stop"); + if (kernel != null) + kernel.SendToAll("stop"); } Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-17 15:36:50 UTC (rev 262) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-18 13:22:31 UTC (rev 263) @@ -18,7 +18,6 @@ plugin.onDataArrived += DataArrivedFromClientList; plugin.onWorkingData += WorkingData; } - testerSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Tester"); foreach (BaseMediatorPlugin plugin in testerSideList) { @@ -37,16 +36,22 @@ private void DataArrivedFromClientList(string message) { - for (int index = 0; index < testerSideList.Count; index++) + if (testerSideList != null) { - ((BaseMediatorPlugin)testerSideList[index]).Send(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++) + if (clientSideList != null) { - ((BaseMediatorPlugin)clientSideList[index]).Send(message); + for (int index = 0; index < clientSideList.Count; index++) + { + ((BaseMediatorPlugin)clientSideList[index]).Send(message); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-17 15:38:16
|
Revision: 262 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=262&view=rev Author: Oracle_ Date: 2008-06-17 08:36:50 -0700 (Tue, 17 Jun 2008) Log Message: ----------- Fixed bug with RealTime limit. Modified Paths: -------------- ACMServer/trunk/sharp tester/ReadMe.txt ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp Modified: ACMServer/trunk/sharp tester/ReadMe.txt =================================================================== --- ACMServer/trunk/sharp tester/ReadMe.txt 2008-06-17 09:02:14 UTC (rev 261) +++ ACMServer/trunk/sharp tester/ReadMe.txt 2008-06-17 15:36:50 UTC (rev 262) @@ -12,7 +12,9 @@ 3. \xD3 \xEF\xE0\xEF\xEA\xF3 SAMPLE \xE4\xEE\xE4\xE0\xF2\xE8 \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0 Delphi, \xE0 \xF3 \xEF\xE0\xEF\xEA\xF3 includeD7 \xE4\xEE\xE4\xE0\xF2\xE8 \xED\xE5\xEE\xE1\xF5\xB3\xE4\xED\xB3 \xE4\xEB\xFF \xF0\xEE\xE1\xEE\xF2\xE8 \xEC\xEE\xE4\xF3\xEB\xB3. 4. \xC4\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xEE\xF2\xF0\xB3\xE1\xE5\xED .NET Framework 2.0 \xE0\xE1\xEE \xE2\xE8\xF9\xE5. -5. ϳ\xF1\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xEE\xEC\xB3\xF1\xF2\xB3\xF2\xFC \xE4\xEE \xF4\xE0\xE9\xEB\xF3 tester.exe \xF4\xE0\xE9\xEB TestLibrary.dll i +5. \xC4\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF TestLibrary \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE4\xEE \xEF\xF0\xEE\xE5\xEA\xF2\xF3 \xE4\xEE\xE4\xE0\xF2\xE8 *.def \xF4\xE0\xE9\xEB \xB3 + \xE2\xE2\xE5\xF1\xF2\xE8 \xE9\xEE\xE3\xEE \xE2 \xEE\xEF\xF6\xB3\xFF\xF5 \xEF\xF0\xEE\xE5\xEA\xF2\xF3. +6. ϳ\xF1\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xEE\xEC\xB3\xF1\xF2\xB3\xF2\xFC \xE4\xEE \xF4\xE0\xE9\xEB\xF3 tester.exe \xF4\xE0\xE9\xEB TestLibrary.dll i SourceTest.dll //////////////////////////////////////////////////////////////////////// ///////////////////////\xC7\xC0\xCF\xD3\xD1\xCA \xB2 \xC2\xC8\xCA\xCE\xCD\xC0\xCD\xCD\xDF/////////////////////////////// Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-17 09:02:14 UTC (rev 261) +++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-06-17 15:36:50 UTC (rev 262) @@ -1,7 +1,6 @@ // This is the main DLL file. #include "stdafx.h" -//#define _WIN32_WINNT 0x0500 #include <stdio.h> #include "SourceTest.h" #include <LM.h> @@ -349,23 +348,6 @@ } } -BOOL DelPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) //deletes privilege from process token -{ -TOKEN_PRIVILEGES tp; -LUID luid; -if (!LookupPrivilegeValue( NULL,lpszPrivilege,&luid)) - return FALSE; -tp.PrivilegeCount = 1; -tp.Privileges[0].Luid = luid; -tp.Privileges[0].Attributes = SE_PRIVILEGE_REMOVED; - -if ( !AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),(PTOKEN_PRIVILEGES) NULL,(PDWORD) NULL) ) - return FALSE; -if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) - return FALSE; -return TRUE; -} - BOOL AddPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) //adds privilege to process token { TOKEN_PRIVILEGES tp; @@ -383,53 +365,6 @@ return TRUE; } -void DeletePrivileges(HANDLE proc) //deletes all privileges from process token -{ - HANDLE hToken; - try - { - OpenProcessToken(proc,TOKEN_ALL_ACCESS,&hToken); - DelPrivilege(hToken,SE_ASSIGNPRIMARYTOKEN_NAME); - DelPrivilege(hToken,SE_AUDIT_NAME); - DelPrivilege(hToken,SE_BACKUP_NAME); - DelPrivilege(hToken,SE_CHANGE_NOTIFY_NAME); - DelPrivilege(hToken,SE_CREATE_GLOBAL_NAME); - DelPrivilege(hToken,SE_CREATE_PAGEFILE_NAME); - DelPrivilege(hToken,SE_CREATE_PERMANENT_NAME); - DelPrivilege(hToken,SE_CREATE_SYMBOLIC_LINK_NAME); - DelPrivilege(hToken,SE_CREATE_TOKEN_NAME); - DelPrivilege(hToken,SE_DEBUG_NAME); - DelPrivilege(hToken,SE_ENABLE_DELEGATION_NAME); - DelPrivilege(hToken,SE_IMPERSONATE_NAME); - DelPrivilege(hToken,SE_INC_BASE_PRIORITY_NAME); - DelPrivilege(hToken,SE_INCREASE_QUOTA_NAME); - DelPrivilege(hToken,SE_INC_WORKING_SET_NAME); - DelPrivilege(hToken,SE_LOAD_DRIVER_NAME); - DelPrivilege(hToken,SE_LOCK_MEMORY_NAME); - DelPrivilege(hToken,SE_MACHINE_ACCOUNT_NAME); - DelPrivilege(hToken,SE_MANAGE_VOLUME_NAME); - DelPrivilege(hToken,SE_PROF_SINGLE_PROCESS_NAME); - DelPrivilege(hToken,SE_RELABEL_NAME); - DelPrivilege(hToken,SE_REMOTE_SHUTDOWN_NAME); - DelPrivilege(hToken,SE_RESTORE_NAME); - DelPrivilege(hToken,SE_SECURITY_NAME); - DelPrivilege(hToken,SE_SHUTDOWN_NAME); - DelPrivilege(hToken,SE_SYNC_AGENT_NAME); - DelPrivilege(hToken,SE_SYSTEM_ENVIRONMENT_NAME); - DelPrivilege(hToken,SE_SYSTEM_PROFILE_NAME); - DelPrivilege(hToken,SE_SYSTEMTIME_NAME); - DelPrivilege(hToken,SE_TAKE_OWNERSHIP_NAME); - DelPrivilege(hToken,SE_TCB_NAME); - DelPrivilege(hToken,SE_TIME_ZONE_NAME); - DelPrivilege(hToken,SE_TRUSTED_CREDMAN_ACCESS_NAME); - DelPrivilege(hToken,SE_UNDOCK_NAME); - DelPrivilege(hToken,SE_UNSOLICITED_INPUT_NAME); - }__finally - { - CloseHandle(hToken); - } -} - void TSource::RunTest(int index) //runs one test { PROCESS_INFORMATION pi;ZeroMemory(&pi,sizeof(pi)); @@ -496,20 +431,17 @@ mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY; mem.ProcessMemoryLimit=FLim.MemoryLimit; SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem)); - port.CompletionKey=(void*)123; port.CompletionPort=CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); - SetInformationJobObject(job,JobObjectAssociateCompletionPortInformation,&port,sizeof(port)); uilim.UIRestrictionsClass=JOB_OBJECT_UILIMIT_ALL; SetInformationJobObject(job,JobObjectBasicUIRestrictions,&uilim,sizeof(uilim)); - - DeletePrivileges(pi.hProcess); + AssignProcessToJobObject(job,pi.hProcess); + ResumeThread(pi.hThread); DWORD start=GetTickCount(); - while (true) { if ((int)GetFileSize(si.hStdOutput,NULL)>FLim.OutputLimit) @@ -558,10 +490,11 @@ unsigned long len,key; HANDLE proc; - if (GetQueuedCompletionStatus(port.CompletionPort, &len, &key, (LPOVERLAPPED*)&proc, 1)&&key == 123) + if (GetQueuedCompletionStatus(port.CompletionPort, &len, &key, (LPOVERLAPPED*)&proc, 1)) { DWORD code=0; bool needbreak=false; + if (key==123) switch(len) { case JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: @@ -604,7 +537,6 @@ break; } } - Sleep(1); } CloseHandle(si.hStdOutput); @@ -664,13 +596,13 @@ }__finally { - CloseHandle(job); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); CloseHandle(si.hStdInput); CloseHandle(si.hStdOutput); CloseHandle(si.hStdError); CloseHandle(port.CompletionPort); + CloseHandle(job); FState=ssTestComplete; if (FTestHandler) FTestHandler(index,(TResult^)FRes[index-1]); @@ -863,6 +795,7 @@ { if (CreateEnvironmentBlock((LPVOID*)&env,token,FALSE)) { + //DeletePrivileges(token); if (CreateProcessAsUser(token,NULL,buflpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags|CREATE_UNICODE_ENVIRONMENT,env,NULL,lpStartupInfo,lpProcessInformation)) { DestroyEnvironmentBlock(env); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-17 09:02:16
|
Revision: 261 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=261&view=rev Author: Oracle_ Date: 2008-06-17 02:02:14 -0700 (Tue, 17 Jun 2008) Log Message: ----------- ?\208?\163?\208?\180?\208?\176?\208?\187?\208?\181?\208?\189(?\208?\176) ?\209?\132?\208?\176?\208?\185?\208?\187/?\208?\191?\208?\176?\208?\191?\208?\186?\208?\176 Removed Paths: ------------- ACMServer/trunk/sharp tester/README.txt ACMServer/trunk/sharp tester/format Deleted: ACMServer/trunk/sharp tester/README.txt =================================================================== --- ACMServer/trunk/sharp tester/README.txt 2008-06-17 09:00:16 UTC (rev 260) +++ ACMServer/trunk/sharp tester/README.txt 2008-06-17 09:02:14 UTC (rev 261) @@ -1,5 +0,0 @@ -This is a Subversion repository; use the 'svnadmin' tool to examine -it. Do not add, delete, or modify files here unless you know how -to avoid corrupting the repository. - -Visit http://subversion.tigris.org/ for more information. Deleted: ACMServer/trunk/sharp tester/format =================================================================== --- ACMServer/trunk/sharp tester/format 2008-06-17 09:00:16 UTC (rev 260) +++ ACMServer/trunk/sharp tester/format 2008-06-17 09:02:14 UTC (rev 261) @@ -1 +0,0 @@ -5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-17 09:00:23
|
Revision: 260 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=260&view=rev Author: Oracle_ Date: 2008-06-17 02:00:16 -0700 (Tue, 17 Jun 2008) Log Message: ----------- ?\208?\163?\208?\180?\208?\176?\208?\187?\208?\181?\208?\189(?\208?\176) ?\209?\132?\208?\176?\208?\185?\208?\187/?\208?\191?\208?\176?\208?\191?\208?\186?\208?\176 Removed Paths: ------------- ACMServer/trunk/sharp tester/conf/ ACMServer/trunk/sharp tester/dav/ ACMServer/trunk/sharp tester/db/ ACMServer/trunk/sharp tester/hooks/ ACMServer/trunk/sharp tester/locks/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-17 08:54:04
|
Revision: 259 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=259&view=rev Author: Oracle_ Date: 2008-06-17 01:54:04 -0700 (Tue, 17 Jun 2008) Log Message: ----------- Added Paths: ----------- ACMServer/trunk/sharp tester/README.txt ACMServer/trunk/sharp tester/conf/ ACMServer/trunk/sharp tester/conf/authz ACMServer/trunk/sharp tester/conf/passwd ACMServer/trunk/sharp tester/conf/svnserve.conf ACMServer/trunk/sharp tester/dav/ ACMServer/trunk/sharp tester/db/ ACMServer/trunk/sharp tester/db/current ACMServer/trunk/sharp tester/db/format ACMServer/trunk/sharp tester/db/fs-type ACMServer/trunk/sharp tester/db/revprops/ ACMServer/trunk/sharp tester/db/revprops/0 ACMServer/trunk/sharp tester/db/revs/ ACMServer/trunk/sharp tester/db/revs/0 ACMServer/trunk/sharp tester/db/transactions/ ACMServer/trunk/sharp tester/db/uuid ACMServer/trunk/sharp tester/db/write-lock ACMServer/trunk/sharp tester/format ACMServer/trunk/sharp tester/hooks/ ACMServer/trunk/sharp tester/hooks/post-commit.tmpl ACMServer/trunk/sharp tester/hooks/post-lock.tmpl ACMServer/trunk/sharp tester/hooks/post-revprop-change.tmpl ACMServer/trunk/sharp tester/hooks/post-unlock.tmpl ACMServer/trunk/sharp tester/hooks/pre-commit.tmpl ACMServer/trunk/sharp tester/hooks/pre-lock.tmpl ACMServer/trunk/sharp tester/hooks/pre-revprop-change.tmpl ACMServer/trunk/sharp tester/hooks/pre-unlock.tmpl ACMServer/trunk/sharp tester/hooks/start-commit.tmpl ACMServer/trunk/sharp tester/locks/ ACMServer/trunk/sharp tester/locks/db-logs.lock ACMServer/trunk/sharp tester/locks/db.lock Added: ACMServer/trunk/sharp tester/README.txt =================================================================== --- ACMServer/trunk/sharp tester/README.txt (rev 0) +++ ACMServer/trunk/sharp tester/README.txt 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,5 @@ +This is a Subversion repository; use the 'svnadmin' tool to examine +it. Do not add, delete, or modify files here unless you know how +to avoid corrupting the repository. + +Visit http://subversion.tigris.org/ for more information. Added: ACMServer/trunk/sharp tester/conf/authz =================================================================== --- ACMServer/trunk/sharp tester/conf/authz (rev 0) +++ ACMServer/trunk/sharp tester/conf/authz 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,21 @@ +### This file is an example authorization file for svnserve. +### Its format is identical to that of mod_authz_svn authorization +### files. +### As shown below each section defines authorizations for the path and +### (optional) repository specified by the section name. +### The authorizations follow. An authorization line can refer to a +### single user, to a group of users defined in a special [groups] +### section, or to anyone using the '*' wildcard. Each definition can +### grant read ('r') access, read-write ('rw') access, or no access +### (''). + +[groups] +# harry_and_sally = harry,sally + +# [/foo/bar] +# harry = rw +# * = + +# [repository:/baz/fuz] +# @harry_and_sally = rw +# * = r Added: ACMServer/trunk/sharp tester/conf/passwd =================================================================== --- ACMServer/trunk/sharp tester/conf/passwd (rev 0) +++ ACMServer/trunk/sharp tester/conf/passwd 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,8 @@ +### This file is an example password file for svnserve. +### Its format is similar to that of svnserve.conf. As shown in the +### example below it contains one section labelled [users]. +### The name and password for each user follow, one account per line. + +[users] +# harry = harryssecret +# sally = sallyssecret Added: ACMServer/trunk/sharp tester/conf/svnserve.conf =================================================================== --- ACMServer/trunk/sharp tester/conf/svnserve.conf (rev 0) +++ ACMServer/trunk/sharp tester/conf/svnserve.conf 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,30 @@ +### This file controls the configuration of the svnserve daemon, if you +### use it to allow access to this repository. (If you only allow +### access through http: and/or file: URLs, then this file is +### irrelevant.) + +### Visit http://subversion.tigris.org/ for more information. + +[general] +### These options control access to the repository for unauthenticated +### and authenticated users. Valid values are "write", "read", +### and "none". The sample settings below are the defaults. +# anon-access = read +# auth-access = write +### The password-db option controls the location of the password +### database file. Unless you specify a path starting with a /, +### the file's location is relative to the conf directory. +### Uncomment the line below to use the default password file. +# password-db = passwd +### The authz-db option controls the location of the authorization +### rules for path-based access control. Unless you specify a path +### starting with a /, the file's location is relative to the conf +### directory. If you don't specify an authz-db, no path-based access +### control is done. +### Uncomment the line below to use the default authorization file. +# authz-db = authz +### This option specifies the authentication realm of the repository. +### If two repositories have the same authentication realm, they should +### have the same password database, and vice versa. The default realm +### is repository's uuid. +# realm = My First Repository Added: ACMServer/trunk/sharp tester/db/current =================================================================== --- ACMServer/trunk/sharp tester/db/current (rev 0) +++ ACMServer/trunk/sharp tester/db/current 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1 @@ +0 1 1 Added: ACMServer/trunk/sharp tester/db/format =================================================================== --- ACMServer/trunk/sharp tester/db/format (rev 0) +++ ACMServer/trunk/sharp tester/db/format 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1 @@ +2 Added: ACMServer/trunk/sharp tester/db/fs-type =================================================================== --- ACMServer/trunk/sharp tester/db/fs-type (rev 0) +++ ACMServer/trunk/sharp tester/db/fs-type 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1 @@ +fsfs Added: ACMServer/trunk/sharp tester/db/revprops/0 =================================================================== --- ACMServer/trunk/sharp tester/db/revprops/0 (rev 0) +++ ACMServer/trunk/sharp tester/db/revprops/0 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,5 @@ +K 8 +svn:date +V 27 +2008-06-17T08:50:56.245210Z +END Added: ACMServer/trunk/sharp tester/db/revs/0 =================================================================== --- ACMServer/trunk/sharp tester/db/revs/0 (rev 0) +++ ACMServer/trunk/sharp tester/db/revs/0 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,11 @@ +PLAIN +END +ENDREP +id: 0.0.r0/17 +type: dir +count: 0 +text: 0 0 4 4 2d2977d1c96f487abe4a1e202dd03b4e +cpath: / + + +17 107 Added: ACMServer/trunk/sharp tester/db/uuid =================================================================== --- ACMServer/trunk/sharp tester/db/uuid (rev 0) +++ ACMServer/trunk/sharp tester/db/uuid 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1 @@ +56c9e931-6168-524c-8140-b5feaaaad175 Added: ACMServer/trunk/sharp tester/db/write-lock =================================================================== Added: ACMServer/trunk/sharp tester/format =================================================================== --- ACMServer/trunk/sharp tester/format (rev 0) +++ ACMServer/trunk/sharp tester/format 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1 @@ +5 Added: ACMServer/trunk/sharp tester/hooks/post-commit.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/post-commit.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/post-commit.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,51 @@ +#!/bin/sh + +# POST-COMMIT HOOK +# +# The post-commit hook is invoked after a commit. Subversion runs +# this hook by invoking a program (script, executable, binary, etc.) +# named 'post-commit' (for which this file is a template) with the +# following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] REV (the number of the revision just committed) +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# Because the commit has already completed and cannot be undone, +# the exit code of the hook program is ignored. The hook program +# can use the 'svnlook' utility to help it examine the +# newly-committed tree. +# +# On a Unix system, the normal procedure is to have 'post-commit' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'post-commit' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'post-commit.bat' or 'post-commit.exe', +# but the basic idea is the same. +# +# The hook program typically does not inherit the environment of +# its parent process. For example, a common problem is for the +# PATH environment variable to not be set to its usual value, so +# that subprograms fail to launch unless invoked via absolute path. +# If you're having unexpected problems with a hook program, the +# culprit may be unusual (or missing) environment variables. +# +# Here is an example hook script, for a Unix /bin/sh interpreter. +# For more examples and pre-written hooks, see those in +# the Subversion repository at +# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and +# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ + + +REPOS="$1" +REV="$2" + +commit-email.pl "$REPOS" "$REV" com...@ex... +log-commit.py --repository "$REPOS" --revision "$REV" Added: ACMServer/trunk/sharp tester/hooks/post-lock.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/post-lock.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/post-lock.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,44 @@ +#!/bin/sh + +# POST-LOCK HOOK +# +# The post-lock hook is run after a path is locked. Subversion runs +# this hook by invoking a program (script, executable, binary, etc.) +# named 'post-lock' (for which this file is a template) with the +# following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] USER (the user who created the lock) +# +# The paths that were just locked are passed to the hook via STDIN (as +# of Subversion 1.2, only one path is passed per invocation, but the +# plan is to pass all locked paths at once, so the hook program +# should be written accordingly). +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# Because the lock has already been created and cannot be undone, +# the exit code of the hook program is ignored. The hook program +# can use the 'svnlook' utility to help it examine the +# newly-created lock. +# +# On a Unix system, the normal procedure is to have 'post-lock' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'post-lock' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'post-lock.bat' or 'post-lock.exe', +# but the basic idea is the same. +# +# Here is an example hook script, for a Unix /bin/sh interpreter: + +REPOS="$1" +USER="$2" + +# Send email to interested parties, let them know a lock was created: +mailer.py lock "$REPOS" "$USER" /path/to/mailer.conf Added: ACMServer/trunk/sharp tester/hooks/post-revprop-change.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/post-revprop-change.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/post-revprop-change.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,56 @@ +#!/bin/sh + +# POST-REVPROP-CHANGE HOOK +# +# The post-revprop-change hook is invoked after a revision property +# has been added, modified or deleted. Subversion runs this hook by +# invoking a program (script, executable, binary, etc.) named +# 'post-revprop-change' (for which this file is a template), with the +# following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] REV (the revision that was tweaked) +# [3] USER (the username of the person tweaking the property) +# [4] PROPNAME (the property that was changed) +# [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted) +# +# [STDIN] PROPVAL ** the old property value is passed via STDIN. +# +# Because the propchange has already completed and cannot be undone, +# the exit code of the hook program is ignored. The hook program +# can use the 'svnlook' utility to help it examine the +# new property value. +# +# On a Unix system, the normal procedure is to have 'post-revprop-change' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'post-revprop-change' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'post-revprop-change.bat' or 'post-revprop-change.exe', +# but the basic idea is the same. +# +# The hook program typically does not inherit the environment of +# its parent process. For example, a common problem is for the +# PATH environment variable to not be set to its usual value, so +# that subprograms fail to launch unless invoked via absolute path. +# If you're having unexpected problems with a hook program, the +# culprit may be unusual (or missing) environment variables. +# +# Here is an example hook script, for a Unix /bin/sh interpreter. +# For more examples and pre-written hooks, see those in +# the Subversion repository at +# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and +# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ + + +REPOS="$1" +REV="$2" +USER="$3" +PROPNAME="$4" +ACTION="$5" + +propchange-email.pl "$REPOS" "$REV" "$USER" "$PROPNAME" wat...@ex... Added: ACMServer/trunk/sharp tester/hooks/post-unlock.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/post-unlock.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/post-unlock.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,42 @@ +#!/bin/sh + +# POST-UNLOCK HOOK +# +# The post-unlock hook runs after a path is unlocked. Subversion runs +# this hook by invoking a program (script, executable, binary, etc.) +# named 'post-unlock' (for which this file is a template) with the +# following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] USER (the user who destroyed the lock) +# +# The paths that were just unlocked are passed to the hook via STDIN +# (as of Subversion 1.2, only one path is passed per invocation, but +# the plan is to pass all unlocked paths at once, so the hook program +# should be written accordingly). +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# Because the lock has already been destroyed and cannot be undone, +# the exit code of the hook program is ignored. +# +# On a Unix system, the normal procedure is to have 'post-unlock' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'post-unlock' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'post-unlock.bat' or 'post-unlock.exe', +# but the basic idea is the same. +# +# Here is an example hook script, for a Unix /bin/sh interpreter: + +REPOS="$1" +USER="$2" + +# Send email to interested parties, let them know a lock was removed: +mailer.py unlock "$REPOS" "$USER" /path/to/mailer.conf Added: ACMServer/trunk/sharp tester/hooks/pre-commit.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/pre-commit.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/pre-commit.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,70 @@ +#!/bin/sh + +# PRE-COMMIT HOOK +# +# The pre-commit hook is invoked before a Subversion txn is +# committed. Subversion runs this hook by invoking a program +# (script, executable, binary, etc.) named 'pre-commit' (for which +# this file is a template), with the following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] TXN-NAME (the name of the txn about to be committed) +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# If the hook program exits with success, the txn is committed; but +# if it exits with failure (non-zero), the txn is aborted, no commit +# takes place, and STDERR is returned to the client. The hook +# program can use the 'svnlook' utility to help it examine the txn. +# +# On a Unix system, the normal procedure is to have 'pre-commit' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT *** +# *** FOR REVISION PROPERTIES (like svn:log or svn:author). *** +# +# This is why we recommend using the read-only 'svnlook' utility. +# In the future, Subversion may enforce the rule that pre-commit +# hooks should not modify the versioned data in txns, or else come +# up with a mechanism to make it safe to do so (by informing the +# committing client of the changes). However, right now neither +# mechanism is implemented, so hook writers just have to be careful. +# +# Note that 'pre-commit' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'pre-commit.bat' or 'pre-commit.exe', +# but the basic idea is the same. +# +# The hook program typically does not inherit the environment of +# its parent process. For example, a common problem is for the +# PATH environment variable to not be set to its usual value, so +# that subprograms fail to launch unless invoked via absolute path. +# If you're having unexpected problems with a hook program, the +# culprit may be unusual (or missing) environment variables. +# +# Here is an example hook script, for a Unix /bin/sh interpreter. +# For more examples and pre-written hooks, see those in +# the Subversion repository at +# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and +# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ + + +REPOS="$1" +TXN="$2" + +# Make sure that the log message contains some text. +SVNLOOK=/usr/local/bin/svnlook +$SVNLOOK log -t "$TXN" "$REPOS" | \ + grep "[a-zA-Z0-9]" > /dev/null || exit 1 + +# Check that the author of this commit has the rights to perform +# the commit on the files and directories being modified. +commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1 + +# All checks passed, so allow the commit. +exit 0 Added: ACMServer/trunk/sharp tester/hooks/pre-lock.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/pre-lock.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/pre-lock.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,64 @@ +#!/bin/sh + +# PRE-LOCK HOOK +# +# The pre-lock hook is invoked before an exclusive lock is +# created. Subversion runs this hook by invoking a program +# (script, executable, binary, etc.) named 'pre-lock' (for which +# this file is a template), with the following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] PATH (the path in the repository about to be locked) +# [3] USER (the user creating the lock) +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# If the hook program exits with success, the lock is created; but +# if it exits with failure (non-zero), the lock action is aborted +# and STDERR is returned to the client. + +# On a Unix system, the normal procedure is to have 'pre-lock' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'pre-lock' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'pre-lock.bat' or 'pre-lock.exe', +# but the basic idea is the same. +# +# Here is an example hook script, for a Unix /bin/sh interpreter: + +REPOS="$1" +PATH="$2" +USER="$3" + +# If a lock exists and is owned by a different person, don't allow it +# to be stolen (e.g., with 'svn lock --force ...'). + +# (Maybe this script could send email to the lock owner?) +SVNLOOK=/usr/local/bin/svnlook +GREP=/bin/grep +SED=/bin/sed + +LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ + $GREP '^Owner: ' | $SED 's/Owner: //'` + +# If we get no result from svnlook, there's no lock, allow the lock to +# happen: +if [ "$LOCK_OWNER" = "" ]; then + exit 0 +fi + +# If the person locking matches the lock's owner, allow the lock to +# happen: +if [ "$LOCK_OWNER" = "$USER" ]; then + exit 0 +fi + +# Otherwise, we've got an owner mismatch, so return failure: +echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2 +exit 1 Added: ACMServer/trunk/sharp tester/hooks/pre-revprop-change.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/pre-revprop-change.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/pre-revprop-change.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,66 @@ +#!/bin/sh + +# PRE-REVPROP-CHANGE HOOK +# +# The pre-revprop-change hook is invoked before a revision property +# is added, modified or deleted. Subversion runs this hook by invoking +# a program (script, executable, binary, etc.) named 'pre-revprop-change' +# (for which this file is a template), with the following ordered +# arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] REVISION (the revision being tweaked) +# [3] USER (the username of the person tweaking the property) +# [4] PROPNAME (the property being set on the revision) +# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted) +# +# [STDIN] PROPVAL ** the new property value is passed via STDIN. +# +# If the hook program exits with success, the propchange happens; but +# if it exits with failure (non-zero), the propchange doesn't happen. +# The hook program can use the 'svnlook' utility to examine the +# existing value of the revision property. +# +# WARNING: unlike other hooks, this hook MUST exist for revision +# properties to be changed. If the hook does not exist, Subversion +# will behave as if the hook were present, but failed. The reason +# for this is that revision properties are UNVERSIONED, meaning that +# a successful propchange is destructive; the old value is gone +# forever. We recommend the hook back up the old value somewhere. +# +# On a Unix system, the normal procedure is to have 'pre-revprop-change' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'pre-revprop-change' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'pre-revprop-change.bat' or 'pre-revprop-change.exe', +# but the basic idea is the same. +# +# The hook program typically does not inherit the environment of +# its parent process. For example, a common problem is for the +# PATH environment variable to not be set to its usual value, so +# that subprograms fail to launch unless invoked via absolute path. +# If you're having unexpected problems with a hook program, the +# culprit may be unusual (or missing) environment variables. +# +# Here is an example hook script, for a Unix /bin/sh interpreter. +# For more examples and pre-written hooks, see those in +# the Subversion repository at +# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and +# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ + + +REPOS="$1" +REV="$2" +USER="$3" +PROPNAME="$4" +ACTION="$5" + +if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi + +echo "Changing revision properties other than svn:log is prohibited" >&2 +exit 1 Added: ACMServer/trunk/sharp tester/hooks/pre-unlock.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/pre-unlock.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/pre-unlock.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,60 @@ +#!/bin/sh + +# PRE-UNLOCK HOOK +# +# The pre-unlock hook is invoked before an exclusive lock is +# destroyed. Subversion runs this hook by invoking a program +# (script, executable, binary, etc.) named 'pre-unlock' (for which +# this file is a template), with the following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] PATH (the path in the repository about to be unlocked) +# [3] USER (the user destroying the lock) +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# If the hook program exits with success, the lock is destroyed; but +# if it exits with failure (non-zero), the unlock action is aborted +# and STDERR is returned to the client. + +# On a Unix system, the normal procedure is to have 'pre-unlock' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'pre-unlock' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'pre-unlock.bat' or 'pre-unlock.exe', +# but the basic idea is the same. +# +# Here is an example hook script, for a Unix /bin/sh interpreter: + +REPOS="$1" +PATH="$2" +USER="$3" + +# If a lock is owned by a different person, don't allow it be broken. +# (Maybe this script could send email to the lock owner?) + +SVNLOOK=/usr/local/bin/svnlook +GREP=/bin/grep +SED=/bin/sed + +LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ + $GREP '^Owner: ' | $SED 's/Owner: //'` + +# If we get no result from svnlook, there's no lock, return success: +if [ "$LOCK_OWNER" = "" ]; then + exit 0 +fi +# If the person unlocking matches the lock's owner, return success: +if [ "$LOCK_OWNER" = "$USER" ]; then + exit 0 +fi + +# Otherwise, we've got an owner mismatch, so return failure: +echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2 +exit 1 Added: ACMServer/trunk/sharp tester/hooks/start-commit.tmpl =================================================================== --- ACMServer/trunk/sharp tester/hooks/start-commit.tmpl (rev 0) +++ ACMServer/trunk/sharp tester/hooks/start-commit.tmpl 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,54 @@ +#!/bin/sh + +# START-COMMIT HOOK +# +# The start-commit hook is invoked before a Subversion txn is created +# in the process of doing a commit. Subversion runs this hook +# by invoking a program (script, executable, binary, etc.) named +# 'start-commit' (for which this file is a template) +# with the following ordered arguments: +# +# [1] REPOS-PATH (the path to this repository) +# [2] USER (the authenticated user attempting to commit) +# +# The default working directory for the invocation is undefined, so +# the program should set one explicitly if it cares. +# +# If the hook program exits with success, the commit continues; but +# if it exits with failure (non-zero), the commit is stopped before +# a Subversion txn is created, and STDERR is returned to the client. +# +# On a Unix system, the normal procedure is to have 'start-commit' +# invoke other programs to do the real work, though it may do the +# work itself too. +# +# Note that 'start-commit' must be executable by the user(s) who will +# invoke it (typically the user httpd runs as), and that user must +# have filesystem-level permission to access the repository. +# +# On a Windows system, you should name the hook program +# 'start-commit.bat' or 'start-commit.exe', +# but the basic idea is the same. +# +# The hook program typically does not inherit the environment of +# its parent process. For example, a common problem is for the +# PATH environment variable to not be set to its usual value, so +# that subprograms fail to launch unless invoked via absolute path. +# If you're having unexpected problems with a hook program, the +# culprit may be unusual (or missing) environment variables. +# +# Here is an example hook script, for a Unix /bin/sh interpreter. +# For more examples and pre-written hooks, see those in +# the Subversion repository at +# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and +# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ + + +REPOS="$1" +USER="$2" + +commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1 +special-auth-check.py --user "$USER" --auth-level 3 || exit 1 + +# All checks passed, so allow the commit. +exit 0 Added: ACMServer/trunk/sharp tester/locks/db-logs.lock =================================================================== --- ACMServer/trunk/sharp tester/locks/db-logs.lock (rev 0) +++ ACMServer/trunk/sharp tester/locks/db-logs.lock 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,3 @@ +This file is not used by Subversion 1.3.x or later. +However, its existence is required for compatibility with +Subversion 1.2.x or earlier. Added: ACMServer/trunk/sharp tester/locks/db.lock =================================================================== --- ACMServer/trunk/sharp tester/locks/db.lock (rev 0) +++ ACMServer/trunk/sharp tester/locks/db.lock 2008-06-17 08:54:04 UTC (rev 259) @@ -0,0 +1,3 @@ +This file is not used by Subversion 1.3.x or later. +However, its existence is required for compatibility with +Subversion 1.2.x or earlier. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-16 07:27:16
|
Revision: 258 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=258&view=rev Author: brus07 Date: 2008-06-16 00:26:48 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Connect Plugins module to Mediator. Fixed bug in dataContainer, with added message to queue without send. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -62,8 +62,17 @@ void Send2(string message) { - string res = (message.Split('$'))[0]; - string id = (message.Split('$'))[1]; + string res = ""; + string id = ""; + try + { + res = (message.Split('$'))[0]; + id = (message.Split('$'))[1]; + } + catch (Exception) + { + return; + } HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -22,10 +22,11 @@ } string fullLog = ""; + AcmContester.Mediator.Library.MediatorKernel kernel; private void button2_Click(object sender, EventArgs e) { - AcmContester.Mediator.Library.MediatorKernel kernel = new AcmContester.Mediator.Library.MediatorKernel(); + kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.onWorkingData += WorkingData; kernel.LoadLists(); } @@ -60,9 +61,8 @@ private void Disconnnect() { - //AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); - //SocketServerPlugin b2 = (SocketServerPlugin)socketCreater.GetInstance(); - //b2.Stop(); + kernel.SendToAll("stop"); + } private void Form1_FormClosing(object sender, FormClosingEventArgs e) Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -1,30 +1,30 @@ using System; using System.Collections; using AcmContester.Plugins.PluginsFramework; +using System.Collections.Generic; namespace AcmContester.Mediator.Library { class MediatorKernel { - ArrayList clientSideList = new ArrayList(); - ArrayList testerSideList = new ArrayList(); + List<BaseMediatorPlugin> clientSideList; + List<BaseMediatorPlugin> testerSideList; public void LoadLists() { - /* - //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE2\xE8\xF2\xFF\xE3\xF3\xE2\xE0\xF2\xE8 \xE4\xE0\xED\xB3 \xB3\xE7 \xEF\xE0\xEF\xEE\xEA \xF3 \xFF\xEA\xE8\xE9\xF5 \xEC\xE0\xFE\xF2\xFC \xE7\xED\xE0\xF5\xEE\xE4\xE8\xF2\xE8\xF1\xFF \xE2\xB3\xE4\xEF\xEE\xE2\xB3\xE4\xED\xB3 dll \xE4\xEE \xEA\xEE\xE6\xED\xEE\xE3\xEE \xEF\xEB\xE0\xE3\xB3\xED\xF3 - AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin webCreater = new AcmContester.Mediator.Library.Plugins.WebGate.CreaterMediatorPlugin(); - BaseMediatorPlugin b1 = webCreater.GetInstance(); - b1.onDataArrived += DataArrivedFromClentList; - b1.onWorkingData += WorkingData; - clientSideList.Add(b1); + clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); + foreach (BaseMediatorPlugin plugin in clientSideList) + { + plugin.onDataArrived += DataArrivedFromClientList; + plugin.onWorkingData += WorkingData; + } - AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin socketCreater = new AcmContester.Mediator.Library.Plugins.SocketGate.CreaterMediatorPlugin(); - BaseMediatorPlugin b2 = socketCreater.GetInstance(); - b2.onDataArrived += DataArrivedFromTesterList; - b2.onWorkingData += WorkingData; - testerSideList.Add(b2); - */ + testerSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Tester"); + foreach (BaseMediatorPlugin plugin in testerSideList) + { + plugin.onDataArrived += DataArrivedFromTesterList; + plugin.onWorkingData += WorkingData; + } } public delegate void WorkingData_EventHandler(string message); @@ -35,7 +35,7 @@ onWorkingData(message); } - private void DataArrivedFromClentList(string message) + private void DataArrivedFromClientList(string message) { for (int index = 0; index < testerSideList.Count; index++) { @@ -49,5 +49,11 @@ ((BaseMediatorPlugin)clientSideList[index]).Send(message); } } + + public void SendToAll(string message) + { + DataArrivedFromClientList(message); + DataArrivedFromTesterList(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -18,7 +18,7 @@ private SocketServerGate() { - //base.Start(); + base.Start(); base.onDataArrived += DataArrived; } @@ -29,9 +29,12 @@ public void Send(string message) { - if (dataContainer.Add(new Submit(message)) == true) + if (base.CountClients() > 0) { - base.Send(message); + if (dataContainer.Add(new Submit(message)) == true) + { + base.Send(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-16 07:20:09 UTC (rev 257) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-16 07:26:48 UTC (rev 258) @@ -10,7 +10,7 @@ public SocketServerGatePlugin() { socketServerGate = SocketServerGate.GetInstance(); - //socketServerGate.onDataArrived += DataArrived; + socketServerGate.onDataArrived += DataArrived; } public override void Send(string message) @@ -21,7 +21,8 @@ return; } WorkingData("WebGatePlugin::Send(" + message + ")"); - //socketServerGate.Send(message); + WorkingData("WebGatePlugin::Send CountClients = "+ socketServerGate.CountClients().ToString()); + socketServerGate.Send(message); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-16 07:20:20
|
Revision: 257 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=257&view=rev Author: brus07 Date: 2008-06-16 00:20:09 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Show TextBoxLog with timer, because edit one in other thread Modified Paths: -------------- ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs ACMServer/trunk/ACMServer/Tester/Form1.cs ACMServer/trunk/ACMServer/Tester/Form1.resx Modified: ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-16 07:20:09 UTC (rev 257) @@ -38,6 +38,7 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -122,6 +123,12 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // timerUpdateTextLog + // + this.timerUpdateTextLog.Enabled = true; + this.timerUpdateTextLog.Interval = 400; + this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -156,6 +163,7 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.Timer timerUpdateTextLog; } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-16 07:20:09 UTC (rev 257) @@ -14,6 +14,7 @@ public partial class Form1 : Form { SocketClient socket; + string fullLog = ""; public Form1() { InitializeComponent(); @@ -53,7 +54,13 @@ private void DataArrived(string message) { string result = ""; - textBox1.Text += "\r\n" + message; + + //textBox1.Text += "\r\n" + message; + lock (fullLog) + { + fullLog += "\r\n"; + fullLog += message; + } try { @@ -66,7 +73,13 @@ log.Loging("Form1::DataArrived: Error: " + ex.StackTrace, Log.Priority.ERR); return; } - textBox1.Text += "\r\n\t-> " + result; + + //textBox1.Text += "\r\n\t-> " + result; + lock (fullLog) + { + fullLog += "\r\n\t->"; + fullLog += result; + } socket.Send(result.ToString() + "$" + message); } @@ -99,5 +112,23 @@ textBox1.Select(textBox1.Text.Length, 0); textBox1.ScrollToCaret(); } + + private void UpdateTextLog() + { + lock (fullLog) + { + //textBox3.SelectedText = fullLog; + textBox1.Text += fullLog; + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + fullLog = ""; + } + } + + private void timerUpdateTextLog_Tick(object sender, EventArgs e) + { + UpdateTextLog(); + } + } } \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Tester/Form1.resx =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-16 07:20:09 UTC (rev 257) @@ -123,4 +123,7 @@ <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>127, 17</value> </metadata> + <metadata name="timerUpdateTextLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>210, 17</value> + </metadata> </root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |