Skip to content

Commit 1675fbc

Browse files
committed
Version 0.7.1
1 parent d45d4b4 commit 1675fbc

27 files changed

+575
-577
lines changed

Controls/Menus/AddServer.cs

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
using System;
2+
using System.Drawing;
3+
using System.Collections.Generic;
24
using System.Windows.Forms;
3-
using MinecraftServerManager.Utils;
45

56
namespace MinecraftServerManager.Controls.Menus
67
{
78
public class AddServer : UserControl
89
{
910
private Button connectLocalServer;
1011
private Button connectRemoteServer;
11-
private Button newLocalServer;
12+
private Button createLocalServer;
1213

1314
private ServersTreeView Tree;
1415
private Tabs tabs;
1516

1617
public AddServer()
1718
{
1819
InitializeComponent();
19-
newLocalServer.Text = " " + Utils.Language.GetString("MenuAddServerLocal");
20+
createLocalServer.Text = " " + Utils.Language.GetString("MenuAddServerLocal");
2021
connectLocalServer.Text = " " + Utils.Language.GetString("MenuConnectServerLocal");
2122
connectRemoteServer.Text = " " + Utils.Language.GetString("MenuConnectServerRemote");
23+
24+
using (Graphics g = CreateGraphics())
25+
{
26+
List<int> widthList = new List<int>();
27+
widthList.Add(g.MeasureString(createLocalServer.Text, createLocalServer.Font).ToSize().Width);
28+
widthList.Add(g.MeasureString(connectLocalServer.Text, connectLocalServer.Font).ToSize().Width);
29+
widthList.Add(g.MeasureString(connectRemoteServer.Text, connectRemoteServer.Font).ToSize().Width);
30+
31+
int width = Utils.Numbers.Max(widthList) + Utils.Numbers.MenuPadding;
32+
Width = width + 2;
33+
createLocalServer.Width = width;
34+
connectLocalServer.Width = width;
35+
connectRemoteServer.Width = width;
36+
}
2237
}
2338

2439
public new void Load(ServersTreeView tree, Tabs _tabs)
@@ -29,30 +44,29 @@ public AddServer()
2944

3045
private void InitializeComponent()
3146
{
32-
this.newLocalServer = new Button();
33-
this.connectLocalServer = new Button();
34-
this.connectRemoteServer = new Button();
47+
this.connectRemoteServer = new MinecraftServerManager.Controls.Button();
48+
this.connectLocalServer = new MinecraftServerManager.Controls.Button();
49+
this.createLocalServer = new MinecraftServerManager.Controls.Button();
3550
this.SuspendLayout();
3651
//
37-
// newLocalServer
52+
// connectRemoteServer
3853
//
39-
this.newLocalServer.BackColor = System.Drawing.Color.White;
40-
this.newLocalServer.FlatAppearance.BorderColor = System.Drawing.Color.White;
41-
this.newLocalServer.FlatAppearance.BorderSize = 0;
42-
this.newLocalServer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
43-
this.newLocalServer.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
44-
this.newLocalServer.Image = global::MinecraftServerManager.Properties.Resources.MenuCreateLocalServer;
45-
this.newLocalServer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
46-
this.newLocalServer.Location = new System.Drawing.Point(1, 1);
47-
this.newLocalServer.Name = "newLocalServer";
48-
this.newLocalServer.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0);
49-
this.newLocalServer.Size = new System.Drawing.Size(228, 30);
50-
this.newLocalServer.TabIndex = 0;
51-
this.newLocalServer.TabStop = false;
52-
this.newLocalServer.Text = " CREATE LOCAL SERVER";
53-
this.newLocalServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
54-
this.newLocalServer.UseVisualStyleBackColor = false;
55-
this.newLocalServer.Click += new System.EventHandler(this.newLocalServer_Click);
54+
this.connectRemoteServer.BackColor = System.Drawing.Color.White;
55+
this.connectRemoteServer.FlatAppearance.BorderColor = System.Drawing.Color.White;
56+
this.connectRemoteServer.FlatAppearance.BorderSize = 0;
57+
this.connectRemoteServer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
58+
this.connectRemoteServer.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
59+
this.connectRemoteServer.Image = global::MinecraftServerManager.Properties.Resources.MenuConnectRemoteServer;
60+
this.connectRemoteServer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
61+
this.connectRemoteServer.Location = new System.Drawing.Point(1, 61);
62+
this.connectRemoteServer.Name = "connectRemoteServer";
63+
this.connectRemoteServer.Size = new System.Drawing.Size(228, 30);
64+
this.connectRemoteServer.TabIndex = 0;
65+
this.connectRemoteServer.TabStop = false;
66+
this.connectRemoteServer.Text = " CONNECT REMOTE SERVER";
67+
this.connectRemoteServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
68+
this.connectRemoteServer.UseVisualStyleBackColor = false;
69+
this.connectRemoteServer.Click += new System.EventHandler(this.connectRemoteServer_Click);
5670
//
5771
// connectLocalServer
5872
//
@@ -73,31 +87,30 @@ private void InitializeComponent()
7387
this.connectLocalServer.UseVisualStyleBackColor = false;
7488
this.connectLocalServer.Click += new System.EventHandler(this.connectLocalServer_Click);
7589
//
76-
// connectRemoteServer
90+
// createLocalServer
7791
//
78-
this.connectRemoteServer.BackColor = System.Drawing.Color.White;
79-
this.connectRemoteServer.FlatAppearance.BorderColor = System.Drawing.Color.White;
80-
this.connectRemoteServer.FlatAppearance.BorderSize = 0;
81-
this.connectRemoteServer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
82-
this.connectRemoteServer.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
83-
this.connectRemoteServer.Image = global::MinecraftServerManager.Properties.Resources.MenuConnectRemoteServer;
84-
this.connectRemoteServer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
85-
this.connectRemoteServer.Location = new System.Drawing.Point(1, 61);
86-
this.connectRemoteServer.Name = "connectRemoteServer";
87-
this.connectRemoteServer.Padding = new System.Windows.Forms.Padding(0, 0, 9, 0);
88-
this.connectRemoteServer.Size = new System.Drawing.Size(228, 30);
89-
this.connectRemoteServer.TabIndex = 0;
90-
this.connectRemoteServer.TabStop = false;
91-
this.connectRemoteServer.Text = " CONNECT REMOTE SERVER";
92-
this.connectRemoteServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
93-
this.connectRemoteServer.UseVisualStyleBackColor = false;
94-
this.connectRemoteServer.Click += new System.EventHandler(this.connectRemoteServer_Click);
92+
this.createLocalServer.BackColor = System.Drawing.Color.White;
93+
this.createLocalServer.FlatAppearance.BorderColor = System.Drawing.Color.White;
94+
this.createLocalServer.FlatAppearance.BorderSize = 0;
95+
this.createLocalServer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
96+
this.createLocalServer.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
97+
this.createLocalServer.Image = global::MinecraftServerManager.Properties.Resources.MenuCreateLocalServer;
98+
this.createLocalServer.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
99+
this.createLocalServer.Location = new System.Drawing.Point(1, 1);
100+
this.createLocalServer.Name = "createLocalServer";
101+
this.createLocalServer.Size = new System.Drawing.Size(228, 30);
102+
this.createLocalServer.TabIndex = 0;
103+
this.createLocalServer.TabStop = false;
104+
this.createLocalServer.Text = " CREATE LOCAL SERVER";
105+
this.createLocalServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
106+
this.createLocalServer.UseVisualStyleBackColor = false;
107+
this.createLocalServer.Click += new System.EventHandler(this.newLocalServer_Click);
95108
//
96109
// AddServer
97110
//
98111
this.Controls.Add(this.connectRemoteServer);
99112
this.Controls.Add(this.connectLocalServer);
100-
this.Controls.Add(this.newLocalServer);
113+
this.Controls.Add(this.createLocalServer);
101114
this.Name = "AddServer";
102115
this.Size = new System.Drawing.Size(230, 92);
103116
this.ResumeLayout(false);
@@ -125,8 +138,8 @@ private void connectRemoteServer_Click(object sender, EventArgs e)
125138
public void SetStyle(Data.Style style)
126139
{
127140
this.BackColor = style.WindowBackColor;
128-
this.newLocalServer.BackColor = style.ControlBackColor;
129-
this.newLocalServer.Image = Utils.Icons.AddColor(Properties.Resources.MenuCreateLocalServer, style.ForeColor);
141+
this.createLocalServer.BackColor = style.ControlBackColor;
142+
this.createLocalServer.Image = Utils.Icons.AddColor(Properties.Resources.MenuCreateLocalServer, style.ForeColor);
130143
this.connectLocalServer.BackColor = style.ControlBackColor;
131144
this.connectLocalServer.Image = Utils.Icons.AddColor(Properties.Resources.MenuConnectLocalServer, style.ForeColor);
132145
this.connectRemoteServer.BackColor = style.ControlBackColor;

Controls/Menus/Language.Designer.cs

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

Controls/Menus/Language.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System.Windows.Forms;
1+
using System;
2+
using System.Drawing;
3+
using System.Collections.Generic;
4+
using System.Windows.Forms;
25

36
namespace MinecraftServerManager.Controls.Menus
47
{
@@ -11,6 +14,18 @@ public Language()
1114
InitializeComponent();
1215
this.english.Text = " " + Utils.Language.GetString("MenuEnglish");
1316
this.polish.Text = " " + Utils.Language.GetString("MenuPolish");
17+
18+
using (Graphics g = CreateGraphics())
19+
{
20+
List<int> widthList = new List<int>();
21+
widthList.Add(g.MeasureString(polish.Text, polish.Font).ToSize().Width);
22+
widthList.Add(g.MeasureString(english.Text, english.Font).ToSize().Width);
23+
24+
int width = Utils.Numbers.Max(widthList) + Utils.Numbers.MenuPadding;
25+
Width = width + 2;
26+
polish.Width = width;
27+
english.Width = width;
28+
}
1429
}
1530

1631
public new void Load(Tabs _tabs)
@@ -25,12 +40,12 @@ public void SetStyle(Data.Style style)
2540
this.polish.BackColor = style.ControlBackColor;
2641
}
2742

28-
private void english_Click(object sender, System.EventArgs e)
43+
private void english_Click(object sender, EventArgs e)
2944
{
3045
ChangeLanguage("en");
3146
}
3247

33-
private void polish_Click(object sender, System.EventArgs e)
48+
private void polish_Click(object sender, EventArgs e)
3449
{
3550
ChangeLanguage("pl");
3651
}

Controls/Menus/Settings.Designer.cs

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

Controls/Menus/Settings.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Drawing;
3+
using System.Collections.Generic;
24
using System.Windows.Forms;
35

46
namespace MinecraftServerManager.Controls.Menus
@@ -12,6 +14,18 @@ public Settings()
1214
InitializeComponent();
1315
this.style.Text = " " + Utils.Language.GetString("MenuSettingsStyles");
1416
this.engine.Text = " " + Utils.Language.GetString("MenuSettingsEngines");
17+
18+
using (Graphics g = CreateGraphics())
19+
{
20+
List<int> widthList = new List<int>();
21+
widthList.Add(g.MeasureString(style.Text, style.Font).ToSize().Width);
22+
widthList.Add(g.MeasureString(engine.Text, engine.Font).ToSize().Width);
23+
24+
int width = Utils.Numbers.Max(widthList) + Utils.Numbers.MenuPadding;
25+
Width = width + 2;
26+
style.Width = width;
27+
engine.Width = width;
28+
}
1529
}
1630

1731
public new void Load(Tabs _tabs)

Controls/ServersTreeNodes/DirectoryNode.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,9 @@ private void Virtualize()
9696
{
9797
int fileCount = 0;
9898

99-
try
100-
{
101-
fileCount = this.directory.GetFiles().Length;
102-
103-
if ((fileCount + this.directory.GetDirectories().Length) > 0)
104-
new FakeChildNode(this);
105-
}
106-
catch
107-
{
108-
}
99+
fileCount = this.directory.GetFiles().Length;
100+
if ((fileCount + this.directory.GetDirectories().Length) > 0)
101+
new FakeChildNode(this);
109102
}
110103

111104
public DirectoryInfo GetDirectory()

0 commit comments

Comments
 (0)