You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 07:36:32 +09:00
Made SamplesCommon settings dialog actually useful
This commit is contained in:
@@ -33,10 +33,10 @@
|
|||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.label8 = new System.Windows.Forms.Label();
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
this.label9 = new System.Windows.Forms.Label();
|
this.label9 = new System.Windows.Forms.Label();
|
||||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
this.DupesTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
this.MaxLatencyTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
this.PingFrequencyTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||||
this.StatisticsLabel = new System.Windows.Forms.Label();
|
this.StatisticsLabel = new System.Windows.Forms.Label();
|
||||||
@@ -64,7 +64,6 @@
|
|||||||
this.DebugCheckBox.TabIndex = 0;
|
this.DebugCheckBox.TabIndex = 0;
|
||||||
this.DebugCheckBox.Text = "Display Debug messages";
|
this.DebugCheckBox.Text = "Display Debug messages";
|
||||||
this.DebugCheckBox.UseVisualStyleBackColor = true;
|
this.DebugCheckBox.UseVisualStyleBackColor = true;
|
||||||
this.DebugCheckBox.CheckedChanged += new System.EventHandler(this.DebugCheckBox_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// VerboseCheckBox
|
// VerboseCheckBox
|
||||||
//
|
//
|
||||||
@@ -75,16 +74,15 @@
|
|||||||
this.VerboseCheckBox.TabIndex = 1;
|
this.VerboseCheckBox.TabIndex = 1;
|
||||||
this.VerboseCheckBox.Text = "Display Verbose debug messages";
|
this.VerboseCheckBox.Text = "Display Verbose debug messages";
|
||||||
this.VerboseCheckBox.UseVisualStyleBackColor = true;
|
this.VerboseCheckBox.UseVisualStyleBackColor = true;
|
||||||
this.VerboseCheckBox.CheckedChanged += new System.EventHandler(this.VerboseCheckBox_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
this.groupBox1.Controls.Add(this.label8);
|
this.groupBox1.Controls.Add(this.label8);
|
||||||
this.groupBox1.Controls.Add(this.label9);
|
this.groupBox1.Controls.Add(this.label9);
|
||||||
this.groupBox1.Controls.Add(this.textBox2);
|
this.groupBox1.Controls.Add(this.DupesTextBox);
|
||||||
this.groupBox1.Controls.Add(this.label5);
|
this.groupBox1.Controls.Add(this.label5);
|
||||||
this.groupBox1.Controls.Add(this.label4);
|
this.groupBox1.Controls.Add(this.label4);
|
||||||
this.groupBox1.Controls.Add(this.textBox3);
|
this.groupBox1.Controls.Add(this.MaxLatencyTextBox);
|
||||||
this.groupBox1.Controls.Add(this.label3);
|
this.groupBox1.Controls.Add(this.label3);
|
||||||
this.groupBox1.Controls.Add(this.label2);
|
this.groupBox1.Controls.Add(this.label2);
|
||||||
this.groupBox1.Controls.Add(this.label1);
|
this.groupBox1.Controls.Add(this.label1);
|
||||||
@@ -92,7 +90,7 @@
|
|||||||
this.groupBox1.Controls.Add(this.MinLatencyTextBox);
|
this.groupBox1.Controls.Add(this.MinLatencyTextBox);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(291, 12);
|
this.groupBox1.Location = new System.Drawing.Point(291, 12);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(300, 110);
|
this.groupBox1.Size = new System.Drawing.Size(330, 110);
|
||||||
this.groupBox1.TabIndex = 2;
|
this.groupBox1.TabIndex = 2;
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Simulation";
|
this.groupBox1.Text = "Simulation";
|
||||||
@@ -115,13 +113,12 @@
|
|||||||
this.label9.TabIndex = 9;
|
this.label9.TabIndex = 9;
|
||||||
this.label9.Text = "Duplicates";
|
this.label9.Text = "Duplicates";
|
||||||
//
|
//
|
||||||
// textBox2
|
// DupesTextBox
|
||||||
//
|
//
|
||||||
this.textBox2.Location = new System.Drawing.Point(103, 77);
|
this.DupesTextBox.Location = new System.Drawing.Point(103, 77);
|
||||||
this.textBox2.Name = "textBox2";
|
this.DupesTextBox.Name = "DupesTextBox";
|
||||||
this.textBox2.Size = new System.Drawing.Size(54, 22);
|
this.DupesTextBox.Size = new System.Drawing.Size(54, 22);
|
||||||
this.textBox2.TabIndex = 8;
|
this.DupesTextBox.TabIndex = 8;
|
||||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
|
||||||
//
|
//
|
||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
@@ -141,22 +138,21 @@
|
|||||||
this.label4.TabIndex = 6;
|
this.label4.TabIndex = 6;
|
||||||
this.label4.Text = "ms";
|
this.label4.Text = "ms";
|
||||||
//
|
//
|
||||||
// textBox3
|
// MaxLatencyTextBox
|
||||||
//
|
//
|
||||||
this.textBox3.Location = new System.Drawing.Point(185, 21);
|
this.MaxLatencyTextBox.Location = new System.Drawing.Point(180, 21);
|
||||||
this.textBox3.Name = "textBox3";
|
this.MaxLatencyTextBox.Name = "MaxLatencyTextBox";
|
||||||
this.textBox3.Size = new System.Drawing.Size(54, 22);
|
this.MaxLatencyTextBox.Size = new System.Drawing.Size(54, 22);
|
||||||
this.textBox3.TabIndex = 5;
|
this.MaxLatencyTextBox.TabIndex = 5;
|
||||||
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
|
|
||||||
//
|
//
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(163, 24);
|
this.label3.Location = new System.Drawing.Point(163, 24);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(18, 13);
|
this.label3.Size = new System.Drawing.Size(11, 13);
|
||||||
this.label3.TabIndex = 4;
|
this.label3.TabIndex = 4;
|
||||||
this.label3.Text = "to";
|
this.label3.Text = "-";
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
@@ -182,7 +178,6 @@
|
|||||||
this.LossTextBox.Name = "LossTextBox";
|
this.LossTextBox.Name = "LossTextBox";
|
||||||
this.LossTextBox.Size = new System.Drawing.Size(54, 22);
|
this.LossTextBox.Size = new System.Drawing.Size(54, 22);
|
||||||
this.LossTextBox.TabIndex = 1;
|
this.LossTextBox.TabIndex = 1;
|
||||||
this.LossTextBox.TextChanged += new System.EventHandler(this.LossTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// MinLatencyTextBox
|
// MinLatencyTextBox
|
||||||
//
|
//
|
||||||
@@ -190,7 +185,6 @@
|
|||||||
this.MinLatencyTextBox.Name = "MinLatencyTextBox";
|
this.MinLatencyTextBox.Name = "MinLatencyTextBox";
|
||||||
this.MinLatencyTextBox.Size = new System.Drawing.Size(54, 22);
|
this.MinLatencyTextBox.Size = new System.Drawing.Size(54, 22);
|
||||||
this.MinLatencyTextBox.TabIndex = 0;
|
this.MinLatencyTextBox.TabIndex = 0;
|
||||||
this.MinLatencyTextBox.TextChanged += new System.EventHandler(this.MinLatencyTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// groupBox2
|
// groupBox2
|
||||||
//
|
//
|
||||||
@@ -198,7 +192,7 @@
|
|||||||
this.groupBox2.Controls.Add(this.DebugCheckBox);
|
this.groupBox2.Controls.Add(this.DebugCheckBox);
|
||||||
this.groupBox2.Controls.Add(this.VerboseCheckBox);
|
this.groupBox2.Controls.Add(this.VerboseCheckBox);
|
||||||
this.groupBox2.Controls.Add(this.label6);
|
this.groupBox2.Controls.Add(this.label6);
|
||||||
this.groupBox2.Controls.Add(this.textBox1);
|
this.groupBox2.Controls.Add(this.PingFrequencyTextBox);
|
||||||
this.groupBox2.Location = new System.Drawing.Point(12, 12);
|
this.groupBox2.Location = new System.Drawing.Point(12, 12);
|
||||||
this.groupBox2.Name = "groupBox2";
|
this.groupBox2.Name = "groupBox2";
|
||||||
this.groupBox2.Size = new System.Drawing.Size(273, 110);
|
this.groupBox2.Size = new System.Drawing.Size(273, 110);
|
||||||
@@ -224,22 +218,21 @@
|
|||||||
this.label6.TabIndex = 9;
|
this.label6.TabIndex = 9;
|
||||||
this.label6.Text = "Ping frequency";
|
this.label6.Text = "Ping frequency";
|
||||||
//
|
//
|
||||||
// textBox1
|
// PingFrequencyTextBox
|
||||||
//
|
//
|
||||||
this.textBox1.Location = new System.Drawing.Point(98, 67);
|
this.PingFrequencyTextBox.Location = new System.Drawing.Point(98, 67);
|
||||||
this.textBox1.Name = "textBox1";
|
this.PingFrequencyTextBox.Name = "PingFrequencyTextBox";
|
||||||
this.textBox1.Size = new System.Drawing.Size(76, 22);
|
this.PingFrequencyTextBox.Size = new System.Drawing.Size(76, 22);
|
||||||
this.textBox1.TabIndex = 8;
|
this.PingFrequencyTextBox.TabIndex = 8;
|
||||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
|
||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.button1.Location = new System.Drawing.Point(494, 367);
|
this.button1.Location = new System.Drawing.Point(524, 409);
|
||||||
this.button1.Name = "button1";
|
this.button1.Name = "button1";
|
||||||
this.button1.Size = new System.Drawing.Size(101, 36);
|
this.button1.Size = new System.Drawing.Size(101, 36);
|
||||||
this.button1.TabIndex = 5;
|
this.button1.TabIndex = 5;
|
||||||
this.button1.Text = "Refresh";
|
this.button1.Text = "Save";
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
@@ -251,7 +244,7 @@
|
|||||||
this.groupBox3.Controls.Add(this.StatisticsLabel);
|
this.groupBox3.Controls.Add(this.StatisticsLabel);
|
||||||
this.groupBox3.Location = new System.Drawing.Point(12, 128);
|
this.groupBox3.Location = new System.Drawing.Point(12, 128);
|
||||||
this.groupBox3.Name = "groupBox3";
|
this.groupBox3.Name = "groupBox3";
|
||||||
this.groupBox3.Size = new System.Drawing.Size(579, 233);
|
this.groupBox3.Size = new System.Drawing.Size(609, 275);
|
||||||
this.groupBox3.TabIndex = 6;
|
this.groupBox3.TabIndex = 6;
|
||||||
this.groupBox3.TabStop = false;
|
this.groupBox3.TabStop = false;
|
||||||
this.groupBox3.Text = "Statistics";
|
this.groupBox3.Text = "Statistics";
|
||||||
@@ -268,7 +261,7 @@
|
|||||||
// button2
|
// button2
|
||||||
//
|
//
|
||||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.button2.Location = new System.Drawing.Point(389, 367);
|
this.button2.Location = new System.Drawing.Point(419, 409);
|
||||||
this.button2.Name = "button2";
|
this.button2.Name = "button2";
|
||||||
this.button2.Size = new System.Drawing.Size(99, 36);
|
this.button2.Size = new System.Drawing.Size(99, 36);
|
||||||
this.button2.TabIndex = 7;
|
this.button2.TabIndex = 7;
|
||||||
@@ -280,7 +273,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(603, 411);
|
this.ClientSize = new System.Drawing.Size(633, 453);
|
||||||
this.Controls.Add(this.button2);
|
this.Controls.Add(this.button2);
|
||||||
this.Controls.Add(this.groupBox3);
|
this.Controls.Add(this.groupBox3);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.button1);
|
||||||
@@ -312,16 +305,16 @@
|
|||||||
public System.Windows.Forms.CheckBox VerboseCheckBox;
|
public System.Windows.Forms.CheckBox VerboseCheckBox;
|
||||||
public System.Windows.Forms.TextBox LossTextBox;
|
public System.Windows.Forms.TextBox LossTextBox;
|
||||||
public System.Windows.Forms.TextBox MinLatencyTextBox;
|
public System.Windows.Forms.TextBox MinLatencyTextBox;
|
||||||
public System.Windows.Forms.TextBox textBox3;
|
public System.Windows.Forms.TextBox MaxLatencyTextBox;
|
||||||
private System.Windows.Forms.Button button1;
|
private System.Windows.Forms.Button button1;
|
||||||
private System.Windows.Forms.Label label7;
|
private System.Windows.Forms.Label label7;
|
||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
private System.Windows.Forms.TextBox textBox1;
|
private System.Windows.Forms.TextBox PingFrequencyTextBox;
|
||||||
private System.Windows.Forms.GroupBox groupBox3;
|
private System.Windows.Forms.GroupBox groupBox3;
|
||||||
public System.Windows.Forms.Label StatisticsLabel;
|
public System.Windows.Forms.Label StatisticsLabel;
|
||||||
private System.Windows.Forms.Button button2;
|
private System.Windows.Forms.Button button2;
|
||||||
private System.Windows.Forms.Label label8;
|
private System.Windows.Forms.Label label8;
|
||||||
private System.Windows.Forms.Label label9;
|
private System.Windows.Forms.Label label9;
|
||||||
public System.Windows.Forms.TextBox textBox2;
|
public System.Windows.Forms.TextBox DupesTextBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ namespace SamplesCommon
|
|||||||
{
|
{
|
||||||
Peer = peer;
|
Peer = peer;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
UpdateLabelsAndBoxes();
|
||||||
RefreshData();
|
RefreshData();
|
||||||
this.Text = title;
|
this.Text = title;
|
||||||
|
|
||||||
@@ -40,24 +41,32 @@ namespace SamplesCommon
|
|||||||
RefreshData();
|
RefreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshData()
|
private void UpdateLabelsAndBoxes()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
var pc = Peer.Configuration;
|
||||||
LossTextBox.Text = ((int)(Peer.Configuration.SimulatedLoss * 100)).ToString();
|
|
||||||
textBox2.Text = ((int)(Peer.Configuration.SimulatedDuplicatesChance * 100)).ToString();
|
var loss = (pc.SimulatedLoss * 100.0f).ToString();
|
||||||
MinLatencyTextBox.Text = ((int)(Peer.Configuration.SimulatedMinimumLatency * 1000)).ToString();
|
label5.Text = loss + " %";
|
||||||
textBox3.Text = ((int)((Peer.Configuration.SimulatedMinimumLatency + Peer.Configuration.SimulatedRandomLatency) * 1000)).ToString();
|
LossTextBox.Text = loss;
|
||||||
#else
|
|
||||||
LossTextBox.Text = "0";
|
var dupes = (pc.SimulatedDuplicatesChance * 100.0f).ToString();
|
||||||
MinLatencyTextBox.Text = "0";
|
label8.Text = dupes + " %";
|
||||||
textBox3.Text = "0";
|
DupesTextBox.Text = dupes;
|
||||||
textBox2.Text = "0";
|
|
||||||
#endif
|
var minLat = (pc.SimulatedMinimumLatency * 1000.0f).ToString();
|
||||||
|
var maxLat = ((pc.SimulatedMinimumLatency + pc.SimulatedRandomLatency) * 1000.0f).ToString();
|
||||||
|
|
||||||
|
label4.Text = minLat + " to " + maxLat + " ms";
|
||||||
|
MinLatencyTextBox.Text = minLat;
|
||||||
|
MaxLatencyTextBox.Text = maxLat;
|
||||||
|
|
||||||
DebugCheckBox.Checked = Peer.Configuration.IsMessageTypeEnabled(NetIncomingMessageType.DebugMessage);
|
DebugCheckBox.Checked = Peer.Configuration.IsMessageTypeEnabled(NetIncomingMessageType.DebugMessage);
|
||||||
VerboseCheckBox.Checked = Peer.Configuration.IsMessageTypeEnabled(NetIncomingMessageType.VerboseDebugMessage);
|
VerboseCheckBox.Checked = Peer.Configuration.IsMessageTypeEnabled(NetIncomingMessageType.VerboseDebugMessage);
|
||||||
textBox1.Text = (Peer.Configuration.PingInterval * 1000).ToString();
|
PingFrequencyTextBox.Text = (Peer.Configuration.PingInterval * 1000).ToString();
|
||||||
//ThrottleTextBox.Text = Peer.Configuration.ThrottleBytesPerSecond.ToString();
|
}
|
||||||
|
|
||||||
|
private void RefreshData()
|
||||||
|
{
|
||||||
StringBuilder bdr = new StringBuilder();
|
StringBuilder bdr = new StringBuilder();
|
||||||
bdr.AppendLine(Peer.Statistics.ToString());
|
bdr.AppendLine(Peer.Statistics.ToString());
|
||||||
|
|
||||||
@@ -65,58 +74,27 @@ namespace SamplesCommon
|
|||||||
{
|
{
|
||||||
NetConnection conn = Peer.Connections[0];
|
NetConnection conn = Peer.Connections[0];
|
||||||
bdr.AppendLine("Connection 0:");
|
bdr.AppendLine("Connection 0:");
|
||||||
//bdr.AppendLine("Average RTT: " + ((int)(conn.AverageRoundtripTime * 1000.0f)) + " ms");
|
|
||||||
//bdr.AppendLine("Last response: " + (int)(NetTime.Now - conn.Statistics.LastSendRespondedTo) + "s ago");
|
|
||||||
//bdr.AppendLine("Most sends: " + conn.Statistics.MostSends);
|
|
||||||
bdr.Append(conn.Statistics.ToString());
|
bdr.Append(conn.Statistics.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
StatisticsLabel.Text = bdr.ToString();
|
StatisticsLabel.Text = bdr.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DebugCheckBox_CheckedChanged(object sender, EventArgs e)
|
private void Save()
|
||||||
{
|
{
|
||||||
Peer.Configuration.SetMessageTypeEnabled(NetIncomingMessageType.DebugMessage, DebugCheckBox.Checked);
|
Peer.Configuration.SetMessageTypeEnabled(NetIncomingMessageType.DebugMessage, DebugCheckBox.Checked);
|
||||||
}
|
|
||||||
|
|
||||||
private void VerboseCheckBox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Peer.Configuration.SetMessageTypeEnabled(NetIncomingMessageType.VerboseDebugMessage, VerboseCheckBox.Checked);
|
Peer.Configuration.SetMessageTypeEnabled(NetIncomingMessageType.VerboseDebugMessage, VerboseCheckBox.Checked);
|
||||||
}
|
float f;
|
||||||
|
if (Single.TryParse(LossTextBox.Text, out f))
|
||||||
private void LossTextBox_TextChanged(object sender, EventArgs e)
|
Peer.Configuration.SimulatedLoss = (float)((double)f / 100.0);
|
||||||
{
|
if (Single.TryParse(DupesTextBox.Text, out f))
|
||||||
#if DEBUG
|
Peer.Configuration.SimulatedDuplicatesChance = (float)((double)f / 100.0);
|
||||||
float ms;
|
if (float.TryParse(MinLatencyTextBox.Text, out f))
|
||||||
if (Single.TryParse(LossTextBox.Text, out ms))
|
Peer.Configuration.SimulatedMinimumLatency = (float)(f / 1000.0);
|
||||||
Peer.Configuration.SimulatedLoss = (float)((double)ms / 100.0);
|
if (float.TryParse(PingFrequencyTextBox.Text, out f))
|
||||||
#endif
|
Peer.Configuration.PingInterval = (float)(f / 1000.0);
|
||||||
}
|
|
||||||
|
|
||||||
private void textBox2_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
float ms;
|
|
||||||
if (Single.TryParse(textBox2.Text, out ms))
|
|
||||||
Peer.Configuration.SimulatedDuplicatesChance = (float)((double)ms / 100.0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MinLatencyTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
float min;
|
|
||||||
if (float.TryParse(MinLatencyTextBox.Text, out min))
|
|
||||||
Peer.Configuration.SimulatedMinimumLatency = (float)(min / 1000.0);
|
|
||||||
MinLatencyTextBox.Text = ((int)(Peer.Configuration.SimulatedMinimumLatency * 1000)).ToString();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private void textBox3_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
float max;
|
float max;
|
||||||
if (float.TryParse(textBox3.Text, out max))
|
if (float.TryParse(MaxLatencyTextBox.Text, out max))
|
||||||
{
|
{
|
||||||
max = (float)((double)max / 1000.0);
|
max = (float)((double)max / 1000.0);
|
||||||
float r = max - Peer.Configuration.SimulatedMinimumLatency;
|
float r = max - Peer.Configuration.SimulatedMinimumLatency;
|
||||||
@@ -124,35 +102,22 @@ namespace SamplesCommon
|
|||||||
{
|
{
|
||||||
Peer.Configuration.SimulatedRandomLatency = r;
|
Peer.Configuration.SimulatedRandomLatency = r;
|
||||||
double nm = (double)Peer.Configuration.SimulatedMinimumLatency + (double)Peer.Configuration.SimulatedRandomLatency;
|
double nm = (double)Peer.Configuration.SimulatedMinimumLatency + (double)Peer.Configuration.SimulatedRandomLatency;
|
||||||
textBox3.Text = ((int)(max * 1000)).ToString();
|
MaxLatencyTextBox.Text = ((int)(max * 1000)).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Save();
|
||||||
|
UpdateLabelsAndBoxes();
|
||||||
RefreshData();
|
RefreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
float d;
|
|
||||||
if (float.TryParse(textBox1.Text, out d))
|
|
||||||
Peer.Configuration.PingInterval = (float)(d / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
private void button2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThrottleTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//uint bps;
|
|
||||||
//if (UInt32.TryParse(ThrottleTextBox.Text, out bps))
|
|
||||||
// Peer.Configuration.ThrottleBytesPerSecond = (int)bps;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,9 +112,9 @@
|
|||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user