|
From: <Or...@us...> - 2009-02-05 20:21:04
|
Revision: 491
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=491&view=rev
Author: Oracle_
Date: 2009-02-05 20:20:58 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Change HTML result and update Informer show plugin.
Modified Paths:
--------------
ACMServer/trunk/ACMServer/Library/LibraryExtention/HtmlBuilder.cs
ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.Designer.cs
ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.cs
ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs
Modified: ACMServer/trunk/ACMServer/Library/LibraryExtention/HtmlBuilder.cs
===================================================================
--- ACMServer/trunk/ACMServer/Library/LibraryExtention/HtmlBuilder.cs 2009-02-04 18:49:19 UTC (rev 490)
+++ ACMServer/trunk/ACMServer/Library/LibraryExtention/HtmlBuilder.cs 2009-02-05 20:20:58 UTC (rev 491)
@@ -9,7 +9,7 @@
private string title;
private string body;
private string bgcolor="White";
- private string meta;
+ private string head;
public string Title
{
@@ -23,15 +23,15 @@
}
}
- public string Meta
+ public string Head
{
get
{
- return meta;
+ return head;
}
set
{
- meta = value;
+ head = value;
}
}
@@ -51,14 +51,15 @@
{
get
{
- string res = "<html>\n<head>\n\t<meta " + meta + "/>\n\t";
- res+="<title>" + title + "</title>\n</head>";
- res = res + "<body bgcolor=\"" + bgcolor + "\">\n" + body + "</body>\n</html>";
+ string res = "<html>\n<head>\n\t";
+ res += "<title>" + title + "</title>\n";
+ res += head + "</head>";
+ res += "<body bgcolor=\"" + bgcolor + "\">\n" + body + "</body>\n</html>";
return res;
}
}
- public void AddTable(string[,] data,string[] header,string caption,int borderwidth,int cellspacing,int cellpadding)
+ public void AddTable(string[,] data,string[] header,string caption,int borderwidth,int cellspacing,int cellpadding,string cellvalign)
{
body += "<table border=\""+borderwidth.ToString()+"\" cellspacing=\""+cellspacing.ToString()+"\" cellpadding=\""+cellpadding.ToString()+"\">\n";
if (caption!="")
@@ -72,7 +73,7 @@
}
for (int i=0;i<data.GetLength(0);i++)
{
- body += "<tr>";
+ body += "<tr valign=\""+cellvalign+"\">";
for (int j = 0; j < data.GetLength(1); j++)
body += "<td>" + data[i,j] + "</td>";
body += "</tr>\n";
Modified: ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.Designer.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.Designer.cs 2009-02-04 18:49:19 UTC (rev 490)
+++ ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.Designer.cs 2009-02-05 20:20:58 UTC (rev 491)
@@ -29,7 +29,22 @@
private void InitializeComponent()
{
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+ this.fileNeed = new System.Windows.Forms.CheckBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.resGrid = new System.Windows.Forms.DataGridView();
+ this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.submitGrid = new System.Windows.Forms.DataGridView();
+ this.source = new System.Windows.Forms.RichTextBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.resGrid)).BeginInit();
+ this.splitContainer2.Panel1.SuspendLayout();
+ this.splitContainer2.Panel2.SuspendLayout();
+ this.splitContainer2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.submitGrid)).BeginInit();
this.SuspendLayout();
//
// numericUpDown1
@@ -39,20 +54,132 @@
this.numericUpDown1.Size = new System.Drawing.Size(120, 20);
this.numericUpDown1.TabIndex = 0;
//
+ // fileNeed
+ //
+ this.fileNeed.AutoSize = true;
+ this.fileNeed.Checked = true;
+ this.fileNeed.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.fileNeed.Location = new System.Drawing.Point(129, 6);
+ this.fileNeed.Name = "fileNeed";
+ this.fileNeed.Size = new System.Drawing.Size(86, 17);
+ this.fileNeed.TabIndex = 5;
+ this.fileNeed.Text = "Save To File";
+ this.fileNeed.UseVisualStyleBackColor = true;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(221, 3);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(103, 20);
+ this.button1.TabIndex = 6;
+ this.button1.Text = "Show Html";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 29);
+ this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
+ this.splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.resGrid);
+ this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ this.splitContainer1.Size = new System.Drawing.Size(396, 354);
+ this.splitContainer1.SplitterDistance = 177;
+ this.splitContainer1.TabIndex = 7;
+ //
+ // resGrid
+ //
+ this.resGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.resGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.resGrid.Location = new System.Drawing.Point(0, 0);
+ this.resGrid.Name = "resGrid";
+ this.resGrid.RowHeadersVisible = false;
+ this.resGrid.Size = new System.Drawing.Size(396, 173);
+ this.resGrid.TabIndex = 5;
+ this.resGrid.SizeChanged += new System.EventHandler(this.resGrid_SizeChanged);
+ //
+ // splitContainer2
+ //
+ this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer2.Name = "splitContainer2";
+ //
+ // splitContainer2.Panel1
+ //
+ this.splitContainer2.Panel1.Controls.Add(this.submitGrid);
+ //
+ // splitContainer2.Panel2
+ //
+ this.splitContainer2.Panel2.Controls.Add(this.source);
+ this.splitContainer2.Size = new System.Drawing.Size(396, 177);
+ this.splitContainer2.SplitterDistance = 132;
+ this.splitContainer2.TabIndex = 0;
+ //
+ // submitGrid
+ //
+ this.submitGrid.BackgroundColor = System.Drawing.SystemColors.Window;
+ this.submitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.submitGrid.ColumnHeadersVisible = false;
+ this.submitGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.submitGrid.Location = new System.Drawing.Point(0, 0);
+ this.submitGrid.Name = "submitGrid";
+ this.submitGrid.RowHeadersVisible = false;
+ this.submitGrid.Size = new System.Drawing.Size(132, 177);
+ this.submitGrid.TabIndex = 2;
+ this.submitGrid.SizeChanged += new System.EventHandler(this.submitGrid_SizeChanged);
+ //
+ // source
+ //
+ this.source.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.source.Location = new System.Drawing.Point(0, 0);
+ this.source.Name = "source";
+ this.source.Size = new System.Drawing.Size(260, 177);
+ this.source.TabIndex = 3;
+ this.source.Text = "";
+ //
// IoiInformerControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.splitContainer1);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.fileNeed);
this.Controls.Add(this.numericUpDown1);
this.Name = "IoiInformerControl";
this.Size = new System.Drawing.Size(396, 383);
+ this.SizeChanged += new System.EventHandler(this.IoiInformerControl_SizeChanged);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.resGrid)).EndInit();
+ this.splitContainer2.Panel1.ResumeLayout(false);
+ this.splitContainer2.Panel2.ResumeLayout(false);
+ this.splitContainer2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.submitGrid)).EndInit();
this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
private System.Windows.Forms.NumericUpDown numericUpDown1;
+ private System.Windows.Forms.CheckBox fileNeed;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.SplitContainer splitContainer2;
+ private System.Windows.Forms.DataGridView submitGrid;
+ private System.Windows.Forms.RichTextBox source;
+ private System.Windows.Forms.DataGridView resGrid;
}
}
Modified: ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.cs 2009-02-04 18:49:19 UTC (rev 490)
+++ ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerControl.cs 2009-02-05 20:20:58 UTC (rev 491)
@@ -5,14 +5,33 @@
using System.Data;
using System.Text;
using System.Windows.Forms;
+using System.IO;
+using System.Diagnostics;
+using AcmContester.Library.LibraryExtention.Data;
namespace AcmContester.Plugins.IoiPlugins.IoiInformerPlugin
{
public partial class IoiInformerControl : UserControl
{
+ private string FileName;
+
+ private string GetLanguage(int id)
+ {
+ StreamReader r = File.OpenText("Comps.txt");
+ while (!r.EndOfStream)
+ {
+ string[] s = r.ReadLine().Split(' ');
+ if (s[0] == id.ToString())
+ return s[1];
+ }
+ r.Close();
+ return id.ToString();
+ }
+
public IoiInformerControl()
{
InitializeComponent();
+ IoiInformerControl_SizeChanged(null, new EventArgs());
}
delegate void UpCountCallback();
@@ -29,9 +48,116 @@
}
}
- public void LoadURL(Uri URL)
+ private void IoiInformerControl_SizeChanged(object sender, EventArgs e)
{
- //browser.Url = URL;
+ splitContainer1.Height = ClientRectangle.Height - (numericUpDown1.Top + numericUpDown1.Height + 1);
}
+
+ public bool NeedToFile()
+ {
+ return fileNeed.Checked;
+ }
+
+ delegate void LoadMessageCallback(ResultIoi message);
+
+ public void LoadMessage(ResultIoi message)
+ {
+ if (this.InvokeRequired)
+ {
+ LoadMessageCallback d = new LoadMessageCallback(LoadMessage);
+
+ this.Invoke(d, new object[] { message } );
+ }
+ else
+ {
+ FileName = "IoiResults\\" + message.Submit.form.ToString() + " form\\" + message.Submit.name + "\\" + message.Submit.submit.pbolemID.ToString() + ".html";
+ source.Text = message.Submit.submit.sourceCode;
+ submitGrid.ColumnCount = 2;
+ submitGrid.RowCount = 6;
+
+ submitGrid[0, 0].Value = "\xD3\xF7\xE0\xF1\xED\xE8\xEA:";
+ submitGrid[1, 0].Value = message.Submit.name;
+ submitGrid[0, 1].Value = "\xCA\xEB\xE0\xF1:";
+ submitGrid[1, 1].Value = message.Submit.form.ToString();
+ submitGrid[0, 2].Value = "\xC7\xE0\xE4\xE0\xF7\xE0:";
+ submitGrid[1, 2].Value = message.Submit.submit.pbolemID.ToString();
+ submitGrid[0, 3].Value = "\xCC\xEE\xE2\xE0 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xF3\xE2\xE0\xED\xED\xFF:";
+ submitGrid[1, 3].Value = GetLanguage(message.Submit.submit.language);
+ submitGrid[0, 4].Value = "\xCD\xEE\xEC\xE5\xF0 \xF1\xE0\xE1\xEC\xB3\xF2\xF3:";
+ submitGrid[1, 4].Value = message.Submit.submit.id.ToString();
+ submitGrid[0, 5].Value = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xED\xED\xFF: ";
+ int allPoints = 0, myPoints = 0;
+ if (message.testResults != null)
+ {
+ for (int i = 0; i < message.testResults.Length; i++)
+ {
+ allPoints += message.testResults[i].points;
+ myPoints += (message.testResults[i].res == "Accepted") ? message.testResults[i].points : 0;
+ }
+ submitGrid[1, 5].Value = myPoints.ToString() + "/" + allPoints.ToString();
+
+ resGrid.ColumnCount = 8;
+ resGrid.RowCount = message.testResults.Length + 2;
+ resGrid[0, 0].Value = "\xB9";
+ resGrid[1, 0].Value = "\xC2\xF5\xB3\xE4";
+ resGrid[2, 0].Value = "\xCA\xEE\xF0\xE5\xEA\xF2\xED\xE8\xE9 \xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2";
+ resGrid[3, 0].Value = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xD3\xF7\xE0\xF1\xED\xE8\xEA\xE0";
+ resGrid[4, 0].Value = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE8\xE9 \xD7\xE0\xF1";
+ resGrid[5, 0].Value = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE0 \xCF\xE0\xEC\'\xFF\xF2\xFC";
+ resGrid[6, 0].Value = "\xC2\xE5\xF0\xE4\xE8\xEA\xF2 \xD1\xF3\xE4\xE4\xB3";
+ resGrid[7, 0].Value = "\xCA-\xF1\xF2\xFC \xE1\xE0\xEB\xB3\xE2 \xE7\xE0 \xF2\xE5\xF1\xF2";
+
+ int n = message.testResults.Length;
+ for (int i = 0; i < n; i++)
+ {
+ resGrid[0, i+1].Value = i.ToString();
+ resGrid[1, i+1].Value = message.testResults[i].input;
+ resGrid[2, i+1].Value = message.testResults[i].output;
+ resGrid[3, i+1].Value = message.testResults[i].contestantOutput;
+ resGrid[4, i+1].Value = message.testResults[i].usedTime.ToString();
+ resGrid[5, i+1].Value = message.testResults[i].usedMemory.ToString();
+ resGrid[6, i+1].Value = message.testResults[i].res;
+ resGrid[7, i+1].Value = ((message.testResults[i].res == "Accepted") ? message.testResults[i].points : 0).ToString() + "/" + message.testResults[i].points.ToString();
+ }
+ resGrid[0, n+1].Value = "\xD1\xF3\xEC\xE0\xF0\xED\xB3";
+ resGrid[4, n+1].Value = message.usedMemory.ToString();
+ resGrid[5, n+1].Value = message.usedTime.ToString();
+ resGrid[6, n+1].Value = message.res;
+ resGrid[7, n+1].Value = myPoints.ToString() + "/" + allPoints.ToString();
+ }
+ else
+ {
+ submitGrid[1, 5].Value = "\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF";
+ resGrid.ColumnCount = 1;
+ resGrid.RowCount = 1;
+ resGrid[0, 0].Value = "\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF";
+ }
+ submitGrid_SizeChanged(null, new EventArgs());
+ resGrid_SizeChanged(null, new EventArgs());
+ }
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ if (File.Exists(FileName))
+ {
+ ProcessStartInfo s=new ProcessStartInfo();
+ s.FileName = Path.GetFullPath(FileName);
+ Process.Start(s);
+ }
+ }
+
+ private void submitGrid_SizeChanged(object sender, EventArgs e)
+ {
+ for (int i = 0; i < submitGrid.ColumnCount; i++)
+ submitGrid.Columns[i].Width = (submitGrid.Width - submitGrid.ColumnCount * 3) / submitGrid.ColumnCount;
+ }
+
+ private void resGrid_SizeChanged(object sender, EventArgs e)
+ {
+ for (int i = 0; i < resGrid.ColumnCount; i++)
+ resGrid.Columns[i].Width = (resGrid.Width - resGrid.ColumnCount * 3) / resGrid.ColumnCount;
+ }
+
}
}
Modified: ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs 2009-02-04 18:49:19 UTC (rev 490)
+++ ACMServer/trunk/ACMServer/Plugins/IoiPlugin/IoiInformerPlugin/IoiInformerPlugin.cs 2009-02-05 20:20:58 UTC (rev 491)
@@ -13,7 +13,7 @@
base.Control = new IoiInformerControl();
}
- public string GetLanguage(int id)
+ private string GetLanguage(int id)
{
StreamReader r = File.OpenText("Comps.txt");
while (!r.EndOfStream)
@@ -33,80 +33,104 @@
ResultIoi result = ResultIoi.CreateFromXml(message.Message);
((IoiInformerControl)base.Control).UpCount();
- HtmlBuilder h=new HtmlBuilder();
- string[,] subdata=new string[5,2];
-
- h.Title = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2\xE8 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xED\xED\xFF: ";
- h.Meta="HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=utf-8\"";
- h.AddHeader("\xC4\xE0\xED\xB3 \xEF\xF0\xEE \xF1\xE0\xE1\xEC\xB3\xF2:", 4, "left");
- subdata[0,0]="\xD3\xF7\xE0\xF1\xED\xE8\xEA:";
- subdata[0,1]=result.Submit.name;
- subdata[1,0]="\xCA\xEB\xE0\xF1:";
- subdata[1,1]=result.Submit.form.ToString();
- subdata[2,0]="\xC7\xE0\xE4\xE0\xF7\xE0:";
- subdata[2,1]=result.Submit.submit.pbolemID.ToString();
- subdata[3,0]="\xCC\xEE\xE2\xE0 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xF3\xE2\xE0\xED\xED\xFF:";
- subdata[3,1]=GetLanguage(result.Submit.submit.language);
- subdata[4,0]="\xCD\xEE\xEC\xE5\xF0 \xF1\xE0\xE1\xEC\xB3\xF2\xF3:";
- subdata[4,1]=result.Submit.submit.id.ToString();
- h.AddTable(subdata, new string[0], "", 2, 0, 5);
+ ((IoiInformerControl)base.Control).LoadMessage(result);
- h.AddHorizLine();
- h.AddHeader("\xC2\xE8\xF5\xB3\xE4\xED\xE8\xE9 \xEA\xEE\xE4",4,"center");
- h.AddPre(result.Submit.submit.sourceCode);
- h.AddHorizLine();
- h.AddHeader("\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xE2\xE8\xEA\xEE\xED\xE0\xED\xED\xFF", 4, "center");
+ if (((IoiInformerControl)base.Control).NeedToFile())
+ {
+ HtmlBuilder h = new HtmlBuilder();
+ string[,] subdata = new string[6, 2];
- if (result.testResults != null)
- {
- string[,] data = new string[result.testResults.Length + 1, 8];
- string[] header = new string[8];
- header[0] = "\xB9";
- header[1] = "\xC2\xF5\xB3\xE4";
- header[2] = "\xCA\xEE\xF0\xE5\xEA\xF2\xED\xE8\xE9 \xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2";
- header[3] = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xD3\xF7\xE0\xF1\xED\xE8\xEA\xE0";
- header[4] = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE8\xE9 \xD7\xE0\xF1";
- header[5] = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE0 \xCF\xE0\xEC\'\xFF\xF2\xFC";
- header[6] = "\xC2\xE5\xF0\xE4\xE8\xEA\xF2 \xD1\xF3\xE4\xE4\xB3";
- header[7] = "\xCA-\xF1\xF2\xFC \xE1\xE0\xEB\xB3\xE2 \xE7\xE0 \xF2\xE5\xF1\xF2";
- int n = result.testResults.Length;
+ h.Title = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2\xE8 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xED\xED\xFF";
+ h.Head += "<meta HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
+ h.Head += "<script type=\"text/javascript\">\n";
+ h.Head += "function flipBox(who) {\n";
+ h.Head += "if (document.getElementById(who+'_0').style.display == 'block') { \n";
+ h.Head += "document.getElementById(who+'_0').style.display = 'none';\n";
+ h.Head += "document.getElementById(who+'_1').style.display = 'none';\n";
+ h.Head += "document.getElementById(who+'_2').style.display = 'none';\n";
+ h.Head += "} else { \n";
+ h.Head += "document.getElementById(who+'_0').style.display = 'block';\n";
+ h.Head += "document.getElementById(who+'_1').style.display = 'block';\n";
+ h.Head += "document.getElementById(who+'_2').style.display = 'block';\n";
+ h.Head += "}\n";
+ h.Head += "}\n";
+ h.Head += "</script>\n";
+
+ h.AddHeader("\xC4\xE0\xED\xB3 \xEF\xF0\xEE \xF1\xE0\xE1\xEC\xB3\xF2:", 4, "left");
+ subdata[0, 0] = "\xD3\xF7\xE0\xF1\xED\xE8\xEA:";
+ subdata[0, 1] = result.Submit.name;
+ subdata[1, 0] = "\xCA\xEB\xE0\xF1:";
+ subdata[1, 1] = result.Submit.form.ToString();
+ subdata[2, 0] = "\xC7\xE0\xE4\xE0\xF7\xE0:";
+ subdata[2, 1] = result.Submit.submit.pbolemID.ToString();
+ subdata[3, 0] = "\xCC\xEE\xE2\xE0 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xF3\xE2\xE0\xED\xED\xFF:";
+ subdata[3, 1] = GetLanguage(result.Submit.submit.language);
+ subdata[4, 0] = "\xCD\xEE\xEC\xE5\xF0 \xF1\xE0\xE1\xEC\xB3\xF2\xF3:";
+ subdata[4, 1] = result.Submit.submit.id.ToString();
+ subdata[5, 0] = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xED\xED\xFF: ";
int allPoints = 0, myPoints = 0;
- for (int i = 0; i < n; i++)
+ if (result.testResults != null)
{
- data[i, 0] = result.testResults[i].id.ToString();
- data[i, 1] = "<pre>"+result.testResults[i].input+"</pre>";
- data[i, 2] = "<pre>"+result.testResults[i].output+"</pre>";
- data[i, 3] = "<pre>"+result.testResults[i].contestantOutput+"</pre>";
- data[i, 4] = result.testResults[i].usedTime.ToString();
- data[i, 5] = result.testResults[i].usedMemory.ToString();
- data[i, 6] = result.testResults[i].res;
- int curpoints = (result.testResults[i].res == "Accepted") ? result.testResults[i].points : 0;
- data[i, 7] = curpoints.ToString() + "/" + result.testResults[i].points.ToString();
- myPoints += curpoints;
- allPoints += result.testResults[i].points;
+ for (int i = 0; i < result.testResults.Length; i++)
+ {
+ allPoints += result.testResults[i].points;
+ myPoints += (result.testResults[i].res == "Accepted") ? result.testResults[i].points : 0;
+ }
+ subdata[5, 1] = myPoints.ToString() + "/" + allPoints.ToString();
}
- data[n, 0] = "<b>\xD1\xF3\xEC\xE0\xF0\xED\xB3</b>";
- data[n, 4] = "<b>" + result.usedMemory.ToString() + "</b>";
- data[n, 5] = "<b>" + result.usedTime.ToString() + "</b>";
- data[n, 6] = "<b>" + result.res + "</b>";
- data[n, 7] = "<b>" + myPoints.ToString() + "/" + allPoints.ToString() + "</b>";
- h.AddTable(data, header, "", 2, 0, 5);
- h.Title += myPoints.ToString() + "/" + allPoints.ToString();
- }
- else
- {
- h.Title += "\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF!";
- h.AddParagraph("\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF!");
- }
- h.AddHorizLine();
- h.AddReference("http://acm.lviv.ua","<small>\xC0\xD1\xCC \xCA\xEE\xED\xF2\xE5\xF1\xF2\xE5\xF0 - \xF0\xF3\xF5 \xE2\xEF\xE5\xF0\xE5\xE4</small>");
+ else
+ subdata[5, 1] = "\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF";
- string dir = "IoiResults\\" + result.Submit.form.ToString() + " form\\" + result.Submit.name;
- Directory.CreateDirectory(dir);
- StreamWriter w = File.CreateText(dir+"\\"+result.Submit.submit.pbolemID.ToString() + ".html");
- w.Write(h.Result);
- w.Close();
+ h.AddTable(subdata, new string[0], "", 2, 0, 5, "center");
+ h.AddHorizLine();
+ h.AddHeader("\xC2\xE8\xF5\xB3\xE4\xED\xE8\xE9 \xEA\xEE\xE4", 4, "center");
+ h.AddPre(result.Submit.submit.sourceCode);
+ h.AddHorizLine();
+ h.AddHeader("\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xE2\xE8\xEA\xEE\xED\xE0\xED\xED\xFF", 4, "center");
+
+ if (result.testResults != null)
+ {
+ string[,] data = new string[result.testResults.Length + 1, 8];
+ string[] header = new string[8];
+ header[0] = "\xB9";
+ header[1] = "\xC2\xF5\xB3\xE4";
+ header[2] = "\xCA\xEE\xF0\xE5\xEA\xF2\xED\xE8\xE9 \xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2";
+ header[3] = "\xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xD3\xF7\xE0\xF1\xED\xE8\xEA\xE0";
+ header[4] = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE8\xE9 \xD7\xE0\xF1";
+ header[5] = "\xC2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xE0 \xCF\xE0\xEC\'\xFF\xF2\xFC";
+ header[6] = "\xC2\xE5\xF0\xE4\xE8\xEA\xF2 \xD1\xF3\xE4\xE4\xB3";
+ header[7] = "\xCA-\xF1\xF2\xFC \xE1\xE0\xEB\xB3\xE2 \xE7\xE0 \xF2\xE5\xF1\xF2";
+ int n = result.testResults.Length;
+ for (int i = 0; i < n; i++)
+ {
+ data[i, 0] = "<a href=\"#\" onclick=\"javascript: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, 4] = result.testResults[i].usedTime.ToString();
+ data[i, 5] = result.testResults[i].usedMemory.ToString();
+ data[i, 6] = result.testResults[i].res;
+ data[i, 7] = ((result.testResults[i].res == "Accepted") ? result.testResults[i].points : 0).ToString() + "/" + result.testResults[i].points.ToString();
+ }
+ data[n, 0] = "<b>\xD1\xF3\xEC\xE0\xF0\xED\xB3</b>";
+ data[n, 4] = "<b>" + result.usedMemory.ToString() + "</b>";
+ data[n, 5] = "<b>" + result.usedTime.ToString() + "</b>";
+ data[n, 6] = "<b>" + result.res + "</b>";
+ data[n, 7] = "<b>" + myPoints.ToString() + "/" + allPoints.ToString() + "</b>";
+ h.AddTable(data, header, "", 2, 0, 5, "top");
+ }
+ else
+ h.AddParagraph("\xCF\xEE\xEC\xE8\xEB\xEA\xE0 \xCA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF!");
+ h.AddHorizLine();
+ h.AddReference("http://acm.lviv.ua", "<small>\xC0\xD1\xCC \xCA\xEE\xED\xF2\xE5\xF1\xF2\xE5\xF0 - \xF0\xF3\xF5 \xE2\xEF\xE5\xF0\xE5\xE4</small>");
+
+ string dir = "IoiResults\\" + result.Submit.form.ToString() + " form\\" + result.Submit.name;
+ Directory.CreateDirectory(dir);
+ StreamWriter w = File.CreateText(dir + "\\" + result.Submit.submit.pbolemID.ToString() + ".html");
+ w.Write(h.Result);
+ w.Close();
+ }
//Uri url=new Uri(result.Submit.submit.id.ToString() + ".html");
//((IoiInformerControl)base.Control).LoadURL(url);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|