Skip to content

Commit 116100e

Browse files
committed
Removed Function
Added debugging Fixed warnings
1 parent 3fefd81 commit 116100e

File tree

6 files changed

+33
-32
lines changed

6 files changed

+33
-32
lines changed

WindowsFormsApplication6/Form1.cs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,18 @@ private string RandomString(int size)
7474
return builder.ToString();
7575
}
7676

77-
private void NukeMap()
77+
private string RandomCharacters(int size)
7878
{
79-
try
80-
{
81-
var uri = "ws://" + SettingsForm.ServerNameBox.Text + ":" + SettingsForm.ServerPortBox.Text + "/ms";
82-
int Count = 4098;
83-
for (int i = 0; i <= Count; i++)
84-
{
85-
string OutText = "hello " + RandomString(2000);
86-
WSArray.Add(new ClientWebSocket());
87-
WSArray[i].ConnectAsync(new Uri(uri), cts.Token);
88-
Task.WhenAll(Receive(WSArray[i]), Send(WSArray[i], OutText));
89-
}
90-
91-
}
92-
catch (Exception ex)
79+
StringBuilder builder = new StringBuilder();
80+
Random random = new Random();
81+
char ch;
82+
for (int i = 0; i < size; i++)
9383
{
94-
OutPut.AppendText("Error: " + ex.Message);
84+
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(255 * random.NextDouble())));
85+
builder.Append(ch);
9586
}
87+
88+
return builder.ToString();
9689
}
9790

9891
private void wsGreet()
@@ -128,7 +121,7 @@ private void wsGreet()
128121
}
129122
catch (Exception ex)
130123
{
131-
OutPut.AppendText("Error: " + ex.Message);
124+
OutPut.AppendText("Error: " + ex.Message + Environment.NewLine);
132125
}
133126
}
134127

@@ -165,23 +158,27 @@ private void wsGreetRCON()
165158
}
166159
catch (Exception ex)
167160
{
168-
OutPut.AppendText("Error: " + ex.Message);
161+
OutPut.AppendText("Error: " + ex.Message + Environment.NewLine);
169162
}
170163
}
171164

172165
public void OutPutPingServer()
173166
{
174-
167+
if (Status != null)
168+
{
175169
OutPut.AppendText(
176170
" Server is UP" + Environment.NewLine +
177-
" CurrentVersion: " + Status.version +
178-
" CurrentTime: " + Status.env.time +
171+
" CurrentVersion: " + Status.version.io + Environment.NewLine +
172+
" CurrentTime: " + Status.env.time + Environment.NewLine +
179173
" Players: " + Status.players + " / " + Status.maxplayers + Environment.NewLine +
180174
" Sleepers: " + Status.sleepers + Environment.NewLine +
181175
" Level:" + Status.level + Environment.NewLine +
182176
" World Size: " + Status.world.size + Environment.NewLine +
183-
" World Seed:" + Status.world.seed + Environment.NewLine);
184-
177+
" World Seed:" + Status.world.seed + Environment.NewLine);
178+
} else
179+
{
180+
OutPut.AppendText(" Server is not responding" + Environment.NewLine);
181+
}
185182
}
186183

187184
public async Task Receive(ClientWebSocket webSocket)

WindowsFormsApplication6/Form2.Designer.cs

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsFormsApplication6/Form2.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ private void Ok_Click(object sender, EventArgs e)
2121
{
2222
this.Hide();
2323
}
24+
25+
private void Settings_FormClosing(object sender, FormClosingEventArgs e)
26+
{
27+
Settings.ActiveForm.Hide();
28+
e.Cancel = true;
29+
}
2430
}
2531
}

WindowsFormsApplication6/Managers/HelperClass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public string GetFile(string ServerName, string ServerPort, string filepath, str
129129

130130
return text;
131131
}
132-
catch (Exception ex)
132+
catch (Exception)
133133
{
134134

135135
}
@@ -159,7 +159,7 @@ public Image GetMap(string ServerName, string ServerPort)
159159

160160
return image;
161161
}
162-
catch (Exception ex)
162+
catch (Exception)
163163
{
164164

165165
}

WindowsFormsApplication6/Managers/MapManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public Image GetImage(string ServerName, string ServerPort, string ImgPath)
6464

6565
return image;
6666
}
67-
catch (Exception ex)
67+
catch (Exception)
6868
{
69-
69+
7070
}
7171

7272
return null;

WindowsFormsApplication6/WindowsFormsApplication6.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5858
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
5959
</Reference>
60-
<Reference Include="SteamKit2">
61-
<HintPath>..\packages\SteamKit2\SteamKit2.dll</HintPath>
62-
</Reference>
6360
<Reference Include="System" />
6461
<Reference Include="System.Core" />
6562
<Reference Include="System.Net.Http" />

0 commit comments

Comments
 (0)