From: <br...@us...> - 2009-02-02 22:23:50
|
Revision: 481 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=481&view=rev Author: brus07 Date: 2009-02-02 21:53:07 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Added TextBox for set Port for SocketServer. SocketServer and SocketClient can configure different Port number. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/SocketClientTask.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClientTask.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClientTask.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClientTask.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -13,6 +13,12 @@ client.onDataArrived +=SocketClientGate_onDataArrived; } + public SocketClientTask(string IP, int port) + { + client = new SocketClient(IP, port); + client.onDataArrived += SocketClientGate_onDataArrived; + } + void SocketClientGate_onDataArrived(SystemMessage message) { if (message.IsType("SystemTestBusyMessage")) Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -6,7 +6,7 @@ { public class SocketServerTask: AbstractConnector { - readonly SocketServer server; + SocketServer server; //val: //free - vilnyj @@ -177,5 +177,12 @@ } return false; } + + public void Start(int p) + { + server = new SocketServer(p); + server.onDataArrived += DataArrived; + this.Start(); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.Designer.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -37,6 +37,8 @@ this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.portTextBox = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); this.socketGateStatusStrip.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -92,10 +94,10 @@ | System.Windows.Forms.AnchorStyles.Right))); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(3, 26); + this.tabControl1.Location = new System.Drawing.Point(3, 58); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(211, 130); + this.tabControl1.Size = new System.Drawing.Size(211, 98); this.tabControl1.TabIndex = 5; // // tabPage1 @@ -103,7 +105,7 @@ this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(203, 104); + this.tabPage1.Size = new System.Drawing.Size(203, 72); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; @@ -119,10 +121,32 @@ this.tabPage2.Text = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // + // portTextBox + // + this.portTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.portTextBox.Location = new System.Drawing.Point(114, 3); + this.portTextBox.Name = "portTextBox"; + this.portTextBox.Size = new System.Drawing.Size(100, 20); + this.portTextBox.TabIndex = 6; + this.portTextBox.Text = "4120"; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.Location = new System.Drawing.Point(114, 29); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(100, 23); + this.button1.TabIndex = 7; + this.button1.Text = "Recreate"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // SocketServerGatePluginUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.button1); + this.Controls.Add(this.portTextBox); this.Controls.Add(this.tabControl1); this.Controls.Add(this.autoScrollCheckBox); this.Controls.Add(this.socketGateStatusStrip); @@ -149,5 +173,7 @@ private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TextBox portTextBox; + private System.Windows.Forms.Button button1; } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePluginUserControl.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -76,5 +76,12 @@ { clientCountTimer.Enabled = true; } + + private void button1_Click(object sender, EventArgs e) + { + SocketServerGate gate = SocketServerGate.GetInstance(); + gate.Stop(); + gate.Start(Int32.Parse(portTextBox.Text)); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -28,6 +28,14 @@ client.isBusy += IsBusy; } + public void CreateClient(string ip, int port) + { + client = new SocketClientTask(ip, port); + client.onDataArrived += new SocketClient.DataArrivedDelegate(SocketClientGate_onDataArrived); + client.onAddLogText += OnAddLogText; + client.isBusy += IsBusy; + } + System.Threading.Mutex mutex = new System.Threading.Mutex(); bool busyState = false; bool IsBusy() Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.Designer.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.Designer.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -30,6 +30,7 @@ { this.components = new System.ComponentModel.Container(); this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); @@ -38,7 +39,9 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.tabPage2 = new System.Windows.Forms.TabPage(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.portTextBox = new System.Windows.Forms.TextBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.statusStrip1.SuspendLayout(); @@ -57,6 +60,16 @@ this.tabControl1.Size = new System.Drawing.Size(238, 161); this.tabControl1.TabIndex = 0; // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(230, 135); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "tabPage2"; + this.tabPage2.UseVisualStyleBackColor = true; + // // tabPage1 // this.tabPage1.Controls.Add(this.textBox1); @@ -125,20 +138,39 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // tabPage2 + // label1 // - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(230, 135); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "tabPage2"; - this.tabPage2.UseVisualStyleBackColor = true; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(115, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(20, 13); + this.label1.TabIndex = 5; + this.label1.Text = "IP:"; // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(106, 32); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(29, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Port:"; + // + // portTextBox + // + this.portTextBox.Location = new System.Drawing.Point(141, 29); + this.portTextBox.Name = "portTextBox"; + this.portTextBox.Size = new System.Drawing.Size(100, 20); + this.portTextBox.TabIndex = 6; + this.portTextBox.Text = "4120"; + // // SocketClientGatePluginUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label2); + this.Controls.Add(this.portTextBox); + this.Controls.Add(this.label1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); @@ -168,5 +200,8 @@ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox portTextBox; } } Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs 2009-02-02 16:55:04 UTC (rev 480) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs 2009-02-02 21:53:07 UTC (rev 481) @@ -58,7 +58,7 @@ private void button1_Click(object sender, EventArgs e) { SocketClientGate gate = SocketClientGate.GetInstance(); - gate.CreateClient(textBox2.Text); + gate.CreateClient(textBox2.Text, Int32.Parse(portTextBox.Text)); gate.Connect(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |