|
From: <br...@us...> - 2009-02-07 06:48:37
|
Revision: 497
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=497&view=rev
Author: brus07
Date: 2009-02-07 06:48:33 +0000 (Sat, 07 Feb 2009)
Log Message:
-----------
Added highlight to outputs in html results.
Modified Paths:
--------------
ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs
Modified: ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs 2009-02-06 21:50:04 UTC (rev 496)
+++ ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs 2009-02-07 06:48:33 UTC (rev 497)
@@ -26,6 +26,33 @@
return id.ToString();
}
+ private string[] HighlightDifference(string rightOutput, string wrongOutput)
+ {
+ const string leftTag = "<font color=\"#0000ff\"><b>";
+ const string rightTag = "</b></font>";
+ int i;
+ for (i = 0; i < rightOutput.Length && i < wrongOutput.Length; ++i)
+ {
+ if (rightOutput[i] != wrongOutput[i])
+ {
+ break;
+ }
+ }
+ if (i < rightOutput.Length)
+ {
+ rightOutput = rightOutput.Insert(i, leftTag) + rightTag;
+ }
+ if (i < wrongOutput.Length)
+ {
+ wrongOutput = wrongOutput.Insert(i, leftTag) + rightTag;
+ }
+ return new string[]
+ {
+ rightOutput,
+ wrongOutput
+ };
+ }
+
public override void Send(SystemMessage message)
{
if (message.IsType("TestingResultIoi") == true)
@@ -107,10 +134,15 @@
int n = result.testResults.Length;
for (int i = 0; i < n; i++)
{
+ string outAuthor = result.testResults[i].output;
+ string contestantOutput = result.testResults[i].contestantOutput;
+ string[] outs = HighlightDifference(outAuthor, contestantOutput);
+ outAuthor = outs[0];
+ contestantOutput = outs[1];
data[i, 0] = "<a href=\"#\" onclick=\"return flipBox('show" + i.ToString() + "')\">" + i.ToString() + "</a>";
data[i, 1] = "<div style=\"display: none;\" id=\"show" + i.ToString() + "_0\">\n<pre>" + result.testResults[i].input + "</pre></div>";
- data[i, 2] = "<div style=\"display: none;\" id=\"show" + i.ToString() + "_1\">\n<pre>" + result.testResults[i].output + "</pre></div>";
- data[i, 3] = "<div style=\"display: none;\" id=\"show" + i.ToString() + "_2\">\n<pre>" + result.testResults[i].contestantOutput + "</pre></div>";
+ data[i, 2] = "<div style=\"display: none;\" id=\"show" + i.ToString() + "_1\">\n<pre>" + outAuthor + "</pre></div>";
+ data[i, 3] = "<div style=\"display: none;\" id=\"show" + i.ToString() + "_2\">\n<pre>" + contestantOutput + "</pre></div>";
data[i, 4] = result.testResults[i].usedTime.ToString();
data[i, 5] = result.testResults[i].usedMemory.ToString();
data[i, 6] = result.testResults[i].res;
@@ -137,7 +169,7 @@
w.Write(h.Result);
w.Close();
StreamWriter dat = File.CreateText(dir + "\\data" + result.Submit.submit.pbolemID.ToString() + ".dat");
- dat.WriteLine(result.Submit.name + ";" + result.Submit.form + ";"+result.Submit.submit.pbolemID.ToString()+";" + ((result.testResults == null) ? "0;CE" : myPoints.ToString() + ";" + allPoints.ToString()));
+ dat.WriteLine(result.Submit.name + ";" + result.Submit.form + ";" + result.Submit.school + ";" + result.Submit.submit.pbolemID.ToString() + ";" + ((result.testResults == null) ? "0;CE" : myPoints.ToString() + ";" + allPoints.ToString()));
dat.Close();
}
//Uri url=new Uri(result.Submit.submit.id.ToString() + ".html");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|