Completed Implementing ground work for OrbisLib.
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OrbisSuite.Common
|
||||
{
|
||||
public static class API
|
||||
{
|
||||
/// <summary>
|
||||
/// Connects to the API.
|
||||
/// </summary>
|
||||
/// <param name="IPAddr">Address we would like to connnect to.</param>
|
||||
/// <param name="Sock">The socket we have connected on.</param>
|
||||
/// <returns>Returns true if we successfully connected.</returns>
|
||||
public static bool Connect(string IPAddr, int Port, out Socket Sock)
|
||||
{
|
||||
Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
try
|
||||
{
|
||||
return Sock.EasyConnect(IPAddr, Port, 2000);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Short API Call used when you only need to send the initial packet and no additional data.
|
||||
/// </summary>
|
||||
/// <param name="IPAddr">Address to send to.</param>
|
||||
/// <param name="Packet">The initial Packet Data.</param>
|
||||
/// <returns>Returns the result of the action.</returns>
|
||||
public static APIResults Call(string IPAddr, int Port, APIPacket Packet)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Connect(IPAddr, Port, out Socket Sock))
|
||||
{
|
||||
// Send Inital Packet.
|
||||
Sock.Send(Helpers.StructtoBytes(Packet));
|
||||
|
||||
// Get API Response.
|
||||
var Result = (APIResults)Sock.RecvInt32();
|
||||
|
||||
// Clean up.
|
||||
Sock.Close();
|
||||
|
||||
return Result;
|
||||
}
|
||||
else
|
||||
return APIResults.API_ERROR_COULDNT_CONNECT;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return APIResults.API_ERROR_GENERAL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Long API Call used for when we need to send more than just the initial packet.
|
||||
/// </summary>
|
||||
/// <param name="IPAddr">Address to send to.</param>
|
||||
/// <param name="Packet">The initial Packet Data.</param>
|
||||
/// <param name="Sock">The soucket out used for sending more data.</param>
|
||||
/// <returns>Returns the result of the action.</returns>
|
||||
public static APIResults CallLong(string IPAddr, int Port, APIPacket Packet, out Socket Sock)
|
||||
{
|
||||
Sock = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (Connect(IPAddr, Port, out Sock))
|
||||
{
|
||||
// Send Inital Packet.
|
||||
Sock.Send(Helpers.StructtoBytes(Packet));
|
||||
|
||||
// Get API Response.
|
||||
return (APIResults)Sock.RecvInt32();
|
||||
}
|
||||
else
|
||||
return APIResults.API_ERROR_COULDNT_CONNECT;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return APIResults.API_ERROR_GENERAL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends additional data if required.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The packet type.</typeparam>
|
||||
/// <param name="Sock">The socket instance were using.</param>
|
||||
/// <param name="Packet">Any Packet structure.</param>
|
||||
/// <returns>Returns the result of the action.</returns>
|
||||
public static APIResults SendNextPacket<T>(Socket Sock, T Packet)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Send Next Packet.
|
||||
Sock.Send(Helpers.StructtoBytes(Packet));
|
||||
|
||||
// Get API Response.
|
||||
return (APIResults)Sock.RecvInt32();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return APIResults.API_ERROR_GENERAL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Sock"></param>
|
||||
/// <param name="Value"></param>
|
||||
/// <returns></returns>
|
||||
public static APIResults SendInt32(Socket Sock, int Value)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Send Next Packet.
|
||||
Sock.Send(BitConverter.GetBytes(Value));
|
||||
|
||||
// Get API Response.
|
||||
return (APIResults)Sock.RecvInt32();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return APIResults.API_ERROR_GENERAL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Completes the call and gets our final result.
|
||||
/// </summary>
|
||||
/// <param name="Sock">The socket used to communicate witht the API.</param>
|
||||
/// <returns>Returns the result of the action.</returns>
|
||||
public static APIResults CompleteCall(Socket Sock)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Results = (APIResults)Sock.RecvInt32();
|
||||
|
||||
Sock.Close();
|
||||
|
||||
return Results;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return APIResults.API_ERROR_GENERAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrbisSuite.Common
|
||||
{
|
||||
public enum APICommands : int
|
||||
{
|
||||
APITest = 1,
|
||||
|
||||
/* ####### Proc functions ####### */
|
||||
PROC_START,
|
||||
API_PROC_GET_LIST,
|
||||
API_PROC_ATTACH,
|
||||
API_PROC_DETACH,
|
||||
API_PROC_GET_CURRENT,
|
||||
API_PROC_READ,
|
||||
API_PROC_WRITE,
|
||||
API_PROC_KILL,
|
||||
API_PROC_LOAD_ELF,
|
||||
API_PROC_CALL,
|
||||
|
||||
/* Remote Library functions */
|
||||
API_PROC_LOAD_SPRX,
|
||||
API_PROC_UNLOAD_SPRX,
|
||||
API_PROC_UNLOAD_SPRX_NAME,
|
||||
API_PROC_RELOAD_SPRX_NAME,
|
||||
API_PROC_RELOAD_SPRX_HANDLE,
|
||||
API_PROC_DUMP_MODULE,
|
||||
API_PROC_MODULE_LIST,
|
||||
PROC_END,
|
||||
/* ############################## */
|
||||
|
||||
/* ##### Debugger functions ##### */
|
||||
DBG_START,
|
||||
API_DBG_START, /* Debugger attach to target */
|
||||
API_DBG_STOP, /* Debugger detach from target */
|
||||
API_DBG_BREAK,
|
||||
API_DBG_RESUME,
|
||||
API_DBG_SIGNAL,
|
||||
API_DBG_STEP,
|
||||
API_DBG_STEP_OVER,
|
||||
API_DBG_STEP_OUT,
|
||||
API_DBG_GET_CALLSTACK,
|
||||
API_DBG_GET_REG,
|
||||
API_DBG_SET_REG,
|
||||
API_DBG_GET_FREG,
|
||||
API_DBG_SET_FREG,
|
||||
API_DBG_GET_DBGREG,
|
||||
API_DBG_SET_DBGREG,
|
||||
|
||||
/* Thread Management */
|
||||
API_DBG_THREAD_LIST,
|
||||
API_DBG_THREAD_STOP,
|
||||
API_DBG_THREAD_RESUME,
|
||||
|
||||
/* Breakpoint functions */
|
||||
API_DBG_BREAKPOINT_GETFREE,
|
||||
API_DBG_BREAKPOINT_SET,
|
||||
API_DBG_BREAKPOINT_UPDATE,
|
||||
API_DBG_BREAKPOINT_REMOVE,
|
||||
API_DBG_BREAKPOINT_GETINFO,
|
||||
API_DBG_BREAKPOINT_LIST,
|
||||
|
||||
/* Watchpoint functions */
|
||||
API_DBG_WATCHPOINT_SET,
|
||||
API_DBG_WATCHPOINT_UPDATE,
|
||||
API_DBG_WATCHPOINT_REMOVE,
|
||||
API_DBG_WATCHPOINT_GETINFO,
|
||||
API_DBG_WATCHPOINT_LIST,
|
||||
DBG_END,
|
||||
/* ############################## */
|
||||
|
||||
/* ###### Kernel functions ###### */
|
||||
KERN_START,
|
||||
API_KERN_BASE,
|
||||
API_KERN_READ,
|
||||
API_KERN_WRITE,
|
||||
KERN_END,
|
||||
/* ############################## */
|
||||
|
||||
/* ###### Target functions ###### */
|
||||
TARGET_START,
|
||||
API_TARGET_INFO,
|
||||
API_TARGET_RESTMODE,
|
||||
API_TARGET_SHUTDOWN,
|
||||
API_TARGET_REBOOT,
|
||||
API_TARGET_NOTIFY,
|
||||
API_TARGET_BUZZER,
|
||||
API_TARGET_SET_LED,
|
||||
API_TARGET_DUMP_PROC,
|
||||
//API_TARGET_LOAD_VSH_MODULE
|
||||
TARGET_END,
|
||||
/* ############################## */
|
||||
}
|
||||
|
||||
public enum APIResults : int
|
||||
{
|
||||
API_OK = 1,
|
||||
|
||||
API_ERROR_COULDNT_CONNECT,
|
||||
API_ERROR_NOT_CONNECTED,
|
||||
API_ERROR_NOT_ATTACHED,
|
||||
API_ERROR_LOST_PROC,
|
||||
API_ERROR_GENERAL,
|
||||
API_ERROR_INVALID_ADDRESS,
|
||||
|
||||
//Debugger
|
||||
API_ERROR_PROC_RUNNING,
|
||||
API_ERROR_DEBUG_TO_ATTACHED,
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi, Size = 40), Serializable]
|
||||
public struct APIPacket
|
||||
{
|
||||
public int PacketVersion;
|
||||
public APICommands Command;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string ProcName;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Ansi)]
|
||||
public struct ProcPacket
|
||||
{
|
||||
public int ProcessID;
|
||||
public int Attached;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string ProcName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
|
||||
public string TitleID;
|
||||
public UInt64 TextSegmentBase;
|
||||
public UInt64 TextSegmentLen;
|
||||
public UInt64 DataSegmentBase;
|
||||
public UInt64 DataSegmentLen;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct ModuleListPacket
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)]
|
||||
public string Name;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Path;
|
||||
public int Handle;
|
||||
public UInt64 TextSegmentBase;
|
||||
public UInt64 TextSegmentLen;
|
||||
public UInt64 DataSegmentBase;
|
||||
public UInt64 DataSegmentLen;
|
||||
}
|
||||
|
||||
public enum ConsoleTypes
|
||||
{
|
||||
UNK,
|
||||
DIAG, //0x80
|
||||
DEVKIT, //0x81
|
||||
TESTKIT, //0x82
|
||||
RETAIL, //0x83 -> 0x8F
|
||||
KRATOS, //0xA0 IMPOSSIBLE??
|
||||
};
|
||||
|
||||
public enum ConsoleLEDColours
|
||||
{
|
||||
white,
|
||||
white_Blinking,
|
||||
Blue_Blinking,
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi, Size = 260), Serializable]
|
||||
public struct TargetInfoPacket
|
||||
{
|
||||
public int SDKVersion;
|
||||
public int SoftwareVersion;
|
||||
public int FactorySoftwareVersion;
|
||||
public int CPUTemp;
|
||||
public int SOCTemp;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
|
||||
public string CurrentTitleID;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
|
||||
public string ConsoleName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
|
||||
public string MotherboardSerial;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
|
||||
public string Serial;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
|
||||
public string Model;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[] MACAddressLAN;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[] MACAddressWIFI;
|
||||
public int UART;
|
||||
public int IDUMode;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] IDPS;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] PSID;
|
||||
public int ConsoleType;
|
||||
public int Attached;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string CurrentProc;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct ProcRWPacket
|
||||
{
|
||||
public UInt64 Address;
|
||||
public UInt64 Length;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct ProcSPRXPacket
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Name;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Path;
|
||||
public int ModuleHandle;
|
||||
public int Flags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct ProcBreakpointPacket
|
||||
{
|
||||
public int Index;
|
||||
public UInt64 Address;
|
||||
public int Enable;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct TargetNotifyPacket
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
||||
public string IconURI;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
||||
public string Message;
|
||||
}
|
||||
|
||||
public enum BuzzerType
|
||||
{
|
||||
RingOnce = 1,
|
||||
RingThree,
|
||||
LongRing,
|
||||
ThreeLongRing,
|
||||
ThreeLongDoubleBeeps,
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Data.SQLite;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OrbisSuite.Common.DataBase
|
||||
{
|
||||
@@ -444,22 +446,20 @@ namespace OrbisSuite.Common.DataBase
|
||||
Target.SDKVersion = $"{((Packet.SDKVersion >> 24) & 0xFF).ToString("X1")}.{((Packet.SDKVersion >> 12) & 0xFFF).ToString("X3")}.{(Packet.SDKVersion & 0xFFF).ToString("X3")}";
|
||||
Target.SoftwareVersion = $"{((Packet.SoftwareVersion >> 24) & 0xFF).ToString("X1")}.{((Packet.SoftwareVersion >> 16) & 0xFF).ToString("X2")}";
|
||||
Target.FactorySoftwareVersion = $"{((Packet.FactorySoftwareVersion >> 24) & 0xFF).ToString("X1")}.{((Packet.FactorySoftwareVersion >> 12) & 0xFFF).ToString("X3")}.{(Packet.FactorySoftwareVersion & 0xFFF).ToString("X3")}";
|
||||
Target.CPUTemp = Packet.CPUTemp;
|
||||
Target.SOCTemp = Packet.SOCTemp;
|
||||
// CurrentTitleID
|
||||
Target.CurrentTitleID = Packet.CurrentTitleID; // TODO: Implement this on console
|
||||
Target.ConsoleName = Packet.ConsoleName;
|
||||
Target.MotherboardSerial = Packet.MotherboardSerial;
|
||||
Target.Serial = Packet.Serial;
|
||||
Target.Model = Packet.Model;
|
||||
Target.MACAddressLAN = BitConverter.ToString(Packet.MACAddressLAN).Replace("-", ":");
|
||||
// MACAddressWIFI
|
||||
Target.MACAddressWIFI = "-"; // TODO: Find this on the console. BitConverter.ToString(Packet.MACAddressWIFI).Replace("-", ":");
|
||||
Target.UART = Packet.UART > 0;
|
||||
Target.IDUMode = Packet.IDUMode > 0;
|
||||
Target.IDPS = BitConverter.ToString(Packet.IDPS).Replace("-", string.Empty);
|
||||
Target.PSID = BitConverter.ToString(Packet.PSID).Replace("-", string.Empty);
|
||||
Target.ConsoleType = ConsoleTypeNames[Packet.ConsoleType];
|
||||
Target.Attached = Packet.Attached > 0;
|
||||
Target.CurrentProc = Packet.CurrentProc;
|
||||
Target.CurrentProcessId = 0;// TODO: Update this to process Id Packet.CurrentProc;
|
||||
|
||||
// Write to Database.
|
||||
using (var connection = new SQLiteConnection($"Data Source={Config.DataBasePath}"))
|
||||
@@ -471,8 +471,6 @@ namespace OrbisSuite.Common.DataBase
|
||||
SDKVersion=@SDKVersion,
|
||||
SoftwareVersion=@SoftwareVersion,
|
||||
FactorySoftwareVersion=@FactorySoftwareVersion,
|
||||
CPUTemp=@CPUTemp,
|
||||
SOCTemp=@SOCTemp,
|
||||
CurrentTitleID=@CurrentTitleID,
|
||||
ConsoleName=@ConsoleName,
|
||||
MotherboardSerial=@MotherboardSerial,
|
||||
@@ -486,15 +484,16 @@ namespace OrbisSuite.Common.DataBase
|
||||
PSID=@PSID,
|
||||
ConsoleType=@ConsoleType,
|
||||
Attached=@Attached,
|
||||
CurrentProc=@CurrentProc
|
||||
CurrentProcessId=@CurrentProcessId,
|
||||
HDDUsedSpace=@HDDUsedSpace,
|
||||
HDDFreeSpace=@HDDFreeSpace,
|
||||
HDDTotalSpace=@HDDTotalSpace
|
||||
WHERE TargetName=@Target";
|
||||
command.Parameters.AddWithValue("@Target", TargetName);
|
||||
|
||||
command.Parameters.AddWithValue("@SDKVersion", Target.SDKVersion);
|
||||
command.Parameters.AddWithValue("@SoftwareVersion", Target.SoftwareVersion);
|
||||
command.Parameters.AddWithValue("@FactorySoftwareVersion", Target.FactorySoftwareVersion);
|
||||
command.Parameters.AddWithValue("@CPUTemp", Target.CPUTemp);
|
||||
command.Parameters.AddWithValue("@SOCTemp", Target.SOCTemp);
|
||||
command.Parameters.AddWithValue("@CurrentTitleID", Target.CurrentTitleID);
|
||||
command.Parameters.AddWithValue("@ConsoleName", Target.ConsoleName);
|
||||
command.Parameters.AddWithValue("@MotherboardSerial", Target.MotherboardSerial);
|
||||
@@ -508,7 +507,11 @@ namespace OrbisSuite.Common.DataBase
|
||||
command.Parameters.AddWithValue("@PSID", Target.PSID);
|
||||
command.Parameters.AddWithValue("@ConsoleType", Target.ConsoleType);
|
||||
command.Parameters.AddWithValue("@Attached", Target.Attached);
|
||||
command.Parameters.AddWithValue("@CurrentProc", Target.CurrentProc);
|
||||
command.Parameters.AddWithValue("@CurrentProcessId", Target.CurrentProcessId);
|
||||
command.Parameters.AddWithValue("@HDDUsedSpace", Target.HDDUsedSpace);
|
||||
command.Parameters.AddWithValue("@HDDFreeSpace", Target.HDDFreeSpace);
|
||||
command.Parameters.AddWithValue("@HDDTotalSpace", Target.HDDTotalSpace);
|
||||
// TODO: Possibly have CPU stats here SOC/CPU Temp, RAM, VRAM, ThreadCount, CPUAverageUsage & CPUUsage[8].
|
||||
|
||||
return (command.ExecuteNonQuery() > 0);
|
||||
}
|
||||
|
||||
@@ -8,5 +8,208 @@ namespace OrbisSuite.Common.DataBase
|
||||
{
|
||||
internal class Settings
|
||||
{
|
||||
#region General
|
||||
|
||||
/// <summary>
|
||||
/// The API port that OrbisLib communicates on.
|
||||
/// </summary>
|
||||
public int APIPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("APIPort");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("APIPort", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The port that will be used to access the targets file system using ftp
|
||||
/// </summary>
|
||||
public int FTPPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("FTPPort");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("FTPPort", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The port of a klog server that will be used to print console output similar to UART.
|
||||
/// </summary>
|
||||
public int KlogPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("KlogPort");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("KlogPort", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The serial COM port we will listen to for UART output.
|
||||
/// </summary>
|
||||
public string COMPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<string>("COMPort");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("COMPort", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the Orbis Suite taskbar app when windows boots.
|
||||
/// </summary>
|
||||
public bool StartOnBoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<bool>("StartOnBoot");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("StartOnBoot", value);
|
||||
|
||||
//Get windows registry key to set app on start up.
|
||||
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||
|
||||
//add or remove the value.
|
||||
if (value)
|
||||
key.SetValue("OrbisTaskbarApp", AppDomain.CurrentDomain.BaseDirectory + "OrbisTaskbarApp.exe");
|
||||
else
|
||||
key.DeleteValue("OrbisTaskbarApp", false);
|
||||
|
||||
//Close the key after use.
|
||||
key?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Themes
|
||||
|
||||
/// <summary>
|
||||
/// Choose which theme will be used across Orbis Suite.
|
||||
/// </summary>
|
||||
public int Theme
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("Theme");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("Theme", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the accent colours to cycle through all colours of the rainbow.
|
||||
/// </summary>
|
||||
public bool RainbowColours
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("RainbowColours");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("RainbowColours", value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TargetInfo
|
||||
|
||||
/// <summary>
|
||||
/// When viewd from the target details choose to censor the Target identifier.
|
||||
/// </summary>
|
||||
public bool CensorIDPS
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("CensorIDPS");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("CensorIDPS", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When viewd from the target details choose to censor the Target identifier.
|
||||
/// </summary>
|
||||
public bool CensorPSID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("CensorPSID");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("CensorPSID", value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConsoleOutput
|
||||
|
||||
/// <summary>
|
||||
/// SHow timestamps on the console output.
|
||||
/// </summary>
|
||||
public bool ShowTimestamps
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("ShowTimestamps");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("ShowTimestamps", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Word wrap the console output window.
|
||||
/// </summary>
|
||||
public bool WordWrap
|
||||
{
|
||||
get
|
||||
{
|
||||
return Database.GetSetting<int>("WordWrap");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Database.SetSetting("WordWrap", value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
|
||||
namespace OrbisSuite.Common.Helpers
|
||||
namespace OrbisSuite.Common
|
||||
{
|
||||
public static class Helpers
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Net.Sockets;
|
||||
|
||||
|
||||
namespace OrbisSuite.Common.Helpers
|
||||
namespace OrbisSuite.Common
|
||||
{
|
||||
public class Listener
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Classes\" />
|
||||
<Folder Include="Common\API\" />
|
||||
<Folder Include="Dialog\" />
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user