Some refactoring and Remote Desktop improvements

This commit is contained in:
MaxXor 2015-07-26 00:10:59 +02:00
parent 0251e42cd3
commit 59eec835dd
90 changed files with 864 additions and 528 deletions

View File

@ -11,8 +11,8 @@ namespace xClient.Tests.Core.Encryption
[TestMethod] [TestMethod]
public void EncryptAndDecryptStringTest() public void EncryptAndDecryptStringTest()
{ {
var input = Helper.GetRandomName(100); var input = FileHelper.GetRandomFilename(100);
var password = Helper.GetRandomName(50); var password = FileHelper.GetRandomFilename(50);
var encrypted = AES.Encrypt(input, password); var encrypted = AES.Encrypt(input, password);
Assert.IsNotNull(encrypted); Assert.IsNotNull(encrypted);
@ -26,10 +26,10 @@ namespace xClient.Tests.Core.Encryption
[TestMethod] [TestMethod]
public void EncryptAndDecryptByteArrayTest() public void EncryptAndDecryptByteArrayTest()
{ {
var input = Helper.GetRandomName(100); var input = FileHelper.GetRandomFilename(100);
var inputByte = Encoding.UTF8.GetBytes(input); var inputByte = Encoding.UTF8.GetBytes(input);
var passwordByte = Encoding.UTF8.GetBytes(Helper.GetRandomName(50)); var passwordByte = Encoding.UTF8.GetBytes(FileHelper.GetRandomFilename(50));
var encryptedByte = AES.Encrypt(inputByte, passwordByte); var encryptedByte = AES.Encrypt(inputByte, passwordByte);
Assert.IsNotNull(encryptedByte); Assert.IsNotNull(encryptedByte);

View File

@ -10,7 +10,7 @@ namespace xClient.Tests.Core.Encryption
[TestMethod] [TestMethod]
public void ComputeHashTest() public void ComputeHashTest()
{ {
var input = Helper.GetRandomName(100); var input = FileHelper.GetRandomFilename(100);
var result = SHA256.ComputeHash(input); var result = SHA256.ComputeHash(input);
Assert.IsNotNull(result); Assert.IsNotNull(result);

View File

@ -46,6 +46,11 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Core\Helper\FileHelper.cs" />
<Compile Include="Core\Helper\FormatHelper.cs" />
<Compile Include="Core\Helper\NativeMethodsHelper.cs" />
<Compile Include="Core\Helper\PlatformHelper.cs" />
<Compile Include="Core\Helper\RemoteDesktopHelper.cs" />
<Compile Include="Core\Networking\Client.cs" /> <Compile Include="Core\Networking\Client.cs" />
<Compile Include="Core\Commands\CommandHandler.cs" /> <Compile Include="Core\Commands\CommandHandler.cs" />
<Compile Include="Core\Commands\ConnectionHandler.cs" /> <Compile Include="Core\Commands\ConnectionHandler.cs" />
@ -66,8 +71,9 @@
<Compile Include="Core\Encryption\AES.cs" /> <Compile Include="Core\Encryption\AES.cs" />
<Compile Include="Core\Encryption\SHA256.cs" /> <Compile Include="Core\Encryption\SHA256.cs" />
<Compile Include="Core\Extensions\RegistryKeyExtensions.cs" /> <Compile Include="Core\Extensions\RegistryKeyExtensions.cs" />
<Compile Include="Core\Helper\FileSplit.cs" /> <Compile Include="Core\Utilities\FileSplit.cs" />
<Compile Include="Core\Helper\UnsafeStreamCodec.cs" /> <Compile Include="Core\Utilities\NativeMethods.cs" />
<Compile Include="Core\Utilities\UnsafeStreamCodec.cs" />
<Compile Include="Core\Information\OSInfo.cs" /> <Compile Include="Core\Information\OSInfo.cs" />
<Compile Include="Core\Compression\JpgCompression.cs" /> <Compile Include="Core\Compression\JpgCompression.cs" />
<Compile Include="Core\Extensions\SocketExtensions.cs" /> <Compile Include="Core\Extensions\SocketExtensions.cs" />
@ -249,9 +255,12 @@
<Compile Include="Core\ProtoBuf\ServiceModel\XmlProtoSerializer.cs" /> <Compile Include="Core\ProtoBuf\ServiceModel\XmlProtoSerializer.cs" />
<Compile Include="Core\ProtoBuf\SubItemToken.cs" /> <Compile Include="Core\ProtoBuf\SubItemToken.cs" />
<Compile Include="Core\ProtoBuf\WireType.cs" /> <Compile Include="Core\ProtoBuf\WireType.cs" />
<Compile Include="Core\Helper\Helper.cs" />
<Compile Include="Core\Information\GeoIP.cs" /> <Compile Include="Core\Information\GeoIP.cs" />
<Compile Include="Core\Keylogger\Logger.cs" /> <Compile Include="Core\Keylogger\Logger.cs" />
<Compile Include="Enums\PathType.cs" />
<Compile Include="Enums\RemoteDesktopAction.cs" />
<Compile Include="Enums\ShutdownAction.cs" />
<Compile Include="Enums\UserStatus.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Config\Settings.cs" /> <Compile Include="Config\Settings.cs" />

View File

@ -1,55 +1,16 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices;
using xClient.Core.RemoteShell; using xClient.Core.RemoteShell;
using xClient.Core.Helper; using xClient.Core.Utilities;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
/* THIS PARTIAL CLASS SHOULD CONTAIN VARIABLES OR P/INVOKES NECESSARY FOR VARIOUS COMMANDS (if needed). */ /* THIS PARTIAL CLASS SHOULD CONTAIN VARIABLES OR P/INVOKES NECESSARY FOR VARIOUS COMMANDS (if needed). */
public static partial class CommandHandler public static partial class CommandHandler
{ {
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool DeleteFile(string name);
[DllImport("user32.dll")]
private static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")]
private static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
public static bool IsStreamingDesktop; public static bool IsStreamingDesktop;
public static UnsafeStreamCodec StreamCodec; public static UnsafeStreamCodec StreamCodec;
private static Shell _shell; private static Shell _shell;
private static Dictionary<int, string> _canceledDownloads = new Dictionary<int, string>(); private static Dictionary<int, string> _canceledDownloads = new Dictionary<int, string>();
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
private const string DELIMITER = "$E$"; private const string DELIMITER = "$E$";
public enum UserStatus
{
Idle,
Active
}
public enum ShutdownAction
{
Shutdown,
Restart,
Standby
}
public enum PathType
{
File,
Directory,
Back
}
public enum RemoteDesktopAction
{
Start,
Stop
}
} }
} }

View File

@ -6,6 +6,7 @@ using System.Threading;
using xClient.Config; using xClient.Config;
using xClient.Core.Helper; using xClient.Core.Helper;
using xClient.Core.Networking; using xClient.Core.Networking;
using xClient.Core.Utilities;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
@ -50,7 +51,7 @@ namespace xClient.Core.Commands
} }
catch (Exception ex) catch (Exception ex)
{ {
DeleteFile(filePath); NativeMethods.DeleteFile(filePath);
new Packets.ClientPackets.SetStatus(string.Format("Update failed: {0}", ex.Message)).Execute(client); new Packets.ClientPackets.SetStatus(string.Format("Update failed: {0}", ex.Message)).Execute(client);
} }
@ -62,7 +63,7 @@ namespace xClient.Core.Commands
new Packets.ClientPackets.SetStatus("Downloading file...").Execute(client); new Packets.ClientPackets.SetStatus("Downloading file...").Execute(client);
string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Helper.Helper.GetRandomFilename(12, ".exe")); FileHelper.GetRandomFilename(12, ".exe"));
try try
{ {
@ -93,7 +94,7 @@ namespace xClient.Core.Commands
try try
{ {
string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Helper.Helper.GetRandomFilename(12, ".bat")); FileHelper.GetRandomFilename(12, ".bat"));
string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE) string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE)
? "@echo off" + "\n" + ? "@echo off" + "\n" +

View File

@ -1,8 +1,9 @@
using System; using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using xClient.Core.Helper;
using xClient.Core.Networking; using xClient.Core.Networking;
using xClient.Core.Utilities;
using xClient.Enums;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
@ -101,7 +102,7 @@ namespace xClient.Core.Commands
public static void HandleDoUploadFile(Packets.ServerPackets.DoUploadFile command, Client client) public static void HandleDoUploadFile(Packets.ServerPackets.DoUploadFile command, Client client)
{ {
if (command.CurrentBlock == 0 && File.Exists(command.RemotePath)) if (command.CurrentBlock == 0 && File.Exists(command.RemotePath))
DeleteFile(command.RemotePath); // delete existing file NativeMethods.DeleteFile(command.RemotePath); // delete existing file
FileSplit destFile = new FileSplit(command.RemotePath); FileSplit destFile = new FileSplit(command.RemotePath);
destFile.AppendBlock(command.Block, command.CurrentBlock); destFile.AppendBlock(command.Block, command.CurrentBlock);

View File

@ -6,6 +6,7 @@ using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xClient.Core.Helper; using xClient.Core.Helper;
using xClient.Core.Networking; using xClient.Core.Networking;
using xClient.Core.Utilities;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
@ -20,7 +21,7 @@ namespace xClient.Core.Commands
new Thread(() => new Thread(() =>
{ {
string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Helper.Helper.GetRandomFilename(12, ".exe")); FileHelper.GetRandomFilename(12, ".exe"));
try try
{ {
@ -40,7 +41,7 @@ namespace xClient.Core.Commands
try try
{ {
DeleteFile(tempFile + ":Zone.Identifier"); NativeMethods.DeleteFile(tempFile + ":Zone.Identifier");
var bytes = File.ReadAllBytes(tempFile); var bytes = File.ReadAllBytes(tempFile);
if (bytes[0] != 'M' && bytes[1] != 'Z') if (bytes[0] != 'M' && bytes[1] != 'Z')
@ -58,7 +59,7 @@ namespace xClient.Core.Commands
} }
catch catch
{ {
DeleteFile(tempFile); NativeMethods.DeleteFile(tempFile);
new Packets.ClientPackets.SetStatus("Execution failed!").Execute(client); new Packets.ClientPackets.SetStatus("Execution failed!").Execute(client);
return; return;
} }
@ -88,7 +89,7 @@ namespace xClient.Core.Commands
if ((command.CurrentBlock + 1) == command.MaxBlocks) // execute if ((command.CurrentBlock + 1) == command.MaxBlocks) // execute
{ {
DeleteFile(filePath + ":Zone.Identifier"); NativeMethods.DeleteFile(filePath + ":Zone.Identifier");
ProcessStartInfo startInfo = new ProcessStartInfo(); ProcessStartInfo startInfo = new ProcessStartInfo();
if (command.RunHidden) if (command.RunHidden)
@ -105,7 +106,7 @@ namespace xClient.Core.Commands
} }
catch (Exception ex) catch (Exception ex)
{ {
DeleteFile(filePath); NativeMethods.DeleteFile(filePath);
new Packets.ClientPackets.SetStatus(string.Format("Execution failed: {0}", ex.Message)).Execute(client); new Packets.ClientPackets.SetStatus(string.Format("Execution failed: {0}", ex.Message)).Execute(client);
} }
} }

View File

@ -6,6 +6,8 @@ using xClient.Core.Helper;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Threading; using System.Threading;
using xClient.Core.Networking; using xClient.Core.Networking;
using xClient.Core.Utilities;
using xClient.Enums;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
@ -24,9 +26,17 @@ namespace xClient.Core.Commands
IsStreamingDesktop = true; IsStreamingDesktop = true;
if (StreamCodec == null || StreamCodec.ImageQuality != command.Quality || StreamCodec.Monitor != command.Monitor) if (StreamCodec == null)
StreamCodec = new UnsafeStreamCodec(command.Quality, command.Monitor); StreamCodec = new UnsafeStreamCodec(command.Quality, command.Monitor);
if (StreamCodec.ImageQuality != command.Quality || StreamCodec.Monitor != command.Monitor)
{
if (StreamCodec != null)
StreamCodec.Dispose();
StreamCodec = new UnsafeStreamCodec(command.Quality, command.Monitor);
}
new Thread(() => new Thread(() =>
{ {
while (IsStreamingDesktop) while (IsStreamingDesktop)
@ -40,7 +50,7 @@ namespace xClient.Core.Commands
Bitmap desktop = null; Bitmap desktop = null;
try try
{ {
desktop = Helper.Helper.GetDesktop(command.Monitor); desktop = RemoteDesktopHelper.GetDesktop(command.Monitor);
desktopData = desktop.LockBits(new Rectangle(0, 0, desktop.Width, desktop.Height), desktopData = desktop.LockBits(new Rectangle(0, 0, desktop.Width, desktop.Height),
ImageLockMode.ReadWrite, desktop.PixelFormat); ImageLockMode.ReadWrite, desktop.PixelFormat);
@ -86,25 +96,11 @@ namespace xClient.Core.Commands
if (command.LeftClick) if (command.LeftClick)
{ {
SetCursorPos(p.X, p.Y); NativeMethodsHelper.DoMouseClickLeft(p, command.DoubleClick);
mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
if (command.DoubleClick)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
}
} }
else else
{ {
SetCursorPos(p.X, p.Y); NativeMethodsHelper.DoMouseClickRight(p, command.DoubleClick);
mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
if (command.DoubleClick)
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
}
} }
} }

View File

@ -8,7 +8,9 @@ using Microsoft.Win32;
using xClient.Core.Information; using xClient.Core.Information;
using xClient.Core.RemoteShell; using xClient.Core.RemoteShell;
using xClient.Core.Extensions; using xClient.Core.Extensions;
using xClient.Core.Helper;
using xClient.Core.Networking; using xClient.Core.Networking;
using xClient.Enums;
namespace xClient.Core.Commands namespace xClient.Core.Commands
{ {
@ -28,12 +30,12 @@ namespace xClient.Core.Commands
if (string.IsNullOrEmpty(volumeLabel)) if (string.IsNullOrEmpty(volumeLabel))
{ {
displayName[i] = string.Format("{0} [{1}, {2}]", drives[i].RootDirectory.FullName, displayName[i] = string.Format("{0} [{1}, {2}]", drives[i].RootDirectory.FullName,
Helper.Helper.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat); FormatHelper.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat);
} }
else else
{ {
displayName[i] = string.Format("{0} ({1}) [{2}, {3}]", drives[i].RootDirectory.FullName, volumeLabel, displayName[i] = string.Format("{0} ({1}) [{2}, {3}]", drives[i].RootDirectory.FullName, volumeLabel,
Helper.Helper.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat); FormatHelper.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat);
} }
rootDirectory[i] = drives[i].RootDirectory.FullName; rootDirectory[i] = drives[i].RootDirectory.FullName;
} }

View File

@ -1,10 +1,11 @@
using System.Drawing; using System;
using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
namespace xClient.Core.Compression namespace xClient.Core.Compression
{ {
public class JpgCompression public class JpgCompression : IDisposable
{ {
private readonly ImageCodecInfo _encoderInfo; private readonly ImageCodecInfo _encoderInfo;
private readonly EncoderParameters _encoderParams; private readonly EncoderParameters _encoderParams;
@ -15,7 +16,25 @@ namespace xClient.Core.Compression
this._encoderInfo = GetEncoderInfo("image/jpeg"); this._encoderInfo = GetEncoderInfo("image/jpeg");
this._encoderParams = new EncoderParameters(2); this._encoderParams = new EncoderParameters(2);
this._encoderParams.Param[0] = parameter; this._encoderParams.Param[0] = parameter;
this._encoderParams.Param[1] = new EncoderParameter(Encoder.Compression, (long) EncoderValue.CompressionRle); this._encoderParams.Param[1] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionRle);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (_encoderParams != null)
{
_encoderParams.Dispose();
}
}
} }
public byte[] Compress(Bitmap bmp) public byte[] Compress(Bitmap bmp)

View File

@ -0,0 +1,20 @@
using System;
using System.Text;
namespace xClient.Core.Helper
{
public static class FileHelper
{
private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static readonly Random _rnd = new Random(Environment.TickCount);
public static string GetRandomFilename(int length, string extension = "")
{
StringBuilder randomName = new StringBuilder(length);
for (int i = 0; i < length; i++)
randomName.Append(CHARS[_rnd.Next(CHARS.Length)]);
return string.Concat(randomName.ToString(), extension);
}
}
}

View File

@ -0,0 +1,30 @@
using System.IO;
using System.Text.RegularExpressions;
namespace xClient.Core.Helper
{
public static class FormatHelper
{
public static string FormatMacAddress(string macAddress)
{
return (macAddress.Length != 12)
? "00:00:00:00:00:00"
: Regex.Replace(macAddress, "(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})", "$1:$2:$3:$4:$5:$6");
}
public static string DriveTypeName(DriveType type)
{
switch (type)
{
case DriveType.Fixed:
return "Local Disk";
case DriveType.Network:
return "Network Drive";
case DriveType.Removable:
return "Removable Drive";
default:
return type.ToString();
}
}
}
}

View File

@ -1,73 +0,0 @@
using System;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;
namespace xClient.Core.Helper
{
public static class Helper
{
private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static readonly Random _rnd = new Random(Environment.TickCount);
public static string GetRandomFilename(int length, string extension)
{
StringBuilder randomName = new StringBuilder(length);
for (int i = 0; i < length; i++)
randomName.Append(CHARS[_rnd.Next(CHARS.Length)]);
return string.Concat(randomName.ToString(), extension);
}
public static string GetRandomName(int length)
{
StringBuilder randomName = new StringBuilder(length);
for (int i = 0; i < length; i++)
randomName.Append(CHARS[_rnd.Next(CHARS.Length)]);
return randomName.ToString();
}
public static Bitmap GetDesktop(int screenNumber)
{
var bounds = Screen.AllScreens[screenNumber].Bounds;
var screenshot = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
using (Graphics graph = Graphics.FromImage(screenshot))
{
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy);
return screenshot;
}
}
public static bool IsWindowsXP()
{
var osVersion = Environment.OSVersion.Version;
return osVersion.Major == 5 && osVersion.Minor >= 1;
}
public static string FormatMacAddress(string macAddress)
{
return (macAddress.Length != 12)
? "00:00:00:00:00:00"
: Regex.Replace(macAddress, "(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})", "$1:$2:$3:$4:$5:$6");
}
public static string DriveTypeName(DriveType type)
{
switch (type)
{
case DriveType.Fixed:
return "Local Disk";
case DriveType.Network:
return "Network Drive";
case DriveType.Removable:
return "Removable Drive";
default:
return type.ToString();
}
}
}
}

View File

@ -0,0 +1,37 @@
using System.Drawing;
using xClient.Core.Utilities;
namespace xClient.Core.Helper
{
public static class NativeMethodsHelper
{
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
public static void DoMouseClickLeft(Point p, bool doubleClick)
{
NativeMethods.SetCursorPos(p.X, p.Y);
NativeMethods.mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
NativeMethods.mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
if (doubleClick)
{
NativeMethods.mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
NativeMethods.mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
}
}
public static void DoMouseClickRight(Point p, bool doubleClick)
{
NativeMethods.SetCursorPos(p.X, p.Y);
NativeMethods.mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
NativeMethods.mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
if (doubleClick)
{
NativeMethods.mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
NativeMethods.mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
}
}
}
}

View File

@ -0,0 +1,68 @@
using System;
namespace xServer.Core.Helper
{
public static class PlatformHelper
{
/// <summary>
/// Initializes the <see cref="PlatformHelper"/> class.
/// </summary>
static PlatformHelper()
{
Win32NT = Environment.OSVersion.Platform == PlatformID.Win32NT;
XpOrHigher = Win32NT && Environment.OSVersion.Version.Major >= 5;
VistaOrHigher = Win32NT && Environment.OSVersion.Version.Major >= 6;
SevenOrHigher = Win32NT && (Environment.OSVersion.Version >= new Version(6, 1));
EightOrHigher = Win32NT && (Environment.OSVersion.Version >= new Version(6, 2, 9200));
RunningOnMono = Type.GetType("Mono.Runtime") != null;
}
/// <summary>
/// Returns a indicating whether the application is running in Mono runtime.
/// </summary>
/// <value>
/// <c>true</c> if the application is running in Mono runtime; otherwise, <c>false</c>.
/// </value>
public static bool RunningOnMono { get; private set; }
/// <summary>
/// Returns a indicating whether the Operating System is Windows 32 NT based.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 32 NT based; otherwise, <c>false</c>.
/// </value>
public static bool Win32NT { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows XP or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 8 or higher; otherwise, <c>false</c>.
/// </value>
public static bool XpOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows Vista or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows Vista or higher; otherwise, <c>false</c>.
/// </value>
public static bool VistaOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows 7 or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 7 or higher; otherwise, <c>false</c>.
/// </value>
public static bool SevenOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows 8 or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 8 or higher; otherwise, <c>false</c>.
/// </value>
public static bool EightOrHigher { get; private set; }
}
}

View File

@ -0,0 +1,20 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace xClient.Core.Helper
{
public static class RemoteDesktopHelper
{
public static Bitmap GetDesktop(int screenNumber)
{
var bounds = Screen.AllScreens[screenNumber].Bounds;
var screenshot = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
using (Graphics graph = Graphics.FromImage(screenshot))
{
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy);
return screenshot;
}
}
}
}

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xClient.Core.Networking; using xClient.Core.Networking;
using UserStatus = xClient.Core.Commands.CommandHandler.UserStatus; using xClient.Enums;
namespace xClient.Core.Packets.ClientPackets namespace xClient.Core.Packets.ClientPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xClient.Core.Networking; using xClient.Core.Networking;
using PathType = xClient.Core.Commands.CommandHandler.PathType; using xClient.Enums;
namespace xClient.Core.Packets.ServerPackets namespace xClient.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xClient.Core.Networking; using xClient.Core.Networking;
using PathType = xClient.Core.Commands.CommandHandler.PathType; using xClient.Enums;
namespace xClient.Core.Packets.ServerPackets namespace xClient.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xClient.Core.Networking; using xClient.Core.Networking;
using ShutdownAction = xClient.Core.Commands.CommandHandler.ShutdownAction; using xClient.Enums;
namespace xClient.Core.Packets.ServerPackets namespace xClient.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xClient.Core.Networking; using xClient.Core.Networking;
using RemoteDesktopAction = xClient.Core.Commands.CommandHandler.RemoteDesktopAction; using xClient.Enums;
namespace xClient.Core.Packets.ServerPackets namespace xClient.Core.Packets.ServerPackets
{ {

View File

@ -13,8 +13,10 @@ using xClient.Config;
using xClient.Core.Information; using xClient.Core.Information;
using xClient.Core.Encryption; using xClient.Core.Encryption;
using xClient.Core.Extensions; using xClient.Core.Extensions;
using xClient.Core.Helper;
using xClient.Core.Networking; using xClient.Core.Networking;
using UserStatus = xClient.Core.Commands.CommandHandler.UserStatus; using xClient.Enums;
using xServer.Core.Helper;
namespace xClient.Core namespace xClient.Core
{ {
@ -187,7 +189,7 @@ namespace xClient.Core
try try
{ {
string antivirusName = string.Empty; string antivirusName = string.Empty;
string scope = (Helper.Helper.IsWindowsXP()) ? "root\\SecurityCenter" : "root\\SecurityCenter2"; string scope = (PlatformHelper.XpOrHigher) ? "root\\SecurityCenter" : "root\\SecurityCenter2";
string query = "SELECT * FROM AntivirusProduct"; string query = "SELECT * FROM AntivirusProduct";
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query)) using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
@ -211,7 +213,7 @@ namespace xClient.Core
try try
{ {
string firewallName = string.Empty; string firewallName = string.Empty;
string scope = (Helper.Helper.IsWindowsXP()) ? "root\\SecurityCenter" : "root\\SecurityCenter2"; string scope = (PlatformHelper.XpOrHigher) ? "root\\SecurityCenter" : "root\\SecurityCenter2";
string query = "SELECT * FROM FirewallProduct"; string query = "SELECT * FROM FirewallProduct";
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query)) using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
@ -288,7 +290,7 @@ namespace xClient.Core
} }
if (foundCorrect) if (foundCorrect)
return Helper.Helper.FormatMacAddress(ni.GetPhysicalAddress().ToString()); return FormatHelper.FormatMacAddress(ni.GetPhysicalAddress().ToString());
} }
} }
@ -540,7 +542,7 @@ namespace xClient.Core
string filename = Path.Combine( string filename = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Helper.Helper.GetRandomFilename(12, ".bat")); FileHelper.GetRandomFilename(12, ".bat"));
string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE) string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE)
? "@echo off" + "\n" + ? "@echo off" + "\n" +

View File

@ -1,7 +1,7 @@
using System; using System;
using System.IO; using System.IO;
namespace xClient.Core.Helper namespace xClient.Core.Utilities
{ {
public class FileSplit public class FileSplit
{ {

View File

@ -0,0 +1,33 @@
using System;
using System.Runtime.InteropServices;
namespace xClient.Core.Utilities
{
/// <summary>
/// Provides some methods from the "user32.dll" and uxtheme libraries.
/// </summary>
public static class NativeMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DeleteFile(string name);
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcpy(void* dst, void* src, uint count);
}
}

View File

@ -3,15 +3,14 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using xClient.Core.Compression; using xClient.Core.Compression;
namespace xClient.Core.Helper namespace xClient.Core.Utilities
{ {
public class UnsafeStreamCodec public class UnsafeStreamCodec : IDisposable
{ {
private int _imageQuality; public int Monitor { get; private set; }
public Size CheckBlock { get; private set; }
public int ImageQuality public int ImageQuality
{ {
get { return _imageQuality; } get { return _imageQuality; }
@ -20,14 +19,18 @@ namespace xClient.Core.Helper
lock (_imageProcessLock) lock (_imageProcessLock)
{ {
_imageQuality = value; _imageQuality = value;
if (_jpgCompression != null)
{
_jpgCompression.Dispose();
}
_jpgCompression = new JpgCompression(_imageQuality); _jpgCompression = new JpgCompression(_imageQuality);
} }
} }
} }
public int Monitor { get; private set; } private int _imageQuality;
public Size CheckBlock { get; private set; }
private byte[] _encodeBuffer; private byte[] _encodeBuffer;
private Bitmap _decodedBitmap; private Bitmap _decodedBitmap;
private PixelFormat _encodedFormat; private PixelFormat _encodedFormat;
@ -36,27 +39,41 @@ namespace xClient.Core.Helper
private readonly object _imageProcessLock = new object(); private readonly object _imageProcessLock = new object();
private JpgCompression _jpgCompression; private JpgCompression _jpgCompression;
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcpy(void* dst, void* src, uint count);
/// <summary> /// <summary>
/// Initialize a new object of UnsafeStreamCodec /// Initialize a new instance of UnsafeStreamCodec class.
/// </summary> /// </summary>
/// <param name="imageQuality">The quality to use between 0-100</param> /// <param name="imageQuality">The quality to use between 0-100.</param>
/// <param name="monitor">The monitor used for the images.</param>
public UnsafeStreamCodec(int imageQuality, int monitor) public UnsafeStreamCodec(int imageQuality, int monitor)
{ {
this.CheckBlock = new Size(50, 1);
this.ImageQuality = imageQuality; this.ImageQuality = imageQuality;
this.Monitor = monitor; this.Monitor = monitor;
this.CheckBlock = new Size(50, 1);
}
public void Dispose()
{
Dispose(true);
// Tell the Garbage Collector to not waste time finalizing this object
// since we took care of it.
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (_decodedBitmap != null)
{
_decodedBitmap.Dispose();
}
if (_jpgCompression != null)
{
_jpgCompression.Dispose();
}
}
} }
public unsafe void CodeImage(IntPtr scan0, Rectangle scanArea, Size imageSize, PixelFormat format, public unsafe void CodeImage(IntPtr scan0, Rectangle scanArea, Size imageSize, PixelFormat format,
@ -64,7 +81,7 @@ namespace xClient.Core.Helper
{ {
lock (_imageProcessLock) lock (_imageProcessLock)
{ {
byte* pScan0 = (byte*) scan0.ToInt32(); byte* pScan0 = (byte*)scan0.ToInt32();
if (!outStream.CanWrite) if (!outStream.CanWrite)
{ {
@ -89,8 +106,8 @@ namespace xClient.Core.Helper
throw new NotSupportedException(format.ToString()); throw new NotSupportedException(format.ToString());
} }
stride = imageSize.Width*pixelSize; stride = imageSize.Width * pixelSize;
rawLength = stride*imageSize.Height; rawLength = stride * imageSize.Height;
if (_encodeBuffer == null) if (_encodeBuffer == null)
{ {
@ -109,7 +126,7 @@ namespace xClient.Core.Helper
outStream.Write(BitConverter.GetBytes(temp.Length), 0, 4); outStream.Write(BitConverter.GetBytes(temp.Length), 0, 4);
outStream.Write(temp, 0, temp.Length); outStream.Write(temp, 0, temp.Length);
memcpy(new IntPtr(ptr), scan0, (uint) rawLength); NativeMethods.memcpy(new IntPtr(ptr), scan0, (uint)rawLength);
} }
return; return;
} }
@ -130,7 +147,7 @@ namespace xClient.Core.Helper
List<Rectangle> blocks = new List<Rectangle>(); List<Rectangle> blocks = new List<Rectangle>();
Size s = new Size(scanArea.Width, CheckBlock.Height); Size s = new Size(scanArea.Width, CheckBlock.Height);
Size lastSize = new Size(scanArea.Width%CheckBlock.Width, scanArea.Height%CheckBlock.Height); Size lastSize = new Size(scanArea.Width % CheckBlock.Width, scanArea.Height % CheckBlock.Height);
int lasty = scanArea.Height - lastSize.Height; int lasty = scanArea.Height - lastSize.Height;
int lastx = scanArea.Width - lastSize.Width; int lastx = scanArea.Width - lastSize.Width;
@ -153,9 +170,9 @@ namespace xClient.Core.Helper
cBlock = new Rectangle(scanArea.X, y, scanArea.Width, s.Height); cBlock = new Rectangle(scanArea.X, y, scanArea.Width, s.Height);
int offset = (y*stride) + (scanArea.X*pixelSize); int offset = (y * stride) + (scanArea.X * pixelSize);
if (memcmp(encBuffer + offset, pScan0 + offset, (uint) stride) != 0) if (NativeMethods.memcmp(encBuffer + offset, pScan0 + offset, (uint)stride) != 0)
{ {
index = blocks.Count - 1; index = blocks.Count - 1;
@ -185,18 +202,18 @@ namespace xClient.Core.Helper
cBlock = new Rectangle(x, blocks[i].Y, s.Width, blocks[i].Height); cBlock = new Rectangle(x, blocks[i].Y, s.Width, blocks[i].Height);
bool foundChanges = false; bool foundChanges = false;
uint blockStride = (uint) (pixelSize*cBlock.Width); uint blockStride = (uint)(pixelSize * cBlock.Width);
for (int j = 0; j < cBlock.Height; j++) for (int j = 0; j < cBlock.Height; j++)
{ {
int blockOffset = (stride*(cBlock.Y + j)) + (pixelSize*cBlock.X); int blockOffset = (stride * (cBlock.Y + j)) + (pixelSize * cBlock.X);
if (memcmp(encBuffer + blockOffset, pScan0 + blockOffset, blockStride) != 0) if (NativeMethods.memcmp(encBuffer + blockOffset, pScan0 + blockOffset, blockStride) != 0)
{ {
foundChanges = true; foundChanges = true;
} }
memcpy(encBuffer + blockOffset, pScan0 + blockOffset, blockStride); NativeMethods.memcpy(encBuffer + blockOffset, pScan0 + blockOffset, blockStride);
//copy-changes //copy-changes
} }
@ -224,7 +241,7 @@ namespace xClient.Core.Helper
for (int i = 0; i < finalUpdates.Count; i++) for (int i = 0; i < finalUpdates.Count; i++)
{ {
Rectangle rect = finalUpdates[i]; Rectangle rect = finalUpdates[i];
int blockStride = pixelSize*rect.Width; int blockStride = pixelSize * rect.Width;
Bitmap tmpBmp = null; Bitmap tmpBmp = null;
BitmapData tmpData = null; BitmapData tmpData = null;
@ -238,8 +255,8 @@ namespace xClient.Core.Helper
for (int j = 0, offset = 0; j < rect.Height; j++) for (int j = 0, offset = 0; j < rect.Height; j++)
{ {
int blockOffset = (stride*(rect.Y + j)) + (pixelSize*rect.X); int blockOffset = (stride * (rect.Y + j)) + (pixelSize * rect.X);
memcpy((byte*) tmpData.Scan0.ToPointer() + offset, pScan0 + blockOffset, (uint) blockStride); NativeMethods.memcpy((byte*)tmpData.Scan0.ToPointer() + offset, pScan0 + blockOffset, (uint)blockStride);
//copy-changes //copy-changes
offset += blockStride; offset += blockStride;
} }
@ -267,7 +284,7 @@ namespace xClient.Core.Helper
tmpBmp.Dispose(); tmpBmp.Dispose();
} }
totalDataLength += length + (4*5); totalDataLength += length + (4 * 5);
} }
outStream.Position = oldPos; outStream.Position = oldPos;
@ -282,7 +299,7 @@ namespace xClient.Core.Helper
return _decodedBitmap; return _decodedBitmap;
} }
int dataSize = *(int*) (codecBuffer); int dataSize = *(int*)(codecBuffer);
if (_decodedBitmap == null) if (_decodedBitmap == null)
{ {
@ -290,10 +307,10 @@ namespace xClient.Core.Helper
fixed (byte* tempPtr = temp) fixed (byte* tempPtr = temp)
{ {
memcpy(new IntPtr(tempPtr), new IntPtr(codecBuffer.ToInt32() + 4), (uint) dataSize); NativeMethods.memcpy(new IntPtr(tempPtr), new IntPtr(codecBuffer.ToInt32() + 4), (uint)dataSize);
} }
this._decodedBitmap = (Bitmap) Bitmap.FromStream(new MemoryStream(temp)); this._decodedBitmap = (Bitmap)Bitmap.FromStream(new MemoryStream(temp));
return _decodedBitmap; return _decodedBitmap;
} }
@ -313,7 +330,7 @@ namespace xClient.Core.Helper
{ {
temp = new byte[dataSize]; temp = new byte[dataSize];
inStream.Read(temp, 0, temp.Length); inStream.Read(temp, 0, temp.Length);
this._decodedBitmap = (Bitmap) Bitmap.FromStream(new MemoryStream(temp)); this._decodedBitmap = (Bitmap)Bitmap.FromStream(new MemoryStream(temp));
return _decodedBitmap; return _decodedBitmap;
} }
@ -322,7 +339,7 @@ namespace xClient.Core.Helper
{ {
while (dataSize > 0) while (dataSize > 0)
{ {
byte[] tempData = new byte[4*5]; byte[] tempData = new byte[4 * 5];
inStream.Read(tempData, 0, tempData.Length); inStream.Read(tempData, 0, tempData.Length);
Rectangle rect = new Rectangle(BitConverter.ToInt32(tempData, 0), BitConverter.ToInt32(tempData, 4), Rectangle rect = new Rectangle(BitConverter.ToInt32(tempData, 0), BitConverter.ToInt32(tempData, 4),
@ -334,13 +351,13 @@ namespace xClient.Core.Helper
using (MemoryStream m = new MemoryStream(buffer)) using (MemoryStream m = new MemoryStream(buffer))
{ {
using (Bitmap tmp = (Bitmap) Image.FromStream(m)) using (Bitmap tmp = (Bitmap)Image.FromStream(m))
{ {
g.DrawImage(tmp, rect.Location); g.DrawImage(tmp, rect.Location);
} }
} }
dataSize -= updateLen + (4*5); dataSize -= updateLen + (4 * 5);
} }
} }

9
Client/Enums/PathType.cs Normal file
View File

@ -0,0 +1,9 @@
namespace xClient.Enums
{
public enum PathType
{
File,
Directory,
Back
}
}

View File

@ -0,0 +1,8 @@
namespace xClient.Enums
{
public enum RemoteDesktopAction
{
Start,
Stop
}
}

View File

@ -0,0 +1,9 @@
namespace xClient.Enums
{
public enum ShutdownAction
{
Shutdown,
Restart,
Standby
}
}

View File

@ -0,0 +1,8 @@
namespace xClient.Enums
{
public enum UserStatus
{
Idle,
Active
}
}

View File

@ -37,8 +37,9 @@ namespace xClient
private static void Cleanup() private static void Cleanup()
{ {
CommandHandler.IsStreamingDesktop = false; CommandHandler.IsStreamingDesktop = false;
CommandHandler.StreamCodec = null;
CommandHandler.CloseShell(); CommandHandler.CloseShell();
if (CommandHandler.StreamCodec != null)
CommandHandler.StreamCodec.Dispose();
if (Logger.Instance != null) if (Logger.Instance != null)
Logger.Instance.Dispose(); Logger.Instance.Dispose();
if (_msgLoop != null) if (_msgLoop != null)

View File

@ -11,8 +11,8 @@ namespace xServer.Tests.Core.Encryption
[TestMethod] [TestMethod]
public void EncryptAndDecryptStringTest() public void EncryptAndDecryptStringTest()
{ {
var input = Helper.GetRandomName(100); var input = FileHelper.GetRandomFilename(100);
var password = Helper.GetRandomName(50); var password = FileHelper.GetRandomFilename(50);
var encrypted = AES.Encrypt(input, password); var encrypted = AES.Encrypt(input, password);
Assert.IsNotNull(encrypted); Assert.IsNotNull(encrypted);
@ -26,10 +26,10 @@ namespace xServer.Tests.Core.Encryption
[TestMethod] [TestMethod]
public void EncryptAndDecryptByteArrayTest() public void EncryptAndDecryptByteArrayTest()
{ {
var input = Helper.GetRandomName(100); var input = FileHelper.GetRandomFilename(100);
var inputByte = Encoding.UTF8.GetBytes(input); var inputByte = Encoding.UTF8.GetBytes(input);
var passwordByte = Encoding.UTF8.GetBytes(Helper.GetRandomName(50)); var passwordByte = Encoding.UTF8.GetBytes(FileHelper.GetRandomFilename(50));
var encryptedByte = AES.Encrypt(inputByte, passwordByte); var encryptedByte = AES.Encrypt(inputByte, passwordByte);
Assert.IsNotNull(encryptedByte); Assert.IsNotNull(encryptedByte);

View File

@ -2,7 +2,7 @@
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace xServer.Core.Misc namespace xServer.Controls
{ {
public static class InputBox public static class InputBox
{ {

View File

@ -1,12 +1,46 @@
using System.Windows.Forms; using System;
using System.Windows.Forms;
using xServer.Core.Helper;
using xServer.Core.Utilities;
namespace xServer.Controls namespace xServer.Controls
{ {
internal class ListViewEx : ListView internal class AeroListView : ListView
{ {
public ListViewEx() private const int LVS_EX_DOUBLEBUFFER = 0x10000;
private const int LVM_SETEXTENDEDLISTVIEWSTYLE = 4150;
private const uint WM_CHANGEUISTATE = 0x127;
private const int UIS_SET = 1;
private const int UISF_HIDEFOCUS = 0x1;
/// <summary>
/// Initializes a new instance of the <see cref="AeroListView"/> class.
/// </summary>
public AeroListView()
: base()
{ {
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.View = View.Details;
this.FullRowSelect = true;
}
/// <summary>
/// Raises the <see cref="E:HandleCreated" /> event.
/// </summary>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
if (!PlatformHelper.RunningOnMono && PlatformHelper.VistaOrHigher)
{
NativeMethods.SetWindowTheme(this.Handle, "explorer", null);
NativeMethods.SendMessage(this.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, new IntPtr(LVS_EX_DOUBLEBUFFER),
new IntPtr(LVS_EX_DOUBLEBUFFER));
NativeMethods.SendMessage(this.Handle, WM_CHANGEUISTATE, NativeMethodsHelper.MakeLong(UIS_SET, UISF_HIDEFOCUS), 0);
}
} }
} }
} }

View File

@ -4,6 +4,7 @@ using Mono.Cecil;
using Mono.Cecil.Cil; using Mono.Cecil.Cil;
using Vestris.ResourceLib; using Vestris.ResourceLib;
using xServer.Core.Encryption; using xServer.Core.Encryption;
using xServer.Core.Helper;
namespace xServer.Core.Build namespace xServer.Core.Build
{ {
@ -42,7 +43,7 @@ namespace xServer.Core.Build
int installpath, bool adminelevation, string iconpath, string[] asminfo, string version) int installpath, bool adminelevation, string iconpath, string[] asminfo, string version)
{ {
// PHASE 1 - Settings // PHASE 1 - Settings
string encKey = Helper.Helper.GetRandomName(20); string encKey = FileHelper.GetRandomFilename(20);
AssemblyDefinition asmDef; AssemblyDefinition asmDef;
try try
{ {

View File

@ -10,28 +10,5 @@ namespace xServer.Core.Commands
private static bool _isAdding = false; private static bool _isAdding = false;
private static readonly object _isAddingLock = new object(); private static readonly object _isAddingLock = new object();
private const string DELIMITER = "$E$"; private const string DELIMITER = "$E$";
public enum UserStatus
{
Idle,
Active
}
public enum ShutdownAction
{
Shutdown,
Restart,
Standby
}
public enum PathType
{
File,
Directory,
Back
}
public enum RemoteDesktopAction
{
Start,
Stop
}
} }
} }

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Packets.ClientPackets; using xServer.Core.Packets.ClientPackets;
using xServer.Forms; using xServer.Forms;
@ -30,7 +31,7 @@ namespace xServer.Core.Commands
string userAtPc = string.Format("{0}@{1}", client.Value.Username, client.Value.PCName); string userAtPc = string.Format("{0}@{1}", client.Value.Username, client.Value.PCName);
client.Value.DownloadDirectory = (!Helper.Helper.CheckPathForIllegalChars(userAtPc)) ? client.Value.DownloadDirectory = (!FileHelper.CheckPathForIllegalChars(userAtPc)) ?
Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", userAtPc, client.Value.Id.Substring(0, 7))) : Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", userAtPc, client.Value.Id.Substring(0, 7))) :
Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.EndPoint.Address, client.Value.Id.Substring(0, 7))); Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.EndPoint.Address, client.Value.Id.Substring(0, 7)));

View File

@ -1,8 +1,8 @@
using System; using System;
using System.IO; using System.IO;
using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Packets.ClientPackets; using xServer.Core.Packets.ClientPackets;
using xServer.Core.Utilities;
using xServer.Forms; using xServer.Forms;
namespace xServer.Core.Commands namespace xServer.Core.Commands
@ -35,7 +35,7 @@ namespace xServer.Core.Commands
{ {
for (int i = 1; i < 100; i++) for (int i = 1; i < 100; i++)
{ {
var newFileName = string.Format("{0}_{1}{2}", Path.GetFileNameWithoutExtension(downloadPath), i, Path.GetExtension(downloadPath)); var newFileName = string.Format("{0} ({1}){2}", Path.GetFileNameWithoutExtension(downloadPath), i, Path.GetExtension(downloadPath));
if (File.Exists(Path.Combine(client.Value.DownloadDirectory, newFileName))) continue; if (File.Exists(Path.Combine(client.Value.DownloadDirectory, newFileName))) continue;
downloadPath = Path.Combine(client.Value.DownloadDirectory, newFileName); downloadPath = Path.Combine(client.Value.DownloadDirectory, newFileName);

View File

@ -1,10 +1,9 @@
using System.Drawing; using System.IO;
using System.IO;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Packets.ClientPackets; using xServer.Core.Packets.ClientPackets;
using xServer.Core.Utilities;
namespace xServer.Core.Commands namespace xServer.Core.Commands
{ {
@ -18,69 +17,24 @@ namespace xServer.Core.Commands
if (packet.Image == null) if (packet.Image == null)
{ {
if (client.Value.FrmRdp != null)
client.Value.FrmRdp.UpdateImage(client.Value.LastDesktop);
client.Value.LastDesktop = null;
return; return;
} }
// we can not dispose all bitmaps here, cause they are later used again in `client.Value.LastDesktop` if (client.Value.StreamCodec == null)
if (client.Value.LastDesktop == null) client.Value.StreamCodec = new UnsafeStreamCodec(packet.Quality, packet.Monitor);
if (client.Value.StreamCodec.ImageQuality != packet.Quality || client.Value.StreamCodec.Monitor != packet.Monitor)
{ {
if (client.Value.StreamCodec != null) if (client.Value.StreamCodec != null)
{
client.Value.StreamCodec.Dispose(); client.Value.StreamCodec.Dispose();
}
client.Value.StreamCodec = new UnsafeStreamCodec(); client.Value.StreamCodec = new UnsafeStreamCodec(packet.Quality, packet.Monitor);
if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
{
client.Value.LastQuality = packet.Quality;
client.Value.LastMonitor = packet.Monitor;
} }
using (MemoryStream ms = new MemoryStream(packet.Image)) using (MemoryStream ms = new MemoryStream(packet.Image))
{ {
Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);
client.Value.LastDesktop = newScreen;
if (client.Value.FrmRdp != null) if (client.Value.FrmRdp != null)
client.Value.FrmRdp.UpdateImage(newScreen, true); client.Value.FrmRdp.UpdateImage(client.Value.StreamCodec.DecodeData(ms), true);
newScreen = null;
}
}
else
{
using (MemoryStream ms = new MemoryStream(packet.Image))
{
lock (client.Value.StreamCodec)
{
if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
{
if (client.Value.StreamCodec != null)
{
client.Value.StreamCodec.Dispose();
}
client.Value.StreamCodec = new UnsafeStreamCodec();
client.Value.LastQuality = packet.Quality;
client.Value.LastMonitor = packet.Monitor;
}
Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);
client.Value.LastDesktop = newScreen;
if (client.Value.FrmRdp != null)
client.Value.FrmRdp.UpdateImage(newScreen, true);
newScreen = null;
}
}
} }
packet.Image = null; packet.Image = null;

View File

@ -3,9 +3,11 @@ using System.IO;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Misc; using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Packets.ClientPackets; using xServer.Core.Packets.ClientPackets;
using xServer.Core.Utilities;
using xServer.Enums;
using xServer.Forms; using xServer.Forms;
using xServer.Settings; using xServer.Settings;
@ -80,10 +82,10 @@ namespace xServer.Core.Commands
if (packet.Files[i] != DELIMITER) if (packet.Files[i] != DELIMITER)
{ {
ListViewItem lvi = ListViewItem lvi =
new ListViewItem(new string[] { packet.Files[i], Helper.Helper.GetDataSize(packet.FilesSize[i]), PathType.File.ToString() }) new ListViewItem(new string[] { packet.Files[i], FileHelper.GetDataSize(packet.FilesSize[i]), PathType.File.ToString() })
{ {
Tag = PathType.File, Tag = PathType.File,
ImageIndex = Helper.Helper.GetFileIcon(Path.GetExtension(packet.Files[i])) ImageIndex = FileHelper.GetFileIcon(Path.GetExtension(packet.Files[i]))
}; };
if (client.Value.FrmFm == null) if (client.Value.FrmFm == null)

View File

@ -1,39 +1,20 @@
using System; using System.Windows.Forms;
using System.Runtime.InteropServices; using xServer.Core.Helper;
using System.Windows.Forms; using xServer.Core.Utilities;
namespace xServer.Core.Extensions namespace xServer.Core.Extensions
{ {
public static class ListViewExtensions public static class ListViewExtensions
{ {
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
private static extern int SetWindowTheme(IntPtr hWnd, string pszSubAppName, int pszSubIdList);
private const uint WM_CHANGEUISTATE = 0x127;
private const uint SET_COLUMN_WIDTH = 4126; private const uint SET_COLUMN_WIDTH = 4126;
private const int AUTOSIZE_USEHEADER = -2; private const int AUTOSIZE_USEHEADER = -2;
public static void RemoveDots(this ListView targetListView)
{
if (Helper.Helper.IsRunningOnMono()) return;
SendMessage(targetListView.Handle, WM_CHANGEUISTATE, 65537, 0);
}
public static void ChangeTheme(this ListView targetListView)
{
if (Helper.Helper.IsRunningOnMono()) return;
SetWindowTheme(targetListView.Handle, "Explorer", 0);
}
public static void AutosizeColumns(this ListView targetListView) public static void AutosizeColumns(this ListView targetListView)
{ {
if (Helper.Helper.IsRunningOnMono()) return; if (PlatformHelper.RunningOnMono) return;
for (int lngColumn = 0; lngColumn <= (targetListView.Columns.Count - 1); lngColumn++) for (int lngColumn = 0; lngColumn <= (targetListView.Columns.Count - 1); lngColumn++)
{ {
SendMessage(targetListView.Handle, SET_COLUMN_WIDTH, lngColumn, AUTOSIZE_USEHEADER); NativeMethods.SendMessage(targetListView.Handle, SET_COLUMN_WIDTH, lngColumn, AUTOSIZE_USEHEADER);
} }
} }
} }

View File

@ -2,15 +2,14 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using xServer.Core.Networking;
namespace xServer.Core.Helper namespace xServer.Core.Helper
{ {
public static class Helper public static class FileHelper
{ {
private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static readonly Random _rnd = new Random(Environment.TickCount); private static readonly Random _rnd = new Random(Environment.TickCount);
private static readonly string[] _sizes = {"B", "KB", "MB", "GB"}; private static readonly string[] _sizes = { "B", "KB", "MB", "GB" };
private static readonly char[] _illegalChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).ToArray(); private static readonly char[] _illegalChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).ToArray();
public static bool CheckPathForIllegalChars(string path) public static bool CheckPathForIllegalChars(string path)
@ -18,7 +17,7 @@ namespace xServer.Core.Helper
return path.Any(c => _illegalChars.Contains(c)); return path.Any(c => _illegalChars.Contains(c));
} }
public static string GetRandomFilename(int length, string extension) public static string GetRandomFilename(int length, string extension = "")
{ {
StringBuilder randomName = new StringBuilder(length); StringBuilder randomName = new StringBuilder(length);
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
@ -27,15 +26,6 @@ namespace xServer.Core.Helper
return string.Concat(randomName.ToString(), extension); return string.Concat(randomName.ToString(), extension);
} }
public static string GetRandomName(int length)
{
StringBuilder randomName = new StringBuilder(length);
for (int i = 0; i < length; i++)
randomName.Append(CHARS[_rnd.Next(CHARS.Length)]);
return randomName.ToString();
}
public static int GetNewTransferId(int o = 0) public static int GetNewTransferId(int o = 0)
{ {
return _rnd.Next(0, int.MaxValue) + o; return _rnd.Next(0, int.MaxValue) + o;
@ -48,21 +38,11 @@ namespace xServer.Core.Helper
while (len >= 1024 && order + 1 < _sizes.Length) while (len >= 1024 && order + 1 < _sizes.Length)
{ {
order++; order++;
len = len/1024; len = len / 1024;
} }
return string.Format("{0:0.##} {1}", len, _sizes[order]); 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) public static int GetFileIcon(string extension)
{ {
if (string.IsNullOrEmpty(extension)) if (string.IsNullOrEmpty(extension))
@ -122,10 +102,5 @@ namespace xServer.Core.Helper
return 10; return 10;
} }
} }
public static bool IsRunningOnMono()
{
return Type.GetType("Mono.Runtime") != null;
}
} }
} }

View File

@ -0,0 +1,30 @@
using System.IO;
using System.Text.RegularExpressions;
namespace xServer.Core.Helper
{
public static class FormatHelper
{
public static string FormatMacAddress(string macAddress)
{
return (macAddress.Length != 12)
? "00:00:00:00:00:00"
: Regex.Replace(macAddress, "(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})", "$1:$2:$3:$4:$5:$6");
}
public static string DriveTypeName(DriveType type)
{
switch (type)
{
case DriveType.Fixed:
return "Local Disk";
case DriveType.Network:
return "Network Drive";
case DriveType.Removable:
return "Removable Drive";
default:
return type.ToString();
}
}
}
}

View File

@ -0,0 +1,19 @@
namespace xServer.Core.Helper
{
public static class NativeMethodsHelper
{
public static int MakeLong(int wLow, int wHigh)
{
int low = (int)IntLoWord(wLow);
short high = IntLoWord(wHigh);
int product = 0x10000 * (int)high;
int mkLong = (int)(low | product);
return mkLong;
}
private static short IntLoWord(int word)
{
return (short)(word & short.MaxValue);
}
}
}

View File

@ -0,0 +1,68 @@
using System;
namespace xServer.Core.Helper
{
public static class PlatformHelper
{
/// <summary>
/// Initializes the <see cref="PlatformHelper"/> class.
/// </summary>
static PlatformHelper()
{
Win32NT = Environment.OSVersion.Platform == PlatformID.Win32NT;
XpOrHigher = Win32NT && Environment.OSVersion.Version.Major >= 5;
VistaOrHigher = Win32NT && Environment.OSVersion.Version.Major >= 6;
SevenOrHigher = Win32NT && (Environment.OSVersion.Version >= new Version(6, 1));
EightOrHigher = Win32NT && (Environment.OSVersion.Version >= new Version(6, 2, 9200));
RunningOnMono = Type.GetType("Mono.Runtime") != null;
}
/// <summary>
/// Returns a indicating whether the application is running in Mono runtime.
/// </summary>
/// <value>
/// <c>true</c> if the application is running in Mono runtime; otherwise, <c>false</c>.
/// </value>
public static bool RunningOnMono { get; private set; }
/// <summary>
/// Returns a indicating whether the Operating System is Windows 32 NT based.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 32 NT based; otherwise, <c>false</c>.
/// </value>
public static bool Win32NT { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows XP or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 8 or higher; otherwise, <c>false</c>.
/// </value>
public static bool XpOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows Vista or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows Vista or higher; otherwise, <c>false</c>.
/// </value>
public static bool VistaOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows 7 or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 7 or higher; otherwise, <c>false</c>.
/// </value>
public static bool SevenOrHigher { get; private set; }
/// <summary>
/// Returns a value indicating whether the Operating System is Windows 8 or higher.
/// </summary>
/// <value>
/// <c>true</c> if the Operating System is Windows 8 or higher; otherwise, <c>false</c>.
/// </value>
public static bool EightOrHigher { get; private set; }
}
}

View File

@ -0,0 +1,20 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace xServer.Core.Helper
{
public static class RemoteDesktopHelper
{
public static Bitmap GetDesktop(int screenNumber)
{
var bounds = Screen.AllScreens[screenNumber].Bounds;
var screenshot = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
using (Graphics graph = Graphics.FromImage(screenshot))
{
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy);
return screenshot;
}
}
}
}

View File

@ -0,0 +1,17 @@
using xServer.Core.Networking;
namespace xServer.Core.Helper
{
public static class WindowHelper
{
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);
}
}
}

View File

@ -1,12 +1,12 @@
using System.Drawing; using System;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper;
using xServer.Core.ReverseProxy; using xServer.Core.ReverseProxy;
using xServer.Core.Utilities;
using xServer.Forms; using xServer.Forms;
namespace xServer.Core.Networking namespace xServer.Core.Networking
{ {
public class UserState public class UserState : IDisposable
{ {
public string Version { get; set; } public string Version { get; set; }
public string OperatingSystem { get; set; } public string OperatingSystem { get; set; }
@ -31,9 +31,6 @@ namespace xServer.Core.Networking
public bool IsAuthenticated { get; set; } public bool IsAuthenticated { get; set; }
public bool LastDirectorySeen { get; set; } public bool LastDirectorySeen { get; set; }
public int LastQuality { get; set; }
public int LastMonitor { get; set; }
public Bitmap LastDesktop { get; set; }
public UnsafeStreamCodec StreamCodec { get; set; } public UnsafeStreamCodec StreamCodec { get; set; }
public ReverseProxyServer ProxyServer { get; set; } public ReverseProxyServer ProxyServer { get; set; }
@ -41,11 +38,16 @@ namespace xServer.Core.Networking
{ {
IsAuthenticated = false; IsAuthenticated = false;
LastDirectorySeen = true; LastDirectorySeen = true;
LastQuality = -1;
LastMonitor = -1;
} }
public void DisposeForms() public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{ {
if (FrmRdp != null) if (FrmRdp != null)
FrmRdp.Invoke((MethodInvoker)delegate { FrmRdp.Close(); }); FrmRdp.Invoke((MethodInvoker)delegate { FrmRdp.Close(); });
@ -63,6 +65,9 @@ namespace xServer.Core.Networking
FrmKl.Invoke((MethodInvoker)delegate { FrmKl.Close(); }); FrmKl.Invoke((MethodInvoker)delegate { FrmKl.Close(); });
if (FrmProxy != null) if (FrmProxy != null)
FrmProxy.Invoke((MethodInvoker)delegate { FrmProxy.Close(); }); FrmProxy.Invoke((MethodInvoker)delegate { FrmProxy.Close(); });
if (StreamCodec != null)
StreamCodec.Dispose();
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xServer.Core.Networking; using xServer.Core.Networking;
using UserStatus = xServer.Core.Commands.CommandHandler.UserStatus; using xServer.Enums;
namespace xServer.Core.Packets.ClientPackets namespace xServer.Core.Packets.ClientPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xServer.Core.Networking; using xServer.Core.Networking;
using PathType = xServer.Core.Commands.CommandHandler.PathType; using xServer.Enums;
namespace xServer.Core.Packets.ServerPackets namespace xServer.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xServer.Core.Networking; using xServer.Core.Networking;
using PathType = xServer.Core.Commands.CommandHandler.PathType; using xServer.Enums;
namespace xServer.Core.Packets.ServerPackets namespace xServer.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xServer.Core.Networking; using xServer.Core.Networking;
using ShutdownAction = xServer.Core.Commands.CommandHandler.ShutdownAction; using xServer.Enums;
namespace xServer.Core.Packets.ServerPackets namespace xServer.Core.Packets.ServerPackets
{ {

View File

@ -1,6 +1,6 @@
using ProtoBuf; using ProtoBuf;
using xServer.Core.Networking; using xServer.Core.Networking;
using RemoteDesktopAction = xServer.Core.Commands.CommandHandler.RemoteDesktopAction; using xServer.Enums;
namespace xServer.Core.Packets.ServerPackets namespace xServer.Core.Packets.ServerPackets
{ {

View File

@ -1,7 +1,7 @@
using System; using System;
using System.IO; using System.IO;
namespace xServer.Core.Helper namespace xServer.Core.Utilities
{ {
public class FileSplit public class FileSplit
{ {

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace xServer.Core.Helper namespace xServer.Core.Utilities
{ {
public class FrameCounter public class FrameCounter
{ {

View File

@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Windows.Forms; using System.Windows.Forms;
namespace xServer.Core.Misc namespace xServer.Core.Utilities
{ {
public class ListViewColumnSorter : IComparer public class ListViewColumnSorter : IComparer
{ {

View File

@ -0,0 +1,44 @@
using System;
using System.Runtime.InteropServices;
namespace xServer.Core.Utilities
{
/// <summary>
/// Provides some methods from the "user32.dll" and uxtheme libraries.
/// </summary>
public static class NativeMethods
{
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, string lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetCursor(IntPtr hCursor);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType, int cxDesired, int cyDesired, uint fuLoad);
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcpy(void* dst, void* src, uint count);
}
}

View File

@ -4,7 +4,7 @@ using System.Text;
using System.Threading; using System.Threading;
using xServer.Settings; using xServer.Settings;
namespace xServer.Core.Misc namespace xServer.Core.Utilities
{ {
public static class NoIpUpdater public static class NoIpUpdater
{ {

View File

@ -1,4 +1,4 @@
namespace xServer.Core.Misc namespace xServer.Core.Utilities
{ {
public class RemoteDrive public class RemoteDrive
{ {

View File

@ -1,4 +1,4 @@
namespace xServer.Core.Misc namespace xServer.Core.Utilities
{ {
public static class Update public static class Update
{ {

View File

@ -3,15 +3,14 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using xServer.Core.Compression; using xServer.Core.Compression;
namespace xServer.Core.Helper namespace xServer.Core.Utilities
{ {
public class UnsafeStreamCodec : IDisposable public class UnsafeStreamCodec : IDisposable
{ {
private int _imageQuality; public int Monitor { get; private set; }
public Size CheckBlock { get; private set; }
public int ImageQuality public int ImageQuality
{ {
get { return _imageQuality; } get { return _imageQuality; }
@ -31,7 +30,7 @@ namespace xServer.Core.Helper
} }
} }
public Size CheckBlock { get; private set; } private int _imageQuality;
private byte[] _encodeBuffer; private byte[] _encodeBuffer;
private Bitmap _decodedBitmap; private Bitmap _decodedBitmap;
private PixelFormat _encodedFormat; private PixelFormat _encodedFormat;
@ -40,24 +39,15 @@ namespace xServer.Core.Helper
private readonly object _imageProcessLock = new object(); private readonly object _imageProcessLock = new object();
private JpgCompression _jpgCompression; private JpgCompression _jpgCompression;
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe int memcpy(void* dst, void* src, uint count);
/// <summary> /// <summary>
/// Initialize a new object of UnsafeStreamCodec /// Initialize a new instance of UnsafeStreamCodec class.
/// </summary> /// </summary>
/// <param name="imageQuality">The quality to use between 0-100</param> /// <param name="imageQuality">The quality to use between 0-100.</param>
public UnsafeStreamCodec(int imageQuality = 100) /// <param name="monitor">The monitor used for the images.</param>
public UnsafeStreamCodec(int imageQuality, int monitor)
{ {
this.ImageQuality = imageQuality;
this.Monitor = monitor;
this.CheckBlock = new Size(50, 1); this.CheckBlock = new Size(50, 1);
} }
@ -136,7 +126,7 @@ namespace xServer.Core.Helper
outStream.Write(BitConverter.GetBytes(temp.Length), 0, 4); outStream.Write(BitConverter.GetBytes(temp.Length), 0, 4);
outStream.Write(temp, 0, temp.Length); outStream.Write(temp, 0, temp.Length);
memcpy(new IntPtr(ptr), scan0, (uint) rawLength); NativeMethods.memcpy(new IntPtr(ptr), scan0, (uint) rawLength);
} }
return; return;
} }
@ -182,7 +172,7 @@ namespace xServer.Core.Helper
int offset = (y*stride) + (scanArea.X*pixelSize); int offset = (y*stride) + (scanArea.X*pixelSize);
if (memcmp(encBuffer + offset, pScan0 + offset, (uint) stride) != 0) if (NativeMethods.memcmp(encBuffer + offset, pScan0 + offset, (uint)stride) != 0)
{ {
index = blocks.Count - 1; index = blocks.Count - 1;
@ -218,12 +208,12 @@ namespace xServer.Core.Helper
{ {
int blockOffset = (stride*(cBlock.Y + j)) + (pixelSize*cBlock.X); int blockOffset = (stride*(cBlock.Y + j)) + (pixelSize*cBlock.X);
if (memcmp(encBuffer + blockOffset, pScan0 + blockOffset, blockStride) != 0) if (NativeMethods.memcmp(encBuffer + blockOffset, pScan0 + blockOffset, blockStride) != 0)
{ {
foundChanges = true; foundChanges = true;
} }
memcpy(encBuffer + blockOffset, pScan0 + blockOffset, blockStride); NativeMethods.memcpy(encBuffer + blockOffset, pScan0 + blockOffset, blockStride);
//copy-changes //copy-changes
} }
@ -266,7 +256,7 @@ namespace xServer.Core.Helper
for (int j = 0, offset = 0; j < rect.Height; j++) for (int j = 0, offset = 0; j < rect.Height; j++)
{ {
int blockOffset = (stride*(rect.Y + j)) + (pixelSize*rect.X); int blockOffset = (stride*(rect.Y + j)) + (pixelSize*rect.X);
memcpy((byte*) tmpData.Scan0.ToPointer() + offset, pScan0 + blockOffset, (uint) blockStride); NativeMethods.memcpy((byte*)tmpData.Scan0.ToPointer() + offset, pScan0 + blockOffset, (uint)blockStride);
//copy-changes //copy-changes
offset += blockStride; offset += blockStride;
} }
@ -317,7 +307,7 @@ namespace xServer.Core.Helper
fixed (byte* tempPtr = temp) fixed (byte* tempPtr = temp)
{ {
memcpy(new IntPtr(tempPtr), new IntPtr(codecBuffer.ToInt32() + 4), (uint) dataSize); NativeMethods.memcpy(new IntPtr(tempPtr), new IntPtr(codecBuffer.ToInt32() + 4), (uint)dataSize);
} }
this._decodedBitmap = (Bitmap) Bitmap.FromStream(new MemoryStream(temp)); this._decodedBitmap = (Bitmap) Bitmap.FromStream(new MemoryStream(temp));

9
Server/Enums/PathType.cs Normal file
View File

@ -0,0 +1,9 @@
namespace xServer.Enums
{
public enum PathType
{
File,
Directory,
Back
}
}

View File

@ -0,0 +1,8 @@
namespace xServer.Enums
{
public enum RemoteDesktopAction
{
Start,
Stop
}
}

View File

@ -0,0 +1,9 @@
namespace xServer.Enums
{
public enum ShutdownAction
{
Shutdown,
Restart,
Standby
}
}

View File

@ -0,0 +1,8 @@
namespace xServer.Enums
{
public enum UserStatus
{
Idle,
Active
}
}

View File

@ -2,7 +2,7 @@
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc; using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -53,13 +53,13 @@ namespace xServer.Forms
private void txtName_KeyPress(object sender, KeyPressEventArgs e) private void txtName_KeyPress(object sender, KeyPressEventArgs e)
{ {
e.Handled = ((e.KeyChar == '\\' || Helper.CheckPathForIllegalChars(e.KeyChar.ToString())) && e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar)); !char.IsControl(e.KeyChar));
} }
private void txtPath_KeyPress(object sender, KeyPressEventArgs e) private void txtPath_KeyPress(object sender, KeyPressEventArgs e)
{ {
e.Handled = ((e.KeyChar == '\\' || Helper.CheckPathForIllegalChars(e.KeyChar.ToString())) && e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar)); !char.IsControl(e.KeyChar));
} }
} }

View File

@ -102,7 +102,7 @@ namespace xServer.Forms
{ {
txtPort.Text = XMLSettings.ListenPort.ToString(); txtPort.Text = XMLSettings.ListenPort.ToString();
txtPassword.Text = XMLSettings.Password; txtPassword.Text = XMLSettings.Password;
txtMutex.Text = Helper.GetRandomName(32); txtMutex.Text = FileHelper.GetRandomFilename(32);
} }
UpdateControlStates(); UpdateControlStates();
@ -139,13 +139,13 @@ namespace xServer.Forms
private void txtInstallname_KeyPress(object sender, KeyPressEventArgs e) private void txtInstallname_KeyPress(object sender, KeyPressEventArgs e)
{ {
e.Handled = ((e.KeyChar == '\\' || Helper.CheckPathForIllegalChars(e.KeyChar.ToString())) && e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar)); !char.IsControl(e.KeyChar));
} }
private void txtInstallsub_KeyPress(object sender, KeyPressEventArgs e) private void txtInstallsub_KeyPress(object sender, KeyPressEventArgs e)
{ {
e.Handled = ((e.KeyChar == '\\' || Helper.CheckPathForIllegalChars(e.KeyChar.ToString())) && e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar)); !char.IsControl(e.KeyChar));
} }
@ -153,7 +153,7 @@ namespace xServer.Forms
{ {
HasChanged(); HasChanged();
txtMutex.Text = Helper.GetRandomName(32); txtMutex.Text = FileHelper.GetRandomFilename(32);
} }
private void chkInstall_CheckedChanged(object sender, EventArgs e) private void chkInstall_CheckedChanged(object sender, EventArgs e)

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -16,8 +17,8 @@ namespace xServer.Forms
private void btnDownloadAndExecute_Click(object sender, EventArgs e) private void btnDownloadAndExecute_Click(object sender, EventArgs e)
{ {
Core.Misc.DownloadAndExecute.URL = txtURL.Text; DownloadAndExecute.URL = txtURL.Text;
Core.Misc.DownloadAndExecute.RunHidden = chkRunHidden.Checked; DownloadAndExecute.RunHidden = chkRunHidden.Checked;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();
@ -25,9 +26,9 @@ namespace xServer.Forms
private void FrmDownloadAndExecute_Load(object sender, EventArgs e) private void FrmDownloadAndExecute_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Download & Execute", _selectedClients); this.Text = WindowHelper.GetWindowTitle("Download & Execute", _selectedClients);
txtURL.Text = Core.Misc.DownloadAndExecute.URL; txtURL.Text = DownloadAndExecute.URL;
chkRunHidden.Checked = Core.Misc.DownloadAndExecute.RunHidden; chkRunHidden.Checked = DownloadAndExecute.RunHidden;
} }
} }
} }

View File

@ -52,7 +52,7 @@ namespace xServer.Forms
this.imgListTransfers = new System.Windows.Forms.ImageList(this.components); this.imgListTransfers = new System.Windows.Forms.ImageList(this.components);
this.TabControlFileManager = new xServer.Controls.DotNetBarTabControl(); this.TabControlFileManager = new xServer.Controls.DotNetBarTabControl();
this.tabFileExplorer = new System.Windows.Forms.TabPage(); this.tabFileExplorer = new System.Windows.Forms.TabPage();
this.lstDirectory = new xServer.Controls.ListViewEx(); this.lstDirectory = new xServer.Controls.AeroListView();
this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -60,7 +60,7 @@ namespace xServer.Forms
this.cmbDrives = new System.Windows.Forms.ComboBox(); this.cmbDrives = new System.Windows.Forms.ComboBox();
this.tabTransfers = new System.Windows.Forms.TabPage(); this.tabTransfers = new System.Windows.Forms.TabPage();
this.btnOpenDLFolder = new System.Windows.Forms.Button(); this.btnOpenDLFolder = new System.Windows.Forms.Button();
this.lstTransfers = new xServer.Controls.ListViewEx(); this.lstTransfers = new xServer.Controls.AeroListView();
this.hID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -426,8 +426,8 @@ namespace xServer.Forms
private System.Windows.Forms.ToolStripMenuItem ctxtCancel; private System.Windows.Forms.ToolStripMenuItem ctxtCancel;
private System.Windows.Forms.ToolStripMenuItem ctxtOpenDirectory; private System.Windows.Forms.ToolStripMenuItem ctxtOpenDirectory;
private System.Windows.Forms.ComboBox cmbDrives; private System.Windows.Forms.ComboBox cmbDrives;
private ListViewEx lstDirectory; private AeroListView lstDirectory;
private ListViewEx lstTransfers; private AeroListView lstTransfers;
private System.Windows.Forms.StatusStrip botStrip; private System.Windows.Forms.StatusStrip botStrip;
private System.Windows.Forms.ToolStripMenuItem ctxtRemove; private System.Windows.Forms.ToolStripMenuItem ctxtRemove;
private System.Windows.Forms.ToolStripStatusLabel stripLblHint; private System.Windows.Forms.ToolStripStatusLabel stripLblHint;

View File

@ -5,12 +5,12 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Controls;
using xServer.Core.Commands; using xServer.Core.Commands;
using xServer.Core.Extensions;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using PathType = xServer.Core.Commands.CommandHandler.PathType; using xServer.Core.Utilities;
using xServer.Enums;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -29,11 +29,6 @@ namespace xServer.Forms
_lvwColumnSorter = new ListViewColumnSorter(); _lvwColumnSorter = new ListViewColumnSorter();
lstDirectory.ListViewItemSorter = _lvwColumnSorter; lstDirectory.ListViewItemSorter = _lvwColumnSorter;
lstDirectory.RemoveDots();
lstDirectory.ChangeTheme();
lstTransfers.RemoveDots();
lstTransfers.ChangeTheme();
} }
private string GetAbsolutePath(string item) private string GetAbsolutePath(string item)
@ -45,7 +40,7 @@ namespace xServer.Forms
{ {
if (_connectClient != null) if (_connectClient != null)
{ {
this.Text = Helper.GetWindowTitle("File Manager", _connectClient); this.Text = WindowHelper.GetWindowTitle("File Manager", _connectClient);
new Core.Packets.ServerPackets.GetDrives().Execute(_connectClient); new Core.Packets.ServerPackets.GetDrives().Execute(_connectClient);
} }
} }
@ -105,7 +100,7 @@ namespace xServer.Forms
{ {
string path = GetAbsolutePath(files.SubItems[0].Text); string path = GetAbsolutePath(files.SubItems[0].Text);
int id = Helper.GetNewTransferId(files.Index); int id = FileHelper.GetNewTransferId(files.Index);
if (_connectClient != null) if (_connectClient != null)
{ {
@ -301,7 +296,7 @@ namespace xServer.Forms
string path = filePath; string path = filePath;
new Thread(() => new Thread(() =>
{ {
int id = Helper.GetNewTransferId(); int id = FileHelper.GetNewTransferId();
if (string.IsNullOrEmpty(path)) return; if (string.IsNullOrEmpty(path)) return;

View File

@ -2,8 +2,8 @@
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -28,7 +28,7 @@ namespace xServer.Forms
{ {
if (_connectClient != null) if (_connectClient != null)
{ {
this.Text = Helper.GetWindowTitle("Keylogger", _connectClient); this.Text = WindowHelper.GetWindowTitle("Keylogger", _connectClient);
if (!Directory.Exists(_path)) if (!Directory.Exists(_path))
{ {

View File

@ -65,10 +65,10 @@ namespace xServer.Forms
this.botListen = new System.Windows.Forms.ToolStripStatusLabel(); this.botListen = new System.Windows.Forms.ToolStripStatusLabel();
this.imgFlags = new System.Windows.Forms.ImageList(this.components); this.imgFlags = new System.Windows.Forms.ImageList(this.components);
this.nIcon = new System.Windows.Forms.NotifyIcon(this.components); this.nIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.lstClients = new xServer.Controls.ListViewEx(); this.lstClients = new xServer.Controls.AeroListView();
this.hUserPC = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hSocket = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hSocket = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hUserPC = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hUserStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hUserStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -636,7 +636,6 @@ namespace xServer.Forms
this.hAccountType}); this.hAccountType});
this.lstClients.ContextMenuStrip = this.ctxtMenu; this.lstClients.ContextMenuStrip = this.ctxtMenu;
this.lstClients.FullRowSelect = true; this.lstClients.FullRowSelect = true;
this.lstClients.GridLines = true;
this.lstClients.Location = new System.Drawing.Point(0, 0); this.lstClients.Location = new System.Drawing.Point(0, 0);
this.lstClients.Name = "lstClients"; this.lstClients.Name = "lstClients";
this.lstClients.ShowItemToolTips = true; this.lstClients.ShowItemToolTips = true;
@ -648,11 +647,6 @@ namespace xServer.Forms
this.lstClients.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lstClients_ColumnClick); this.lstClients.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lstClients_ColumnClick);
this.lstClients.SelectedIndexChanged += new System.EventHandler(this.lstClients_SelectedIndexChanged); this.lstClients.SelectedIndexChanged += new System.EventHandler(this.lstClients_SelectedIndexChanged);
// //
// hUserPC
//
this.hUserPC.Text = "User@PC";
this.hUserPC.Width = 175;
//
// hIP // hIP
// //
this.hIP.Text = "IP Address"; this.hIP.Text = "IP Address";
@ -662,6 +656,11 @@ namespace xServer.Forms
// //
this.hSocket.Text = "Socket"; this.hSocket.Text = "Socket";
// //
// hUserPC
//
this.hUserPC.Text = "User@PC";
this.hUserPC.Width = 175;
//
// hVersion // hVersion
// //
this.hVersion.Text = "Version"; this.hVersion.Text = "Version";
@ -812,7 +811,7 @@ namespace xServer.Forms
private System.Windows.Forms.ToolStripMenuItem ctxtKeylogger; private System.Windows.Forms.ToolStripMenuItem ctxtKeylogger;
private System.Windows.Forms.ToolStripMenuItem ctxtReverseProxy; private System.Windows.Forms.ToolStripMenuItem ctxtReverseProxy;
private System.Windows.Forms.ToolStripMenuItem ctxtRegistryEditor; private System.Windows.Forms.ToolStripMenuItem ctxtRegistryEditor;
private ListViewEx lstClients; private AeroListView lstClients;
private System.Windows.Forms.NotifyIcon nIcon; private System.Windows.Forms.NotifyIcon nIcon;
private System.Windows.Forms.ColumnHeader hUserPC; private System.Windows.Forms.ColumnHeader hUserPC;
} }

View File

@ -5,14 +5,12 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Commands; using xServer.Core.Commands;
using xServer.Core.Extensions; using xServer.Enums;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Networking.Utilities; using xServer.Core.Networking.Utilities;
using xServer.Core.Utilities;
using xServer.Settings; using xServer.Settings;
using UserStatus = xServer.Core.Commands.CommandHandler.UserStatus;
using ShutdownAction = xServer.Core.Commands.CommandHandler.ShutdownAction;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -76,9 +74,6 @@ namespace xServer.Forms
_lvwColumnSorter = new ListViewColumnSorter(); _lvwColumnSorter = new ListViewColumnSorter();
lstClients.ListViewItemSorter = _lvwColumnSorter; lstClients.ListViewItemSorter = _lvwColumnSorter;
lstClients.RemoveDots();
lstClients.ChangeTheme();
} }
public void UpdateWindowTitle() public void UpdateWindowTitle()
@ -176,7 +171,7 @@ namespace xServer.Forms
{ {
if (client.Value != null) if (client.Value != null)
{ {
client.Value.DisposeForms(); client.Value.Dispose();
client.Value = null; client.Value = null;
} }
@ -400,11 +395,11 @@ namespace xServer.Forms
{ {
if (frm.ShowDialog() == DialogResult.OK) if (frm.ShowDialog() == DialogResult.OK)
{ {
if (Core.Misc.Update.UseDownload) if (Core.Utilities.Update.UseDownload)
{ {
foreach (Client c in GetSelectedClients()) foreach (Client c in GetSelectedClients())
{ {
new Core.Packets.ServerPackets.DoClientUpdate(0, Core.Misc.Update.DownloadURL, string.Empty, new byte[0x00], 0, 0).Execute(c); new Core.Packets.ServerPackets.DoClientUpdate(0, Core.Utilities.Update.DownloadURL, string.Empty, new byte[0x00], 0, 0).Execute(c);
} }
} }
else else
@ -417,8 +412,8 @@ namespace xServer.Forms
if (c == null) continue; if (c == null) continue;
if (error) continue; if (error) continue;
FileSplit srcFile = new FileSplit(Core.Misc.Update.UploadPath); FileSplit srcFile = new FileSplit(Core.Utilities.Update.UploadPath);
var fileName = Helper.GetRandomFilename(8, ".exe"); var fileName = FileHelper.GetRandomFilename(8, ".exe");
if (srcFile.MaxBlocks < 0) if (srcFile.MaxBlocks < 0)
{ {
MessageBox.Show(string.Format("Error reading file: {0}", srcFile.LastError), MessageBox.Show(string.Format("Error reading file: {0}", srcFile.LastError),
@ -427,7 +422,7 @@ namespace xServer.Forms
break; break;
} }
int id = Helper.GetNewTransferId(); int id = FileHelper.GetNewTransferId();
CommandHandler.HandleSetStatus(c, CommandHandler.HandleSetStatus(c,
new Core.Packets.ClientPackets.SetStatus("Uploading file...")); new Core.Packets.ClientPackets.SetStatus("Uploading file..."));
@ -669,7 +664,7 @@ namespace xServer.Forms
break; break;
} }
int id = Helper.GetNewTransferId(); int id = FileHelper.GetNewTransferId();
CommandHandler.HandleSetStatus(c, CommandHandler.HandleSetStatus(c,
new Core.Packets.ClientPackets.SetStatus("Uploading file...")); new Core.Packets.ClientPackets.SetStatus("Uploading file..."));

View File

@ -408,7 +408,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADY ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADY
sQAAAk1TRnQBSQFMAgEB+AEAAYgBBwGIAQcBEAEAAQsBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo sQAAAk1TRnQBSQFMAgEB+AEAAZgBBwGYAQcBEAEAAQsBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAbUBAgIAAQEBAAEIBQABQAGtGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHA AwABQAMAAbUBAgIAAQEBAAEIBQABQAGtGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHA
AdwBwAEAAfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANC AdwBwAEAAfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANC
AQADOQEAAYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ AQADOQEAAYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/

View File

@ -4,7 +4,8 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using RemoteDesktopAction = xServer.Core.Commands.CommandHandler.RemoteDesktopAction; using xServer.Core.Utilities;
using xServer.Enums;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -25,7 +26,7 @@ namespace xServer.Forms
private void FrmRemoteDesktop_Load(object sender, EventArgs e) private void FrmRemoteDesktop_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Remote Desktop", _connectClient); this.Text = WindowHelper.GetWindowTitle("Remote Desktop", _connectClient);
panelTop.Left = (this.Width/2) - (panelTop.Width/2); panelTop.Left = (this.Width/2) - (panelTop.Width/2);
@ -77,7 +78,7 @@ namespace xServer.Forms
{ {
this.Invoke((MethodInvoker)delegate this.Invoke((MethodInvoker)delegate
{ {
this.Text = string.Format("{0} - FPS: {1}", Helper.GetWindowTitle("Remote Desktop", _connectClient), fps.ToString("0.00")); this.Text = string.Format("{0} - FPS: {1}", WindowHelper.GetWindowTitle("Remote Desktop", _connectClient), fps.ToString("0.00"));
}); });
} }
catch (InvalidOperationException) catch (InvalidOperationException)

View File

@ -31,7 +31,7 @@ namespace xServer.Forms
this.DoubleBuffered = true; this.DoubleBuffered = true;
if (_connectClient != null) if (_connectClient != null)
this.Text = Helper.GetWindowTitle("Remote Shell", _connectClient); this.Text = WindowHelper.GetWindowTitle("Remote Shell", _connectClient);
} }
private void FrmRemoteShell_FormClosing(object sender, FormClosingEventArgs e) private void FrmRemoteShell_FormClosing(object sender, FormClosingEventArgs e)

View File

@ -37,7 +37,7 @@ namespace xServer.Forms
this.nudServerPort = new System.Windows.Forms.NumericUpDown(); this.nudServerPort = new System.Windows.Forms.NumericUpDown();
this.tabCtrl = new System.Windows.Forms.TabControl(); this.tabCtrl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.LvConnections = new xServer.Controls.ListViewEx(); this.LvConnections = new xServer.Controls.AeroListView();
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -270,7 +270,7 @@ namespace xServer.Forms
private System.Windows.Forms.NumericUpDown nudServerPort; private System.Windows.Forms.NumericUpDown nudServerPort;
private System.Windows.Forms.TabControl tabCtrl; private System.Windows.Forms.TabControl tabCtrl;
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage1;
private ListViewEx LvConnections; private AeroListView LvConnections;
private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3; private System.Windows.Forms.ColumnHeader columnHeader3;

View File

@ -31,7 +31,7 @@ namespace xServer.Forms
} }
else if (_clients.Length == 1) else if (_clients.Length == 1)
{ {
this.Text = Helper.GetWindowTitle("Reverse Proxy", _clients[0]); this.Text = WindowHelper.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"; lblLoadBalance.Text = "The Load Balancer is not active, only 1 client is used, select multiple clients to activate the load balancer";
} }
} }
@ -134,8 +134,8 @@ namespace xServer.Forms
connection.Client.Value.Country, connection.Client.Value.Country,
(connection.HostName.Length > 0) ? string.Format("{0} ({1})", connection.HostName, connection.TargetServer) : connection.TargetServer, (connection.HostName.Length > 0) ? string.Format("{0} ({1})", connection.HostName, connection.TargetServer) : connection.TargetServer,
connection.TargetPort.ToString(), connection.TargetPort.ToString(),
Helper.GetDataSize(connection.LengthReceived), FileHelper.GetDataSize(connection.LengthReceived),
Helper.GetDataSize(connection.LengthSent), FileHelper.GetDataSize(connection.LengthSent),
connection.Type.ToString() connection.Type.ToString()
}) { Tag = connection }; }) { Tag = connection };
} }

View File

@ -1,9 +1,9 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Networking.Utilities; using xServer.Core.Networking.Utilities;
using xServer.Core.Utilities;
using xServer.Settings; using xServer.Settings;
namespace xServer.Forms namespace xServer.Forms

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -17,7 +18,7 @@ namespace xServer.Forms
private void FrmShowMessagebox_Load(object sender, EventArgs e) private void FrmShowMessagebox_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Show Messagebox", _selectedClients); this.Text = WindowHelper.GetWindowTitle("Show Messagebox", _selectedClients);
cmbMsgButtons.Items.AddRange(new string[] cmbMsgButtons.Items.AddRange(new string[]
{"AbortRetryIgnore", "OK", "OKCancel", "RetryCancel", "YesNo", "YesNoCancel"}); {"AbortRetryIgnore", "OK", "OKCancel", "RetryCancel", "YesNo", "YesNoCancel"});
@ -37,10 +38,10 @@ namespace xServer.Forms
private void btnSend_Click(object sender, EventArgs e) private void btnSend_Click(object sender, EventArgs e)
{ {
Core.Misc.MessageBoxData.Caption = txtCaption.Text; MessageBoxData.Caption = txtCaption.Text;
Core.Misc.MessageBoxData.Text = txtText.Text; MessageBoxData.Text = txtText.Text;
Core.Misc.MessageBoxData.Button = GetMessageBoxButton(cmbMsgButtons.SelectedIndex); MessageBoxData.Button = GetMessageBoxButton(cmbMsgButtons.SelectedIndex);
Core.Misc.MessageBoxData.Icon = GetMessageBoxIcon(cmbMsgButtons.SelectedIndex); MessageBoxData.Icon = GetMessageBoxIcon(cmbMsgButtons.SelectedIndex);
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();

View File

@ -33,7 +33,7 @@
this.ctxtMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.ctxtMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ctxtAddEntry = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtAddEntry = new System.Windows.Forms.ToolStripMenuItem();
this.ctxtRemoveEntry = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtRemoveEntry = new System.Windows.Forms.ToolStripMenuItem();
this.lstStartupItems = new xServer.Controls.ListViewEx(); this.lstStartupItems = new xServer.Controls.AeroListView();
this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.ctxtMenu.SuspendLayout(); this.ctxtMenu.SuspendLayout();
@ -118,7 +118,7 @@
private System.Windows.Forms.ContextMenuStrip ctxtMenu; private System.Windows.Forms.ContextMenuStrip ctxtMenu;
private System.Windows.Forms.ToolStripMenuItem ctxtAddEntry; private System.Windows.Forms.ToolStripMenuItem ctxtAddEntry;
private System.Windows.Forms.ToolStripMenuItem ctxtRemoveEntry; private System.Windows.Forms.ToolStripMenuItem ctxtRemoveEntry;
private Controls.ListViewEx lstStartupItems; private Controls.AeroListView lstStartupItems;
} }
} }

View File

@ -2,8 +2,8 @@
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -26,7 +26,7 @@ namespace xServer.Forms
{ {
if (_connectClient != null) if (_connectClient != null)
{ {
this.Text = Helper.GetWindowTitle("Startup Manager", _connectClient); this.Text = WindowHelper.GetWindowTitle("Startup Manager", _connectClient);
AddGroups(); AddGroups();
new Core.Packets.ServerPackets.GetStartupItems().Execute(_connectClient); new Core.Packets.ServerPackets.GetStartupItems().Execute(_connectClient);
} }

View File

@ -49,11 +49,11 @@ namespace xServer.Forms
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Green), 5), new Point(220, 130), new Point(250, 130)); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Green), 5), new Point(220, 130), new Point(250, 130));
e.Graphics.DrawString( e.Graphics.DrawString(
string.Format("{0} received ({1}%)", Helper.GetDataSize(_bytesReceived), _receivedPercent), string.Format("{0} received ({1}%)", FileHelper.GetDataSize(_bytesReceived), _receivedPercent),
this.Font, new SolidBrush(Color.Black), new Point(260, 123)); this.Font, new SolidBrush(Color.Black), new Point(260, 123));
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Blue), 5), new Point(220, 160), new Point(250, 160)); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Blue), 5), new Point(220, 160), new Point(250, 160));
e.Graphics.DrawString(string.Format("{0} sent ({1}%)", Helper.GetDataSize(_bytesSent), _sentPercent), e.Graphics.DrawString(string.Format("{0} sent ({1}%)", FileHelper.GetDataSize(_bytesSent), _sentPercent),
this.Font, new SolidBrush(Color.Black), new Point(260, 153)); this.Font, new SolidBrush(Color.Black), new Point(260, 153));
} }

View File

@ -32,7 +32,7 @@ namespace xServer.Forms
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmSystemInformation)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmSystemInformation));
this.lstSystem = new xServer.Controls.ListViewEx(); this.lstSystem = new xServer.Controls.AeroListView();
this.hComponent = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hComponent = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.ctxtMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.ctxtMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
@ -107,6 +107,6 @@ namespace xServer.Forms
private System.Windows.Forms.ColumnHeader hValue; private System.Windows.Forms.ColumnHeader hValue;
private System.Windows.Forms.ContextMenuStrip ctxtMenu; private System.Windows.Forms.ContextMenuStrip ctxtMenu;
private System.Windows.Forms.ToolStripMenuItem ctxtCopy; private System.Windows.Forms.ToolStripMenuItem ctxtCopy;
private ListViewEx lstSystem; private AeroListView lstSystem;
} }
} }

View File

@ -23,7 +23,7 @@ namespace xServer.Forms
{ {
if (_connectClient != null) if (_connectClient != null)
{ {
this.Text = Helper.GetWindowTitle("System Information", _connectClient); this.Text = WindowHelper.GetWindowTitle("System Information", _connectClient);
new Core.Packets.ServerPackets.GetSystemInfo().Execute(_connectClient); new Core.Packets.ServerPackets.GetSystemInfo().Execute(_connectClient);
if (_connectClient.Value != null) if (_connectClient.Value != null)

View File

@ -37,7 +37,7 @@ namespace xServer.Forms
this.ctxtStartProcess = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtStartProcess = new System.Windows.Forms.ToolStripMenuItem();
this.ctxtLine = new System.Windows.Forms.ToolStripSeparator(); this.ctxtLine = new System.Windows.Forms.ToolStripSeparator();
this.ctxtRefresh = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtRefresh = new System.Windows.Forms.ToolStripMenuItem();
this.lstTasks = new xServer.Controls.ListViewEx(); this.lstTasks = new xServer.Controls.AeroListView();
this.hProcessname = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hProcessname = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hPID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hPID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.hTitle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.hTitle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -145,6 +145,6 @@ namespace xServer.Forms
private System.Windows.Forms.ColumnHeader hPID; private System.Windows.Forms.ColumnHeader hPID;
private System.Windows.Forms.ColumnHeader hTitle; private System.Windows.Forms.ColumnHeader hTitle;
private System.Windows.Forms.ToolStripSeparator ctxtLine; private System.Windows.Forms.ToolStripSeparator ctxtLine;
private ListViewEx lstTasks; private AeroListView lstTasks;
} }
} }

View File

@ -1,8 +1,9 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Controls;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -26,7 +27,7 @@ namespace xServer.Forms
{ {
if (_connectClient != null) if (_connectClient != null)
{ {
this.Text = Helper.GetWindowTitle("Task Manager", _connectClient); this.Text = WindowHelper.GetWindowTitle("Task Manager", _connectClient);
new Core.Packets.ServerPackets.GetProcesses().Execute(_connectClient); new Core.Packets.ServerPackets.GetProcesses().Execute(_connectClient);
} }
} }

View File

@ -17,19 +17,19 @@ namespace xServer.Forms
private void FrmUpdate_Load(object sender, EventArgs e) private void FrmUpdate_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Update Clients", _selectedClients); this.Text = WindowHelper.GetWindowTitle("Update Clients", _selectedClients);
if (Core.Misc.Update.UseDownload) if (Core.Utilities.Update.UseDownload)
radioURL.Checked = true; radioURL.Checked = true;
txtPath.Text = File.Exists(Core.Misc.Update.UploadPath) ? Core.Misc.Update.UploadPath : string.Empty; txtPath.Text = File.Exists(Core.Utilities.Update.UploadPath) ? Core.Utilities.Update.UploadPath : string.Empty;
txtURL.Text = Core.Misc.Update.DownloadURL; txtURL.Text = Core.Utilities.Update.DownloadURL;
btnUpdate.Text = "Update Client" + ((_selectedClients > 1) ? "s" : string.Empty); btnUpdate.Text = "Update Client" + ((_selectedClients > 1) ? "s" : string.Empty);
} }
private void btnUpdate_Click(object sender, EventArgs e) private void btnUpdate_Click(object sender, EventArgs e)
{ {
Core.Misc.Update.UseDownload = radioURL.Checked; Core.Utilities.Update.UseDownload = radioURL.Checked;
Core.Misc.Update.UploadPath = File.Exists(txtPath.Text) ? txtPath.Text : string.Empty; Core.Utilities.Update.UploadPath = File.Exists(txtPath.Text) ? txtPath.Text : string.Empty;
Core.Misc.Update.DownloadURL = txtURL.Text; Core.Utilities.Update.DownloadURL = txtURL.Text;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();

View File

@ -2,6 +2,7 @@
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -17,8 +18,8 @@ namespace xServer.Forms
private void FrmUploadAndExecute_Load(object sender, EventArgs e) private void FrmUploadAndExecute_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Upload & Execute", _selectedClients); this.Text = WindowHelper.GetWindowTitle("Upload & Execute", _selectedClients);
chkRunHidden.Checked = Core.Misc.UploadAndExecute.RunHidden; chkRunHidden.Checked = UploadAndExecute.RunHidden;
} }
private void btnBrowse_Click(object sender, EventArgs e) private void btnBrowse_Click(object sender, EventArgs e)
@ -36,8 +37,8 @@ namespace xServer.Forms
private void btnUploadAndExecute_Click(object sender, EventArgs e) private void btnUploadAndExecute_Click(object sender, EventArgs e)
{ {
Core.Misc.UploadAndExecute.FilePath = File.Exists(txtPath.Text) ? txtPath.Text : string.Empty; UploadAndExecute.FilePath = File.Exists(txtPath.Text) ? txtPath.Text : string.Empty;
Core.Misc.UploadAndExecute.RunHidden = chkRunHidden.Checked; UploadAndExecute.RunHidden = chkRunHidden.Checked;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -16,15 +17,15 @@ namespace xServer.Forms
private void FrmVisitWebsite_Load(object sender, EventArgs e) private void FrmVisitWebsite_Load(object sender, EventArgs e)
{ {
this.Text = Helper.GetWindowTitle("Visit Website", _selectedClients); this.Text = WindowHelper.GetWindowTitle("Visit Website", _selectedClients);
txtURL.Text = Core.Misc.VisitWebsite.URL; txtURL.Text = VisitWebsite.URL;
chkVisitHidden.Checked = Core.Misc.VisitWebsite.Hidden; chkVisitHidden.Checked = VisitWebsite.Hidden;
} }
private void btnVisitWebsite_Click(object sender, EventArgs e) private void btnVisitWebsite_Click(object sender, EventArgs e)
{ {
Core.Misc.VisitWebsite.URL = txtURL.Text; VisitWebsite.URL = txtURL.Text;
Core.Misc.VisitWebsite.Hidden = chkVisitHidden.Checked; VisitWebsite.Hidden = chkVisitHidden.Checked;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();

View File

@ -72,8 +72,15 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Core\Build\IconInjector.cs" /> <Compile Include="Core\Build\IconInjector.cs" />
<Compile Include="Core\Helper\FrameCounter.cs" /> <Compile Include="Core\Helper\FileHelper.cs" />
<Compile Include="Core\Misc\RemoteDrive.cs" /> <Compile Include="Core\Helper\FormatHelper.cs" />
<Compile Include="Core\Utilities\FrameCounter.cs" />
<Compile Include="Core\Helper\NativeMethodsHelper.cs" />
<Compile Include="Core\Helper\PlatformHelper.cs" />
<Compile Include="Core\Helper\RemoteDesktopHelper.cs" />
<Compile Include="Core\Helper\WindowHelper.cs" />
<Compile Include="Core\Utilities\NativeMethods.cs" />
<Compile Include="Core\Utilities\RemoteDrive.cs" />
<Compile Include="Core\Networking\Client.cs" /> <Compile Include="Core\Networking\Client.cs" />
<Compile Include="Core\Build\ClientBuilder.cs" /> <Compile Include="Core\Build\ClientBuilder.cs" />
<Compile Include="Core\Commands\CommandHandler.cs" /> <Compile Include="Core\Commands\CommandHandler.cs" />
@ -83,15 +90,15 @@
<Compile Include="Core\Commands\SystemHandler.cs" /> <Compile Include="Core\Commands\SystemHandler.cs" />
<Compile Include="Core\Compression\SafeQuickLZ.cs" /> <Compile Include="Core\Compression\SafeQuickLZ.cs" />
<Compile Include="Core\Encryption\AES.cs" /> <Compile Include="Core\Encryption\AES.cs" />
<Compile Include="Core\Helper\FileSplit.cs" /> <Compile Include="Core\Utilities\FileSplit.cs" />
<Compile Include="Core\Helper\UnsafeStreamCodec.cs" /> <Compile Include="Core\Utilities\UnsafeStreamCodec.cs" />
<Compile Include="Core\Networking\Utilities\UPnP.cs" /> <Compile Include="Core\Networking\Utilities\UPnP.cs" />
<Compile Include="Core\Misc\InputBox.cs" /> <Compile Include="Controls\InputBox.cs" />
<Compile Include="Core\Compression\JpgCompression.cs" /> <Compile Include="Core\Compression\JpgCompression.cs" />
<Compile Include="Core\Misc\ListViewColumnSorter.cs" /> <Compile Include="Core\Utilities\ListViewColumnSorter.cs" />
<Compile Include="Core\Extensions\ListViewExtensions.cs" /> <Compile Include="Core\Extensions\ListViewExtensions.cs" />
<Compile Include="Core\Misc\NoIpUpdater.cs" /> <Compile Include="Core\Utilities\NoIpUpdater.cs" />
<Compile Include="Core\Misc\SavedVariables.cs" /> <Compile Include="Core\Utilities\SavedVariables.cs" />
<Compile Include="Core\Networking\ConnectionHandler.cs" /> <Compile Include="Core\Networking\ConnectionHandler.cs" />
<Compile Include="Core\Networking\Utilities\PooledBufferManager.cs" /> <Compile Include="Core\Networking\Utilities\PooledBufferManager.cs" />
<Compile Include="Core\Packets\ClientPackets\GetDesktopResponse.cs" /> <Compile Include="Core\Packets\ClientPackets\GetDesktopResponse.cs" />
@ -232,8 +239,11 @@
<Compile Include="Core\ReverseProxy\ReverseProxyClient.cs" /> <Compile Include="Core\ReverseProxy\ReverseProxyClient.cs" />
<Compile Include="Core\ReverseProxy\ReverseProxyServer.cs" /> <Compile Include="Core\ReverseProxy\ReverseProxyServer.cs" />
<Compile Include="Core\Networking\Server.cs" /> <Compile Include="Core\Networking\Server.cs" />
<Compile Include="Core\Helper\Helper.cs" />
<Compile Include="Core\Networking\UserState.cs" /> <Compile Include="Core\Networking\UserState.cs" />
<Compile Include="Enums\PathType.cs" />
<Compile Include="Enums\RemoteDesktopAction.cs" />
<Compile Include="Enums\ShutdownAction.cs" />
<Compile Include="Enums\UserStatus.cs" />
<Compile Include="Forms\FrmAbout.cs"> <Compile Include="Forms\FrmAbout.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>