Seperated class files so they are easier to access.

This commit is contained in:
Bitl 2020-07-07 11:19:40 -07:00
parent c1eb1c123e
commit 52206710c4
45 changed files with 3429 additions and 3321 deletions

View File

@ -22,12 +22,12 @@ namespace NovetusCMD
{
try
{
UPnP.InitUPnP(DeviceFound,DeviceLost);
NetFuncs.InitUPnP(DeviceFound,DeviceLost);
ConsolePrint("UPnP: Service initialized", 3);
}
catch (Exception ex)
{
ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2);
}
}
}
@ -38,7 +38,7 @@ namespace NovetusCMD
{
try
{
UPnP.StartUPnP(device,protocol,port);
NetFuncs.StartUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -54,7 +54,7 @@ namespace NovetusCMD
{
try
{
UPnP.StopUPnP(device,protocol,port);
NetFuncs.StopUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -104,7 +104,7 @@ namespace NovetusCMD
{
try
{
GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort);
GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort);
ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3);
}
catch (Exception ex)
@ -140,7 +140,7 @@ namespace NovetusCMD
static void WriteConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
ConsolePrint("Config Saved.", 3);
}
@ -163,14 +163,14 @@ namespace NovetusCMD
static void ReadConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
ConsolePrint("Config loaded.", 3);
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
static void ReadClientValues(string ClientName)
{
string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
@ -192,11 +192,11 @@ namespace NovetusCMD
public static void Main(string[] args)
{
LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName, true);
LauncherFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalVars.InfoName, true);
Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";
ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);
ConsolePrint("Novetus path: " + Directories.BasePath, 1);
ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1);
if (args.Length == 0)
{
@ -212,7 +212,7 @@ namespace NovetusCMD
ConsolePrint("---------", 1);
ConsolePrint("Custom server options", 3);
ConsolePrint("-overrideconfig must be added in order for the below commands to function.", 5);
ConsolePrint("-upnp | Turns on UPnP.", 4);
ConsolePrint("-upnp | Turns on NetFuncs.", 4);
ConsolePrint("-map <map filename> | Sets the map.", 4);
ConsolePrint("-client <client name> | Sets the client.", 4);
ConsolePrint("-port <port number> | Sets the server port.", 4);
@ -302,7 +302,7 @@ namespace NovetusCMD
{
ConsolePrint("NovetusCMD is now loading all server configurations from the INI file.", 5);
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName))
{
ConsolePrint("WARNING 2 - " + GlobalVars.ConfigName + " not found. Creating one with default values.", 5);
WriteConfigValues();
@ -346,17 +346,17 @@ namespace NovetusCMD
}
else
{
luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
}
string mapfile = GlobalVars.UserConfiguration.MapPath;
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode == true)
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
}
else
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe";
}
string quote = "\"";
string args = "";
@ -364,11 +364,11 @@ namespace NovetusCMD
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Server);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server);
args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote;
}
}
@ -376,11 +376,11 @@ namespace NovetusCMD
{
if (!no3d)
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
}
}
try
@ -448,8 +448,8 @@ namespace NovetusCMD
GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : ""
);
File.WriteAllText(Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text));
ConsolePrint("Server Information sent to file " + Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, 4);
File.WriteAllText(GlobalPaths.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text));
ConsolePrint("Server Information sent to file " + GlobalPaths.BasePath + "\\" + LocalVars.ServerInfoFileName, 4);
}
}

View File

@ -0,0 +1,51 @@
#region Usings
using System;
using System.Security.Cryptography;
#endregion
#region CryptoRandom
public class CryptoRandom : RandomNumberGenerator
{
private static RandomNumberGenerator r;
public CryptoRandom()
{
r = Create();
}
///<param name=”buffer”>An array of bytes to contain random numbers.</param>
public override void GetBytes(byte[] buffer)
{
r.GetBytes(buffer);
}
public override void GetNonZeroBytes(byte[] data)
{
r.GetNonZeroBytes(data);
}
public double NextDouble()
{
byte[] b = new byte[4];
r.GetBytes(b);
return (double)BitConverter.ToUInt32(b, 0) / UInt32.MaxValue;
}
///<param name=”minValue”>The inclusive lower bound of the random number returned.</param>
///<param name=”maxValue”>The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.</param>
public int Next(int minValue, int maxValue)
{
return (int)Math.Round(NextDouble() * (maxValue - minValue - 1)) + minValue;
}
public int Next()
{
return Next(0, int.MaxValue);
}
///<param name=”maxValue”>The inclusive upper bound of the random number returned. maxValue must be greater than or equal 0</param>
public int Next(int maxValue)
{
return Next(0, maxValue);
}
}
#endregion

View File

@ -0,0 +1,169 @@
#region File Formats
public class FileFormat
{
#region Client Information
public class ClientInfo
{
public ClientInfo()
{
UsesPlayerName = false;
UsesID = true;
Description = "";
Warning = "";
LegacyMode = false;
ClientMD5 = "";
ScriptMD5 = "";
Fix2007 = false;
AlreadyHasSecurity = false;
NoGraphicsOptions = false;
CommandLineArgs = "";
}
public bool UsesPlayerName { get; set; }
public bool UsesID { get; set; }
public string Description { get; set; }
public string Warning { get; set; }
public bool LegacyMode { get; set; }
public string ClientMD5 { get; set; }
public string ScriptMD5 { get; set; }
public bool Fix2007 { get; set; }
public bool AlreadyHasSecurity { get; set; }
public bool NoGraphicsOptions { get; set; }
public string CommandLineArgs { get; set; }
}
#endregion
#region Configuration
public class Config
{
public Config()
{
SelectedClient = "";
Map = "";
CloseOnLaunch = false;
UserID = 0;
PlayerName = "Player";
PlayerTripcode = "";
RobloxPort = 53640;
PlayerLimit = 12;
UPnP = false;
DisabledItemMakerHelp = false;
DiscordPresence = true;
MapPath = "";
MapPathSnip = "";
GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL;
ReShade = false;
QualityLevel = Settings.QualityOptions.Level.Ultra;
LauncherLayout = Settings.UIOptions.Style.Extended;
ReShadeFPSDisplay = false;
ReShadePerformanceMode = false;
AssetLocalizerSaveBackups = true;
}
public string SelectedClient { get; set; }
public string Map { get; set; }
public bool CloseOnLaunch { get; set; }
public int UserID { get; set; }
public string PlayerName { get; set; }
public string PlayerTripcode { get; set; }
public int RobloxPort { get; set; }
public int PlayerLimit { get; set; }
public bool UPnP { get; set; }
public bool DisabledItemMakerHelp { get; set; }
public bool DiscordPresence { get; set; }
public string MapPath { get; set; }
public string MapPathSnip { get; set; }
public Settings.GraphicsOptions.Mode GraphicsMode { get; set; }
public bool ReShade { get; set; }
public Settings.QualityOptions.Level QualityLevel { get; set; }
public Settings.UIOptions.Style LauncherLayout { get; set; }
public bool ReShadeFPSDisplay { get; set; }
public bool ReShadePerformanceMode { get; set; }
public bool AssetLocalizerSaveBackups { get; set; }
}
#endregion
#region Customization Configuration
public class CustomizationConfig
{
public CustomizationConfig()
{
Hat1 = "NoHat.rbxm";
Hat2 = "NoHat.rbxm";
Hat3 = "NoHat.rbxm";
Face = "DefaultFace.rbxm";
Head = "DefaultHead.rbxm";
TShirt = "NoTShirt.rbxm";
Shirt = "NoShirt.rbxm";
Pants = "NoPants.rbxm";
Icon = "NBC";
Extra = "NoExtra.rbxm";
HeadColorID = 24;
TorsoColorID = 23;
LeftArmColorID = 24;
RightArmColorID = 24;
LeftLegColorID = 119;
RightLegColorID = 119;
HeadColorString = "Color [A=255, R=245, G=205, B=47]";
TorsoColorString = "Color [A=255, R=13, G=105, B=172]";
LeftArmColorString = "Color [A=255, R=245, G=205, B=47]";
RightArmColorString = "Color [A=255, R=245, G=205, B=47]";
LeftLegColorString = "Color [A=255, R=164, G=189, B=71]";
RightLegColorString = "Color [A=255, R=164, G=189, B=71]";
ExtraSelectionIsHat = false;
ShowHatsInExtra = false;
CharacterID = "";
}
public string Hat1 { get; set; }
public string Hat2 { get; set; }
public string Hat3 { get; set; }
public string Face { get; set; }
public string Head { get; set; }
public string TShirt { get; set; }
public string Shirt { get; set; }
public string Pants { get; set; }
public string Icon { get; set; }
public string Extra { get; set; }
public int HeadColorID { get; set; }
public int TorsoColorID { get; set; }
public int LeftArmColorID { get; set; }
public int RightArmColorID { get; set; }
public int LeftLegColorID { get; set; }
public int RightLegColorID { get; set; }
public string HeadColorString { get; set; }
public string TorsoColorString { get; set; }
public string LeftArmColorString { get; set; }
public string RightArmColorString { get; set; }
public string LeftLegColorString { get; set; }
public string RightLegColorString { get; set; }
public bool ExtraSelectionIsHat { get; set; }
public bool ShowHatsInExtra { get; set; }
public string CharacterID { get; set; }
}
#endregion
#region Program Information
public class ProgramInfo
{
public ProgramInfo()
{
Version = "";
Branch = "";
DefaultClient = "";
RegisterClient1 = "";
RegisterClient2 = "";
DefaultMap = "";
}
public string Version { get; set; }
public string Branch { get; set; }
public string DefaultClient { get; set; }
public string RegisterClient1 { get; set; }
public string RegisterClient2 { get; set; }
public string DefaultMap { get; set; }
}
#endregion
}
#endregion

View File

@ -0,0 +1,100 @@
#region Usings
using System.IO;
using System.Reflection;
#endregion
#region Global Paths
public class GlobalPaths
{
public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\");
public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString();
public static readonly string BasePath = RootPath.Replace(@"\", @"\\");
public static readonly string DataPath = BasePath + @"\\shareddata";
public static readonly string ServerDir = DataPath + "\\server";
public static readonly string ConfigDir = BasePath + @"\\config";
public static readonly string ConfigDirData = BasePathLauncher + @"\\data";
public static readonly string ClientDir = BasePath + @"\\clients";
public static readonly string MapsDir = BasePath + @"\\maps";
public static readonly string MapsDirBase = "maps";
public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
public static readonly string DirFonts = "\\fonts";
public static readonly string DirSounds = "\\sounds";
public static readonly string DirTextures = "\\textures";
public static readonly string DirScripts = "\\scripts";
public static readonly string FontsGameDir = "fonts/";
public static readonly string SoundsGameDir = "sounds/";
public static readonly string TexturesGameDir = "textures/";
public static readonly string ScriptsGameDir = "scripts/";
//customization
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
public static readonly string hatdir = CustomPlayerDir + "\\hats";
public static readonly string facedir = CustomPlayerDir + "\\faces";
public static readonly string headdir = CustomPlayerDir + "\\heads";
public static readonly string tshirtdir = CustomPlayerDir + "\\tshirts";
public static readonly string shirtdir = CustomPlayerDir + "\\shirts";
public static readonly string pantsdir = CustomPlayerDir + "\\pants";
public static readonly string extradir = CustomPlayerDir + "\\custom";
public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/";
public static readonly string hatGameDir = CharCustomGameDir + "hats/";
public static readonly string faceGameDir = CharCustomGameDir + "faces/";
public static readonly string headGameDir = CharCustomGameDir + "heads/";
public static readonly string tshirtGameDir = CharCustomGameDir + "tshirts/";
public static readonly string shirtGameDir = CharCustomGameDir + "shirts/";
public static readonly string pantsGameDir = CharCustomGameDir + "pants/";
public static readonly string extraGameDir = CharCustomGameDir + "custom/";
//item asset dirs
public static readonly string hatdirFonts = hatdir + DirFonts;
public static readonly string hatdirTextures = hatdir + DirTextures;
public static readonly string hatdirSounds = hatdir + DirSounds;
public static readonly string hatdirScripts = hatdir + DirScripts;
public static readonly string facedirTextures = facedir + DirTextures;
public static readonly string headdirFonts = headdir + DirFonts;
public static readonly string headdirTextures = headdir + DirTextures;
public static readonly string tshirtdirTextures = tshirtdir + DirTextures;
public static readonly string shirtdirTextures = shirtdir + DirTextures;
public static readonly string pantsdirTextures = pantsdir + DirTextures;
public static readonly string extradirIcons = extradir + "\\icons";
public static readonly string hatGameDirFonts = hatGameDir + FontsGameDir;
public static readonly string hatGameDirTextures = hatGameDir + TexturesGameDir;
public static readonly string hatGameDirSounds = hatGameDir + SoundsGameDir;
public static readonly string hatGameDirScripts = hatGameDir + ScriptsGameDir;
public static readonly string faceGameDirTextures = faceGameDir + TexturesGameDir;
public static readonly string headGameDirFonts = headGameDir + FontsGameDir;
public static readonly string headGameDirTextures = headGameDir + TexturesGameDir;
public static readonly string tshirtGameDirTextures = tshirtGameDir + TexturesGameDir;
public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir;
public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir;
//asset cache
public static readonly string AssetCacheDir = DataPath + "\\assetcache";
public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky";
public static readonly string AssetCacheDirFonts = AssetCacheDir + DirFonts;
public static readonly string AssetCacheDirSounds = AssetCacheDir + DirSounds;
public static readonly string AssetCacheDirTextures = AssetCacheDir + DirTextures;
public static readonly string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui";
public static readonly string AssetCacheDirScripts = AssetCacheDir + DirScripts;
public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir;
public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/";
public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + SoundsGameDir;
public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir;
public static readonly string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/";
public static readonly string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir;
//webserver
public static string WebServer_CustomPlayerDir = GlobalVars.WebServerURI + "/charcustom/";
public static string WebServer_HatDir = WebServer_CustomPlayerDir + "hats/";
public static string WebServer_FaceDir = WebServer_CustomPlayerDir + "faces/";
public static string WebServer_HeadDir = WebServer_CustomPlayerDir + "heads/";
public static string WebServer_TShirtDir = WebServer_CustomPlayerDir + "tshirts/";
public static string WebServer_ShirtDir = WebServer_CustomPlayerDir + "shirts/";
public static string WebServer_PantsDir = WebServer_CustomPlayerDir + "pants/";
public static string WebServer_ExtraDir = WebServer_CustomPlayerDir + "custom/";
}
#endregion

View File

@ -0,0 +1,78 @@
#region Usings
using System;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
#endregion
/*
* change field names for all forms
* Rewrite client launching into one function.
* add regions to ALL classes.
* maybe make enums print out the names in inis instead of the int value?
*/
#region Global Variables
public static class GlobalVars
{
public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo();
public static FileFormat.Config UserConfiguration = new FileFormat.Config();
public static string IP = "localhost";
public static string SharedArgs = "";
public static readonly string ScriptName = "CSMPFunctions";
public static readonly string ScriptGenName = "CSMPBoot";
public static SimpleHTTPServer WebServer = null;
public static bool IsWebServerOn = false;
public static bool IsSnapshot = false;
//misc vars
public static string FullMapPath = "";
//weebserver
public static int WebServerPort = 40735;
public static string LocalWebServerURI = "http://localhost:" + (WebServerPort).ToString();
public static string WebServerURI = "http://" + IP + ":" + (WebServerPort).ToString();
//config name
public static readonly string ConfigName = "config.ini";
public static string ConfigNameCustomization = "config_customization.ini";
public static readonly string InfoName = "info.ini";
//client shit
public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo();
public static string AddonScriptPath = "";
//charcustom
public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig();
public static string loadtext = "";
public static string sololoadtext = "";
//color menu.
public static bool AdminMode = false;
public static string important = "";
//discord
public static IDiscordRPC.RichPresence presence;
public static string appid = "505955125727330324";
public static string imagekey_large = "novetus_large";
public static string image_ingame = "ingame_small";
public static string image_inlauncher = "inlauncher_small";
public static string image_instudio = "instudio_small";
public static string image_incustomization = "incustomization_small";
public static string MultiLine(params string[] args)
{
return string.Join(Environment.NewLine, args);
}
public static string RemoveEmptyLines(string lines)
{
return Regex.Replace(lines, @"^\s*$\n|\r", string.Empty, RegexOptions.Multiline).TrimEnd();
}
public static bool ProcessExists(int id)
{
return Process.GetProcesses().Any(x => x.Id == id);
}
//task.delay is only available on net 4.5.......
public static async void Delay(int miliseconds)
{
await TaskEx.Delay(miliseconds);
}
}
#endregion

View File

@ -0,0 +1,96 @@
#region Usings
using System.Runtime.InteropServices;
#endregion
#region Discord RPC
//code by discord obv. just renamed it to fit better.
public class IDiscordRPC
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ReadyCallback();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DisconnectedCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ErrorCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void JoinCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SpectateCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void RequestCallback(JoinRequest request);
public struct EventHandlers
{
public ReadyCallback readyCallback;
public DisconnectedCallback disconnectedCallback;
public ErrorCallback errorCallback;
public JoinCallback joinCallback;
public SpectateCallback spectateCallback;
public RequestCallback requestCallback;
}
[System.Serializable]
public struct RichPresence
{
public string state;
/* max 128 bytes */
public string details;
/* max 128 bytes */
public long startTimestamp;
public long endTimestamp;
public string largeImageKey;
/* max 32 bytes */
public string largeImageText;
/* max 128 bytes */
public string smallImageKey;
/* max 32 bytes */
public string smallImageText;
/* max 128 bytes */
public string partyId;
/* max 128 bytes */
public int partySize;
public int partyMax;
public string matchSecret;
/* max 128 bytes */
public string joinSecret;
/* max 128 bytes */
public string spectateSecret;
/* max 128 bytes */
public bool instance;
}
[System.Serializable]
public struct JoinRequest
{
public string userId;
public string username;
public string avatar;
}
public enum Reply
{
No = 0,
Yes = 1,
Ignore = 2
}
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
[DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
public static extern void Shutdown();
[DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunCallbacks();
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdatePresence(ref RichPresence presence);
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
public static extern void Respond(string userId, Reply reply);
}
#endregion

View File

@ -0,0 +1,67 @@
#region Usings
using System;
using System.Runtime.InteropServices;
using System.Text;
#endregion
#region INI File Parser
//modified from https://www.codeproject.com/articles/1966/an-ini-file-handling-class-using-c?fid=425860&df=90&mpp=25&prof=True&sort=Position&view=Normal&spc=Relaxed&fr=51
public class INIFile
{
public string path;
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
/// <summary>
/// INIFile Constructor.
/// </summary>
/// <PARAM name="INIPath"></PARAM>
public INIFile(string INIPath)
{
path = INIPath;
}
/// <summary>
/// Write Data to the INI File
/// </summary>
/// <PARAM name="Section"></PARAM>
/// Section name
/// <PARAM name="Key"></PARAM>
/// Key Name
/// <PARAM name="Value"></PARAM>
/// Value Name
public void IniWriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, this.path);
}
/// <summary>
/// Read Data Value From the Ini File
/// </summary>
/// <PARAM name="Section"></PARAM>
/// <PARAM name="Key"></PARAM>
/// <PARAM name="Default Value. Optional for creating values in case they are invalid."></PARAM>
/// <returns></returns>
public string IniReadValue(string Section, string Key, string DefaultValue = "")
{
try
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp,
255, this.path);
return temp.ToString();
}
catch (Exception)
{
IniWriteValue(Section, Key, DefaultValue);
return IniReadValue(Section, Key);
}
}
}
#endregion

View File

@ -5,6 +5,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
#endregion
#region Launcher State
@ -20,15 +21,6 @@ public enum LauncherState
}
#endregion
#region Launcher Layout
public enum LauncherLayout
{
None = 0,
Extended = 1,
Compact = 2
}
#endregion
#region Launcher Functions
public class LauncherFuncs
{
@ -42,7 +34,7 @@ public class LauncherFuncs
string versionbranch, defaultclient, defaultmap, regclient1,
regclient2, issnapshot, snapshottemplate, snapshotrevision;
IniFile ini = new IniFile(infopath);
INIFile ini = new INIFile(infopath);
string section = "ProgramInfo";
@ -63,7 +55,7 @@ public class LauncherFuncs
{
if (cmd)
{
var versionInfo = FileVersionInfo.GetVersionInfo(Directories.RootPathLauncher + "\\Novetus.exe");
var versionInfo = FileVersionInfo.GetVersionInfo(GlobalPaths.RootPathLauncher + "\\Novetus.exe");
GlobalVars.ProgramInformation.Version = snapshottemplate.Replace("%version%", versionbranch)
.Replace("%build%", versionInfo.ProductBuildPart.ToString())
.Replace("%revision%", versionInfo.FilePrivatePart.ToString())
@ -77,7 +69,7 @@ public class LauncherFuncs
.Replace("%snapshot-revision%", snapshotrevision);
}
string changelog = Directories.BasePath + "\\changelog.txt";
string changelog = GlobalPaths.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
@ -100,8 +92,8 @@ public class LauncherFuncs
GlobalVars.ProgramInformation.RegisterClient2 = regclient2;
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
}
catch (Exception)
{
@ -114,7 +106,7 @@ public class LauncherFuncs
if (write)
{
//WRITE
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "Config";
@ -131,10 +123,10 @@ public class LauncherFuncs
ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString());
ini.IniWriteValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString());
ini.IniWriteValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString());
ini.IniWriteValue(section, "GraphicsMode", EnumParser.GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString());
ini.IniWriteValue(section, "GraphicsMode", Settings.GraphicsOptions.GetIntForMode(GlobalVars.UserConfiguration.GraphicsMode).ToString());
ini.IniWriteValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString());
ini.IniWriteValue(section, "QualityLevel", EnumParser.GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString());
ini.IniWriteValue(section, "Layout", EnumParser.GetIntForLauncherLayout(GlobalVars.UserConfiguration.LauncherLayout).ToString());
ini.IniWriteValue(section, "QualityLevel", Settings.QualityOptions.GetIntForLevel(GlobalVars.UserConfiguration.QualityLevel).ToString());
ini.IniWriteValue(section, "Layout", Settings.UIOptions.GetIntForStyle(GlobalVars.UserConfiguration.LauncherLayout).ToString());
ini.IniWriteValue(section, "AssetLocalizerSaveBackups", GlobalVars.UserConfiguration.AssetLocalizerSaveBackups.ToString());
}
else
@ -145,7 +137,7 @@ public class LauncherFuncs
disablehelpmessage, tripcode, discord, mappath, mapsnip,
graphics, reshade, qualitylevel, layout, savebackups;
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "Config";
@ -162,10 +154,10 @@ public class LauncherFuncs
discord = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString());
mappath = ini.IniReadValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString());
mapsnip = ini.IniReadValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString());
graphics = ini.IniReadValue(section, "GraphicsMode", EnumParser.GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString());
graphics = ini.IniReadValue(section, "GraphicsMode", Settings.GraphicsOptions.GetIntForMode(GlobalVars.UserConfiguration.GraphicsMode).ToString());
reshade = ini.IniReadValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString());
qualitylevel = ini.IniReadValue(section, "QualityLevel", EnumParser.GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString());
layout = ini.IniReadValue(section, "Layout", EnumParser.GetIntForLauncherLayout(GlobalVars.UserConfiguration.LauncherLayout).ToString());
qualitylevel = ini.IniReadValue(section, "QualityLevel", Settings.QualityOptions.GetIntForLevel(GlobalVars.UserConfiguration.QualityLevel).ToString());
layout = ini.IniReadValue(section, "Layout", Settings.UIOptions.GetIntForStyle(GlobalVars.UserConfiguration.LauncherLayout).ToString());
savebackups = ini.IniReadValue(section, "AssetLocalizerSaveBackups", GlobalVars.UserConfiguration.AssetLocalizerSaveBackups.ToString());
try
@ -175,7 +167,7 @@ public class LauncherFuncs
if (userid.Equals("0"))
{
GeneratePlayerID();
Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
}
else
{
@ -199,7 +191,7 @@ public class LauncherFuncs
if (string.IsNullOrWhiteSpace(SecurityFuncs.Base64Decode(tripcode)))
{
GenerateTripcode();
Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
}
else
{
@ -211,10 +203,10 @@ public class LauncherFuncs
GlobalVars.UserConfiguration.MapPath = mappath;
GlobalVars.UserConfiguration.MapPathSnip = mapsnip;
GlobalVars.UserConfiguration.GraphicsMode = EnumParser.GetGraphicsModeForInt(Convert.ToInt32(graphics));
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.GetModeForInt(Convert.ToInt32(graphics));
GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade);
GlobalVars.UserConfiguration.QualityLevel = EnumParser.GetQualityLevelForInt(Convert.ToInt32(qualitylevel));
GlobalVars.UserConfiguration.LauncherLayout = EnumParser.GetLauncherLayoutForInt(Convert.ToInt32(layout));
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.GetLevelForInt(Convert.ToInt32(qualitylevel));
GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.GetStyleForInt(Convert.ToInt32(layout));
GlobalVars.UserConfiguration.AssetLocalizerSaveBackups = Convert.ToBoolean(savebackups);
}
catch (Exception)
@ -223,16 +215,16 @@ public class LauncherFuncs
}
}
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
{
Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
}
else
{
Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
}
ReShade(Directories.ConfigDir, "ReShade.ini", write);
ReShade(GlobalPaths.ConfigDir, "ReShade.ini", write);
}
public static void Customization(string cfgpath, bool write)
@ -240,7 +232,7 @@ public class LauncherFuncs
if (write)
{
//WRITE
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "Items";
@ -286,7 +278,7 @@ public class LauncherFuncs
larmid, larmstring, rarmid, rarmstring, llegid,
llegstring, rlegid, rlegstring, characterid, extraishat, showhatsonextra;
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "Items";
@ -373,7 +365,7 @@ public class LauncherFuncs
if (write)
{
//WRITE
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "GENERAL";
@ -388,7 +380,7 @@ public class LauncherFuncs
//READ
string framerate, frametime, performance;
IniFile ini = new IniFile(cfgpath);
INIFile ini = new INIFile(cfgpath);
string section = "GENERAL";
@ -498,7 +490,7 @@ public class LauncherFuncs
if (!File.Exists(fullpath))
{
File.Copy(Directories.ConfigDir + "\\ReShade_default.ini", fullpath, true);
File.Copy(GlobalPaths.ConfigDir + "\\ReShade_default.ini", fullpath, true);
ReShadeValues(fullpath, write, true);
}
else
@ -506,7 +498,7 @@ public class LauncherFuncs
ReShadeValues(fullpath, write, true);
}
string clientdir = Directories.ClientDir;
string clientdir = GlobalPaths.ClientDir;
DirectoryInfo dinfo = new DirectoryInfo(clientdir);
DirectoryInfo[] Dirs = dinfo.GetDirectories();
foreach (DirectoryInfo dir in Dirs)
@ -529,7 +521,7 @@ public class LauncherFuncs
{
if (!File.Exists(fulldllpath))
{
File.Copy(Directories.ConfigDirData + "\\opengl32.dll", fulldllpath, true);
File.Copy(GlobalPaths.ConfigDirData + "\\opengl32.dll", fulldllpath, true);
}
}
else
@ -554,12 +546,12 @@ public class LauncherFuncs
GlobalVars.UserConfiguration.UPnP = false;
GlobalVars.UserConfiguration.DisabledItemMakerHelp = false;
GlobalVars.UserConfiguration.DiscordPresence = true;
GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL;
GlobalVars.UserConfiguration.ReShade = false;
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra;
GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Extended;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra;
GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Extended;
ResetCustomizationValues();
}
@ -783,7 +775,7 @@ public class LauncherFuncs
break;
}
DiscordRpc.UpdatePresence(ref GlobalVars.presence);
IDiscordRPC.UpdatePresence(ref GlobalVars.presence);
}
}
@ -795,10 +787,10 @@ public class LauncherFuncs
{
switch (GlobalVars.UserConfiguration.GraphicsMode)
{
case GraphicsMode.OpenGL:
case Settings.GraphicsOptions.Mode.OpenGL:
result += "xpcall( function() settings().Rendering.graphicsMode = 2 end, function( err ) settings().Rendering.graphicsMode = 4 end );";
break;
case GraphicsMode.DirectX:
case Settings.GraphicsOptions.Mode.DirectX:
result += "pcall(function() settings().Rendering.graphicsMode = 3 end);";
break;
default:
@ -818,7 +810,7 @@ public class LauncherFuncs
switch (GlobalVars.UserConfiguration.QualityLevel)
{
case QualityLevel.VeryLow:
case Settings.QualityOptions.Level.VeryLow:
MeshDetail = 50;
ShadingQuality = 50;
GFXQualityLevel = 1;
@ -828,7 +820,7 @@ public class LauncherFuncs
Shadows_2008 = 2;
Shadows_2007 = false;
break;
case QualityLevel.Low:
case Settings.QualityOptions.Level.Low:
MeshDetail = 50;
ShadingQuality = 50;
GFXQualityLevel = 5;
@ -838,7 +830,7 @@ public class LauncherFuncs
Shadows_2008 = 2;
Shadows_2007 = false;
break;
case QualityLevel.Medium:
case Settings.QualityOptions.Level.Medium:
MeshDetail = 50;
ShadingQuality = 50;
GFXQualityLevel = 10;
@ -847,13 +839,13 @@ public class LauncherFuncs
Bevels = 2;
Shadows_2007 = false;
break;
case QualityLevel.High:
case Settings.QualityOptions.Level.High:
MeshDetail = 75;
ShadingQuality = 75;
GFXQualityLevel = 15;
AASamples = 4;
break;
case QualityLevel.Ultra:
case Settings.QualityOptions.Level.Ultra:
default:
break;
}
@ -892,7 +884,7 @@ public class LauncherFuncs
}
else
{
luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
}
return luafile;
@ -903,28 +895,28 @@ public class LauncherFuncs
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode)
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
}
else
{
switch (type)
{
case ScriptType.Client:
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
break;
case ScriptType.Server:
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe";
break;
case ScriptType.Studio:
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe";
break;
case ScriptType.Solo:
case ScriptType.EasterEgg:
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe";
break;
case ScriptType.None:
default:
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
break;
}
}

View File

@ -3,63 +3,66 @@ using System;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO.Compression;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
#endregion
#region Rich Text Box Extensions
public static class RichTextBoxExtensions
{
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
#region .NET Extentions
box.SelectionColor = color;
box.AppendText(text);
box.SelectionColor = box.ForeColor;
}
}
#endregion
//This code was brought to you by:
//https://stackoverflow.com/questions/1926264/color-different-parts-of-a-richtextbox-string
//https://stackoverflow.com/questions/262280/how-can-i-know-if-a-process-is-running
//https://stackoverflow.com/questions/444798/case-insensitive-containsstring
//https://stackoverflow.com/questions/6084940/how-do-i-search-a-multi-dimensional-array
//https://www.dotnetperls.com/between-before-after
//https://stackoverflow.com/questions/12422619/can-i-disable-the-close-button-of-a-form-using-c
//https://stackoverflow.com/questions/9031537/really-simple-encryption-with-c-sharp-and-symmetricalgorithm
#region Process Extensions
public static class ProcessExtensions
public static class NETExt
{
public static bool IsRunning(this Process process)
{
try {
Process.GetProcessById(process.Id);
} catch (InvalidOperationException) {
return false;
} catch (ArgumentException) {
return false;
}
return true;
}
}
#endregion
#region Rich Text Box Extensions
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
#region String Extensions
public static class StringExtensions
{
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
if (source == null)
return false;
return source.IndexOf(toCheck, comp) >= 0;
}
}
#endregion
box.SelectionColor = color;
box.AppendText(text);
box.SelectionColor = box.ForeColor;
}
#endregion
#region Array Helper
//credit to code4life
public static class ArrayHelper
{
#region Process Extensions
public static bool IsRunning(this Process process)
{
try
{
Process.GetProcessById(process.Id);
}
catch (InvalidOperationException)
{
return false;
}
catch (ArgumentException)
{
return false;
}
return true;
}
#endregion
#region String Extensions
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
if (source == null)
return false;
return source.IndexOf(toCheck, comp) >= 0;
}
#endregion
#region Array Helper
public static object FindInDimensions(this object[,] target,
object searchTerm)
object searchTerm)
{
object result = null;
var rowLowerLimit = target.GetLowerBound(0);
@ -78,13 +81,9 @@ public static class ArrayHelper
return result;
}
}
#endregion
#endregion
#region Substring Extensions
//dotnetperls
static class SubstringExtensions
{
#region Substring Extensions
/// <summary>
/// Get string value between [first] a and [last] b.
/// </summary>
@ -138,77 +137,9 @@ static class SubstringExtensions
}
return value.Substring(adjustedPosA);
}
}
#endregion
#endregion
#region Tab Control without Header
//credit to https://stackoverflow.com/questions/23247941/c-sharp-how-to-remove-tabcontrol-border
public partial class TabControlWithoutHeader : TabControl
{
int layoutval = 1;
public TabControlWithoutHeader(int layout)
{
SetLayout(layout);
}
public TabControlWithoutHeader()
{
SetLayout(1);
}
private void SetLayout(int layout)
{
layoutval = layout;
if (layoutval == 1)
{
if (!DesignMode) Multiline = true;
}
}
protected override void WndProc(ref Message m)
{
if (layoutval == 2)
{
base.WndProc(ref m);
return;
}
if (m.Msg == 0x1328 && !DesignMode)
m.Result = new IntPtr(1);
else
base.WndProc(ref m);
}
}
#endregion
#region Form Extensions
//https://stackoverflow.com/questions/12422619/can-i-disable-the-close-button-of-a-form-using-c
public static class FormExt
{
[DllImport("user32")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32")]
public static extern bool EnableMenuItem(IntPtr hMenu, uint itemId, uint uEnable);
public static void DisableCloseButton(this Form form)
{
// The 1 parameter means to gray out. 0xF060 is SC_CLOSE.
EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 1);
}
public static void EnableCloseButton(this Form form)
{
// The zero parameter means to enable. 0xF060 is SC_CLOSE.
EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 0);
}
}
#endregion
#region String Utilities
//https://stackoverflow.com/questions/9031537/really-simple-encryption-with-c-sharp-and-symmetricalgorithm
public static class StringUtil
{
#region String Utilities
private static byte[] key = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
private static byte[] iv = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
@ -229,5 +160,6 @@ public static class StringUtil
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
return Encoding.Unicode.GetString(outputBuffer);
}
#endregion
}
#endregion

View File

@ -0,0 +1,54 @@
#region Usings
using Mono.Nat;
using System;
#endregion
#region NetFuncs
public static class NetFuncs
{
public static void InitUPnP(EventHandler<DeviceEventArgs> DeviceFound, EventHandler<DeviceEventArgs> DeviceLost)
{
if (GlobalVars.UserConfiguration.UPnP == true)
{
NatUtility.DeviceFound += DeviceFound;
NatUtility.DeviceLost += DeviceLost;
NatUtility.StartDiscovery();
}
}
public static void StartUPnP(INatDevice device, Protocol protocol, int port)
{
if (GlobalVars.UserConfiguration.UPnP == true)
{
Mapping checker = device.GetSpecificMapping(protocol, port);
int mapPublic = checker.PublicPort;
int mapPrivate = checker.PrivatePort;
if (mapPublic == -1 && mapPrivate == -1)
{
Mapping portmap = new Mapping(protocol, port, port);
portmap.Description = "Novetus";
device.CreatePortMap(portmap);
}
}
}
public static void StopUPnP(INatDevice device, Protocol protocol, int port)
{
if (GlobalVars.UserConfiguration.UPnP == true)
{
Mapping checker = device.GetSpecificMapping(protocol, port);
int mapPublic = checker.PublicPort;
int mapPrivate = checker.PrivatePort;
if (mapPublic != -1 && mapPrivate != -1)
{
Mapping portmap = new Mapping(protocol, port, port);
portmap.Description = "Novetus";
device.DeletePortMap(portmap);
}
}
}
}
#endregion

View File

@ -9,10 +9,20 @@
<Import_RootNamespace>NovetusFuncs</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)NovetusMainLibrary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NovetusScriptLibrary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NovetusCodeExtensionLibrary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NovetusLauncherLibrary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NovetusSecurityLibrary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CryptoRandom.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileFormat.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GlobalPaths.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GlobalVars.cs" />
<Compile Include="$(MSBuildThisFileDirectory)IDiscordRPC.cs" />
<Compile Include="$(MSBuildThisFileDirectory)INIFile.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NETExt.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NetFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SimpleHTTPServer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ScriptFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LauncherFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SecurityFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Settings.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TextLineRemover.cs" />
<Compile Include="$(MSBuildThisFileDirectory)VarStorage.cs" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,295 +0,0 @@
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
#endregion
#region Script Type
public enum ScriptType
{
Client = 0,
Server = 1,
Solo = 2,
Studio = 3,
EasterEgg = 4,
None = 5
}
#endregion
#region Script Generator
public class ScriptGenerator
{
public static string GetScriptFuncForType(ScriptType type)
{
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode == true)
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
}
else
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
}
string md5dir = SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location);
string md5script = SecurityFuncs.CalculateMD5(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua");
string md5exe = SecurityFuncs.CalculateMD5(rbxexe);
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
switch (type)
{
case ScriptType.Client:
return "_G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.loadtext + ","
+ md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + "')";
case ScriptType.Server:
return "_G.CSServer("
+ GlobalVars.UserConfiguration.RobloxPort + ","
+ GlobalVars.UserConfiguration.PlayerLimit + ","
+ md5s + ")";
case ScriptType.Solo:
case ScriptType.EasterEgg:
return "_G.CSSolo("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.sololoadtext + ")";
case ScriptType.Studio:
return "_G.CSStudio()";
default:
return "";
}
}
public static string GetNameForType(ScriptType type)
{
switch (type)
{
case ScriptType.Client:
return "Client";
case ScriptType.Server:
return "Server";
case ScriptType.Solo:
return "Play Solo";
case ScriptType.Studio:
return "Studio";
case ScriptType.EasterEgg:
return "A message from Bitl";
default:
return "";
}
}
public static void GenerateScriptForClient(ScriptType type)
{
string code = GlobalVars.MultiLine(
"--Load Script",
//scriptcontents,
LauncherFuncs.ChangeGameSettings(),
"dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')",
GetScriptFuncForType(type),
!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "')" : ""
);
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray();
File.WriteAllLines(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua", convertedList);
}
}
#endregion
#region ClientScript Parser
public class ClientScript
{
public static string GetArgsFromTag(string code, string tag, string endtag)
{
try
{
int pFrom = code.IndexOf(tag) + tag.Length;
int pTo = code.LastIndexOf(endtag);
string result = code.Substring(pFrom, pTo - pFrom);
return result;
}
catch (Exception)
{
return "%donothing%";
}
}
public static ScriptType GetTypeFromTag(string tag)
{
switch (tag)
{
case string client when client.Contains("client"):
return ScriptType.Client;
case string server when server.Contains("server"):
case string no3d when no3d.Contains("no3d"):
return ScriptType.Server;
case string solo when solo.Contains("solo"):
return ScriptType.Solo;
case string studio when studio.Contains("studio"):
return ScriptType.Studio;
default:
return ScriptType.None;
}
}
public static string GetRawArgsForType(ScriptType type, string md5s, string luafile)
{
switch (type)
{
case ScriptType.Client:
return LauncherFuncs.ChangeGameSettings() +
" dofile('" + luafile + "'); _G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.loadtext + ","
+ md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + "')";
case ScriptType.Server:
return LauncherFuncs.ChangeGameSettings() +
" dofile('" + luafile + "'); _G.CSServer("
+ GlobalVars.UserConfiguration.RobloxPort + ","
+ GlobalVars.UserConfiguration.PlayerLimit + ","
+ md5s + "); "
+ (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() +
" dofile('" + GlobalVars.AddonScriptPath + "');" : "");
case ScriptType.Solo:
case ScriptType.EasterEgg:
return LauncherFuncs.ChangeGameSettings()
+ " dofile('" + luafile + "'); _G.CSSolo("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.sololoadtext + ")";
case ScriptType.Studio:
return LauncherFuncs.ChangeGameSettings()
+ " dofile('" + luafile + "');";
default:
return "";
}
}
public static string GetRawArgsFromTag(string tag, string md5s, string luafile)
{
return GetRawArgsForType(GetTypeFromTag(tag), md5s, luafile);
}
public static int ConvertIconStringToInt()
{
switch (GlobalVars.UserCustomization.Icon)
{
case "BC":
return 1;
case "TBC":
return 2;
case "OBC":
return 3;
case "NBC":
default:
return 0;
}
}
public static string GetFolderAndMapName(string source, string seperator)
{
try {
string result = source.Substring(0, source.IndexOf(seperator));
if (File.Exists(Directories.MapsDir + @"\\" + result + @"\\" + source)) {
return result + @"\\" + source;
} else {
return source;
}
} catch (Exception) {
return source;
}
}
public static string GetFolderAndMapName(string source)
{
return GetFolderAndMapName(source, " -");
}
public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe)
{
if (GlobalVars.SelectedClientInfo.Fix2007) {
ScriptGenerator.GenerateScriptForClient(GetTypeFromTag(tag));
}
string extractedCode = GetArgsFromTag(code, tag, endtag);
if (extractedCode.Contains("%donothing%"))
{
return "";
}
string md5dir = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : "";
string md5script = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua") : "";
string md5exe = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(rbxexe) : "";
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
string compiled = extractedCode.Replace("%mapfile%", mapfile)
.Replace("%luafile%", luafile)
.Replace("%charapp%", GlobalVars.UserCustomization.CharacterID)
.Replace("%ip%", GlobalVars.IP)
.Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString())
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%icone%", ConvertIconStringToInt().ToString())
.Replace("%icon%", GlobalVars.UserCustomization.Icon)
.Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString())
.Replace("%face%", GlobalVars.UserCustomization.Face)
.Replace("%head%", GlobalVars.UserCustomization.Head)
.Replace("%tshirt%", GlobalVars.UserCustomization.TShirt)
.Replace("%shirt%", GlobalVars.UserCustomization.Shirt)
.Replace("%pants%", GlobalVars.UserCustomization.Pants)
.Replace("%hat1%", GlobalVars.UserCustomization.Hat1)
.Replace("%hat2%", GlobalVars.UserCustomization.Hat2)
.Replace("%hat3%", GlobalVars.UserCustomization.Hat3)
.Replace("%faced%", Directories.faceGameDir + GlobalVars.UserCustomization.Face)
.Replace("%headd%", Directories.headGameDir + GlobalVars.UserCustomization.Head)
.Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : Directories.tshirtGameDir + GlobalVars.UserCustomization.TShirt)
.Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : Directories.shirtGameDir + GlobalVars.UserCustomization.Shirt)
.Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : Directories.pantsGameDir + GlobalVars.UserCustomization.Pants)
.Replace("%hat1d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat1)
.Replace("%hat2d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat2)
.Replace("%hat3d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat3)
.Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString())
.Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString())
.Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString())
.Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString())
.Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString())
.Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString())
.Replace("%md5launcher%", md5dir)
.Replace("%md5script%", GlobalVars.SelectedClientInfo.ClientMD5)
.Replace("%md5exe%", GlobalVars.SelectedClientInfo.ScriptMD5)
.Replace("%md5scriptd%", md5script)
.Replace("%md5exed%", md5exe)
.Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString())
.Replace("%extra%", GlobalVars.UserCustomization.Extra)
.Replace("%hat4%", GlobalVars.UserCustomization.Extra)
.Replace("%extrad%", Directories.extraGameDir + GlobalVars.UserCustomization.Extra)
.Replace("%hat4d%", Directories.hatGameDir + GlobalVars.UserCustomization.Extra)
.Replace("%args%", GetRawArgsFromTag(tag, md5s, luafile))
.Replace("%facews%", Directories.WebServer_FaceDir + GlobalVars.UserCustomization.Face)
.Replace("%headws%", Directories.WebServer_HeadDir + GlobalVars.UserCustomization.Head)
.Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : Directories.WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt)
.Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : Directories.WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt)
.Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : Directories.WebServer_PantsDir + GlobalVars.UserCustomization.Pants)
.Replace("%hat1ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat1)
.Replace("%hat2ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat2)
.Replace("%hat3ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat3)
.Replace("%extraws%", Directories.WebServer_ExtraDir + GlobalVars.UserCustomization.Extra)
.Replace("%hat4ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Extra)
.Replace("%mapfiled%", Directories.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\"))
.Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode)
.Replace("%addonscriptpath%", GlobalVars.AddonScriptPath);
return compiled;
}
}
#endregion

View File

@ -0,0 +1,307 @@
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
#endregion
#region Script Type
public enum ScriptType
{
Client = 0,
Server = 1,
Solo = 2,
Studio = 3,
EasterEgg = 4,
None = 5
}
#endregion
#region Script Functions
public class ScriptFuncs
{
#region Script Generator
public class Generator
{
public static string GetScriptFuncForType(ScriptType type)
{
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode == true)
{
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
}
else
{
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
}
string md5dir = SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location);
string md5script = SecurityFuncs.CalculateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua");
string md5exe = SecurityFuncs.CalculateMD5(rbxexe);
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
switch (type)
{
case ScriptType.Client:
return "_G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.loadtext + ","
+ md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + "')";
case ScriptType.Server:
return "_G.CSServer("
+ GlobalVars.UserConfiguration.RobloxPort + ","
+ GlobalVars.UserConfiguration.PlayerLimit + ","
+ md5s + ")";
case ScriptType.Solo:
case ScriptType.EasterEgg:
return "_G.CSSolo("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.sololoadtext + ")";
case ScriptType.Studio:
return "_G.CSStudio()";
default:
return "";
}
}
public static string GetNameForType(ScriptType type)
{
switch (type)
{
case ScriptType.Client:
return "Client";
case ScriptType.Server:
return "Server";
case ScriptType.Solo:
return "Play Solo";
case ScriptType.Studio:
return "Studio";
case ScriptType.EasterEgg:
return "A message from Bitl";
default:
return "";
}
}
public static void GenerateScriptForClient(ScriptType type)
{
string code = GlobalVars.MultiLine(
"--Load Script",
//scriptcontents,
LauncherFuncs.ChangeGameSettings(),
"dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')",
GetScriptFuncForType(type),
!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "')" : ""
);
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray();
File.WriteAllLines(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua", convertedList);
}
}
#endregion
#region ClientScript Parser
public class ClientScript
{
public static string GetArgsFromTag(string code, string tag, string endtag)
{
try
{
int pFrom = code.IndexOf(tag) + tag.Length;
int pTo = code.LastIndexOf(endtag);
string result = code.Substring(pFrom, pTo - pFrom);
return result;
}
catch (Exception)
{
return "%donothing%";
}
}
public static ScriptType GetTypeFromTag(string tag)
{
switch (tag)
{
case string client when client.Contains("client"):
return ScriptType.Client;
case string server when server.Contains("server"):
case string no3d when no3d.Contains("no3d"):
return ScriptType.Server;
case string solo when solo.Contains("solo"):
return ScriptType.Solo;
case string studio when studio.Contains("studio"):
return ScriptType.Studio;
default:
return ScriptType.None;
}
}
public static string GetRawArgsForType(ScriptType type, string md5s, string luafile)
{
switch (type)
{
case ScriptType.Client:
return LauncherFuncs.ChangeGameSettings() +
" dofile('" + luafile + "'); _G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.loadtext + ","
+ md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + "')";
case ScriptType.Server:
return LauncherFuncs.ChangeGameSettings() +
" dofile('" + luafile + "'); _G.CSServer("
+ GlobalVars.UserConfiguration.RobloxPort + ","
+ GlobalVars.UserConfiguration.PlayerLimit + ","
+ md5s + "); "
+ (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() +
" dofile('" + GlobalVars.AddonScriptPath + "');" : "");
case ScriptType.Solo:
case ScriptType.EasterEgg:
return LauncherFuncs.ChangeGameSettings()
+ " dofile('" + luafile + "'); _G.CSSolo("
+ (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.sololoadtext + ")";
case ScriptType.Studio:
return LauncherFuncs.ChangeGameSettings()
+ " dofile('" + luafile + "');";
default:
return "";
}
}
public static string GetRawArgsFromTag(string tag, string md5s, string luafile)
{
return GetRawArgsForType(GetTypeFromTag(tag), md5s, luafile);
}
public static int ConvertIconStringToInt()
{
switch (GlobalVars.UserCustomization.Icon)
{
case "BC":
return 1;
case "TBC":
return 2;
case "OBC":
return 3;
case "NBC":
default:
return 0;
}
}
public static string GetFolderAndMapName(string source, string seperator)
{
try
{
string result = source.Substring(0, source.IndexOf(seperator));
if (File.Exists(GlobalPaths.MapsDir + @"\\" + result + @"\\" + source))
{
return result + @"\\" + source;
}
else
{
return source;
}
}
catch (Exception)
{
return source;
}
}
public static string GetFolderAndMapName(string source)
{
return GetFolderAndMapName(source, " -");
}
public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe)
{
if (GlobalVars.SelectedClientInfo.Fix2007)
{
ScriptFuncs.Generator.GenerateScriptForClient(GetTypeFromTag(tag));
}
string extractedCode = GetArgsFromTag(code, tag, endtag);
if (extractedCode.Contains("%donothing%"))
{
return "";
}
string md5dir = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : "";
string md5script = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua") : "";
string md5exe = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(rbxexe) : "";
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
string compiled = extractedCode.Replace("%mapfile%", mapfile)
.Replace("%luafile%", luafile)
.Replace("%charapp%", GlobalVars.UserCustomization.CharacterID)
.Replace("%ip%", GlobalVars.IP)
.Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString())
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%icone%", ConvertIconStringToInt().ToString())
.Replace("%icon%", GlobalVars.UserCustomization.Icon)
.Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString())
.Replace("%face%", GlobalVars.UserCustomization.Face)
.Replace("%head%", GlobalVars.UserCustomization.Head)
.Replace("%tshirt%", GlobalVars.UserCustomization.TShirt)
.Replace("%shirt%", GlobalVars.UserCustomization.Shirt)
.Replace("%pants%", GlobalVars.UserCustomization.Pants)
.Replace("%hat1%", GlobalVars.UserCustomization.Hat1)
.Replace("%hat2%", GlobalVars.UserCustomization.Hat2)
.Replace("%hat3%", GlobalVars.UserCustomization.Hat3)
.Replace("%faced%", GlobalPaths.faceGameDir + GlobalVars.UserCustomization.Face)
.Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.Head)
.Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.TShirt)
.Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.Shirt)
.Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.Pants)
.Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat1)
.Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat2)
.Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat3)
.Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString())
.Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString())
.Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString())
.Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString())
.Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString())
.Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString())
.Replace("%md5launcher%", md5dir)
.Replace("%md5script%", GlobalVars.SelectedClientInfo.ClientMD5)
.Replace("%md5exe%", GlobalVars.SelectedClientInfo.ScriptMD5)
.Replace("%md5scriptd%", md5script)
.Replace("%md5exed%", md5exe)
.Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString())
.Replace("%extra%", GlobalVars.UserCustomization.Extra)
.Replace("%hat4%", GlobalVars.UserCustomization.Extra)
.Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.Extra)
.Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra)
.Replace("%args%", GetRawArgsFromTag(tag, md5s, luafile))
.Replace("%facews%", GlobalPaths.WebServer_FaceDir + GlobalVars.UserCustomization.Face)
.Replace("%headws%", GlobalPaths.WebServer_HeadDir + GlobalVars.UserCustomization.Head)
.Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt)
.Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt)
.Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.WebServer_PantsDir + GlobalVars.UserCustomization.Pants)
.Replace("%hat1ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat1)
.Replace("%hat2ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat2)
.Replace("%hat3ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat3)
.Replace("%extraws%", GlobalPaths.WebServer_ExtraDir + GlobalVars.UserCustomization.Extra)
.Replace("%hat4ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Extra)
.Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\"))
.Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode)
.Replace("%addonscriptpath%", GlobalVars.AddonScriptPath);
return compiled;
}
}
#endregion
}
#endregion

View File

@ -91,9 +91,9 @@ public class SecurityFuncs
if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) {
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode == true) {
rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp.exe";
rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp.exe";
} else {
rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe";
rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe";
}
using (var md5 = MD5.Create()) {
using (var stream = File.OpenRead(rbxexe)) {
@ -118,7 +118,7 @@ public class SecurityFuncs
{
if (GlobalVars.AdminMode != true) {
if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) {
string rbxscript = Directories.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua";
string rbxscript = GlobalPaths.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua";
using (var md5 = MD5.Create()) {
using (var stream = File.OpenRead(rbxscript)) {
byte[] hash = md5.ComputeHash(stream);
@ -186,7 +186,7 @@ public class SecurityFuncs
SetWindowText(exe.MainWindowHandle, "Novetus "
+ GlobalVars.ProgramInformation.Version + " - "
+ clientname + " "
+ ScriptGenerator.GetNameForType(type)
+ ScriptFuncs.Generator.GetNameForType(type)
+ " [" + GlobalVars.IP + ":" + GlobalVars.UserConfiguration.RobloxPort + "]"
+ RandomStringTitle());
break;
@ -195,7 +195,7 @@ public class SecurityFuncs
SetWindowText(exe.MainWindowHandle, "Novetus "
+ GlobalVars.ProgramInformation.Version + " - "
+ clientname + " "
+ ScriptGenerator.GetNameForType(type)
+ ScriptFuncs.Generator.GetNameForType(type)
+ (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]")
+ RandomStringTitle());
break;
@ -208,7 +208,7 @@ public class SecurityFuncs
break;
case ScriptType.EasterEgg:
default:
SetWindowText(exe.MainWindowHandle, ScriptGenerator.GetNameForType(type)
SetWindowText(exe.MainWindowHandle, ScriptFuncs.Generator.GetNameForType(type)
+ RandomStringTitle());
break;
}

View File

@ -0,0 +1,132 @@
#region Settings
public class Settings
{
#region Quality Options
public class QualityOptions
{
public enum Level
{
VeryLow = 1,
Low = 2,
Medium = 3,
High = 4,
Ultra = 5
}
public static Level GetLevelForInt(int level)
{
switch (level)
{
case 1:
return Level.VeryLow;
case 2:
return Level.Low;
case 3:
return Level.Medium;
case 4:
return Level.High;
case 5:
default:
return Level.Ultra;
}
}
public static int GetIntForLevel(Level level)
{
switch (level)
{
case Level.VeryLow:
return 1;
case Level.Low:
return 2;
case Level.Medium:
return 3;
case Level.High:
return 4;
case Level.Ultra:
default:
return 5;
}
}
}
#endregion
#region Graphics Options
public class GraphicsOptions
{
public enum Mode
{
None = 0,
OpenGL = 1,
DirectX = 2
}
public static Mode GetModeForInt(int level)
{
switch (level)
{
case 1:
return Mode.OpenGL;
case 2:
return Mode.DirectX;
default:
return Mode.None;
}
}
public static int GetIntForMode(Mode level)
{
switch (level)
{
case Mode.OpenGL:
return 1;
case Mode.DirectX:
return 2;
default:
return 0;
}
}
}
#endregion
#region UI Options
public static class UIOptions
{
public enum Style
{
None = 0,
Extended = 1,
Compact = 2
}
public static Style GetStyleForInt(int level)
{
switch (level)
{
case 1:
return Style.Extended;
case 2:
return Style.Compact;
default:
return Style.None;
}
}
public static int GetIntForStyle(Style level)
{
switch (level)
{
case Style.Extended:
return 1;
case Style.Compact:
return 2;
default:
return 0;
}
}
}
#endregion
}
#endregion

View File

@ -0,0 +1,253 @@
#region Usings
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
#endregion
#region Simple HTTP Server
// Modified from https://gist.github.com/aksakalli/9191056
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
public class SimpleHTTPServer
{
private readonly string[] _indexFiles = {
"index.html",
"index.htm",
"index.php",
"default.html",
"default.htm",
"default.php"
};
private static IDictionary<string, string> _mimeTypeMappings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) {
{ ".asf", "video/x-ms-asf" },
{ ".asx", "video/x-ms-asf" },
{ ".avi", "video/x-msvideo" },
{ ".bin", "application/octet-stream" },
{ ".cco", "application/x-cocoa" },
{ ".crt", "application/x-x509-ca-cert" },
{ ".css", "text/css" },
{ ".deb", "application/octet-stream" },
{ ".der", "application/x-x509-ca-cert" },
{ ".dll", "application/octet-stream" },
{ ".dmg", "application/octet-stream" },
{ ".ear", "application/java-archive" },
{ ".eot", "application/octet-stream" },
{ ".exe", "application/octet-stream" },
{ ".flv", "video/x-flv" },
{ ".gif", "image/gif" },
{ ".hqx", "application/mac-binhex40" },
{ ".htc", "text/x-component" },
{ ".htm", "text/html" },
{ ".html", "text/html" },
{ ".ico", "image/x-icon" },
{ ".img", "application/octet-stream" },
{ ".iso", "application/octet-stream" },
{ ".jar", "application/java-archive" },
{ ".jardiff", "application/x-java-archive-diff" },
{ ".jng", "image/x-jng" },
{ ".jnlp", "application/x-java-jnlp-file" },
{ ".jpeg", "image/jpeg" },
{ ".jpg", "image/jpeg" },
{ ".js", "application/x-javascript" },
{ ".mml", "text/mathml" },
{ ".mng", "video/x-mng" },
{ ".mov", "video/quicktime" },
{ ".mp3", "audio/mpeg" },
{ ".mpeg", "video/mpeg" },
{ ".mpg", "video/mpeg" },
{ ".msi", "application/octet-stream" },
{ ".msm", "application/octet-stream" },
{ ".msp", "application/octet-stream" },
{ ".pdb", "application/x-pilot" },
{ ".pdf", "application/pdf" },
{ ".pem", "application/x-x509-ca-cert" },
{ ".php", "text/html" },
{ ".pl", "application/x-perl" },
{ ".pm", "application/x-perl" },
{ ".png", "image/png" },
{ ".prc", "application/x-pilot" },
{ ".ra", "audio/x-realaudio" },
{ ".rar", "application/x-rar-compressed" },
{ ".rpm", "application/x-redhat-package-manager" },
{ ".rss", "text/xml" },
{ ".run", "application/x-makeself" },
{ ".sea", "application/x-sea" },
{ ".shtml", "text/html" },
{ ".sit", "application/x-stuffit" },
{ ".swf", "application/x-shockwave-flash" },
{ ".tcl", "application/x-tcl" },
{ ".tk", "application/x-tcl" },
{ ".txt", "text/plain" },
{ ".war", "application/java-archive" },
{ ".wbmp", "image/vnd.wap.wbmp" },
{ ".wmv", "video/x-ms-wmv" },
{ ".xml", "text/xml" },
{ ".xpi", "application/x-xpinstall" },
{ ".zip", "application/zip" },
};
private Thread _serverThread;
private string _rootDirectory;
private HttpListener _listener;
private int _port;
public int Port
{
get { return _port; }
private set { }
}
/// <summary>
/// Construct server with given port.
/// </summary>
/// <param name="path">Directory path to serve.</param>
/// <param name="port">Port of the server.</param>
public SimpleHTTPServer(string path, int port)
{
this.Initialize(path, port);
}
/// <summary>
/// Construct server with suitable port.
/// </summary>
/// <param name="path">Directory path to serve.</param>
public SimpleHTTPServer(string path)
{
//get an empty port
TcpListener l = new TcpListener(IPAddress.Loopback, 0);
l.Start();
int port = ((IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
this.Initialize(path, port);
}
/// <summary>
/// Stop server and dispose all functions.
/// </summary>
public void Stop()
{
_serverThread.Abort();
_listener.Stop();
GlobalVars.IsWebServerOn = false;
}
private void Listen()
{
_listener = new HttpListener();
_listener.Prefixes.Add("http://*:" + _port.ToString() + "/");
_listener.Start();
while (true)
{
try
{
HttpListenerContext context = _listener.GetContext();
Process(context);
}
catch (Exception)
{
}
}
}
private string ProcessPhpPage(string phpCompilerPath, string pageFileName)
{
Process proc = new Process();
proc.StartInfo.FileName = phpCompilerPath;
proc.StartInfo.Arguments = "-d \"display_errors=1\" -d \"error_reporting=E_PARSE\" \"" + pageFileName + "\"";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.Start();
string res = proc.StandardOutput.ReadToEnd();
proc.StandardOutput.Close();
proc.Close();
return res;
}
private void Process(HttpListenerContext context)
{
string filename = context.Request.Url.AbsolutePath;
filename = filename.Substring(1);
if (string.IsNullOrEmpty(filename))
{
foreach (string indexFile in _indexFiles)
{
if (File.Exists(Path.Combine(_rootDirectory, indexFile)))
{
filename = indexFile;
break;
}
}
}
filename = Path.Combine(_rootDirectory, filename);
if (File.Exists(filename))
{
try
{
var ext = new FileInfo(filename);
if (ext.Extension == ".php")
{
string output = ProcessPhpPage(GlobalPaths.ConfigDirData + "\\php\\php.exe", filename);
byte[] input = ASCIIEncoding.UTF8.GetBytes(output);
//Adding permanent http response headers
string mime;
context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream";
context.Response.ContentLength64 = input.Length;
context.Response.AddHeader("Date", DateTime.Now.ToString("r"));
context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r"));
context.Response.OutputStream.Write(input, 0, input.Length);
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.OutputStream.Flush();
}
else
{
Stream input = new FileStream(filename, FileMode.Open);
//Adding permanent http response headers
string mime;
context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream";
context.Response.ContentLength64 = input.Length;
context.Response.AddHeader("Date", DateTime.Now.ToString("r"));
context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r"));
byte[] buffer = new byte[1024 * 16];
int nbytes;
while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0)
context.Response.OutputStream.Write(buffer, 0, nbytes);
input.Close();
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.OutputStream.Flush();
}
}
catch (Exception)
{
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
}
}
context.Response.OutputStream.Close();
}
private void Initialize(string path, int port)
{
this._rootDirectory = path;
this._port = port;
_serverThread = new Thread(this.Listen);
_serverThread.Start();
GlobalVars.IsWebServerOn = true;
}
}
#endregion

View File

@ -0,0 +1,105 @@
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
#endregion
#region Text Line Remover and Friends
// modified from https://stackoverflow.com/questions/668907/how-to-delete-a-line-from-a-text-file-in-c/668914#668914
public static class TextLineRemover
{
public static void RemoveTextLines(IList<string> linesToRemove, string filename, string tempFilename)
{
// Initial values
int lineNumber = 0;
int linesRemoved = 0;
DateTime startTime = DateTime.Now;
// Read file
using (var sr = new StreamReader(filename))
{
// Write new file
using (var sw = new StreamWriter(tempFilename))
{
// Read lines
string line;
while ((line = sr.ReadLine()) != null)
{
lineNumber++;
// Look for text to remove
if (!ContainsString(line, linesToRemove))
{
// Keep lines that does not match
sw.WriteLine(line);
}
else
{
// Ignore lines that DO match
linesRemoved++;
InvokeOnRemovedLine(new RemovedLineArgs
{
RemovedLine = line,
RemovedLineNumber = lineNumber
});
}
}
}
}
// Delete original file
File.Delete(filename);
// ... and put the temp file in its place.
File.Move(tempFilename, filename);
// Final calculations
DateTime endTime = DateTime.Now;
InvokeOnFinished(new FinishedArgs
{
LinesRemoved = linesRemoved,
TotalLines = lineNumber,
TotalTime = endTime.Subtract(startTime)
});
}
private static bool ContainsString(string line, IEnumerable<string> linesToRemove)
{
foreach (var lineToRemove in linesToRemove)
{
if (line.Contains(lineToRemove))
return true;
}
return false;
}
public static event RemovedLine OnRemovedLine;
public static event Finished OnFinished;
public static void InvokeOnFinished(FinishedArgs args)
{
OnFinished?.Invoke(null, args);
}
public static void InvokeOnRemovedLine(RemovedLineArgs args)
{
OnRemovedLine?.Invoke(null, args);
}
}
public delegate void Finished(object sender, FinishedArgs args);
public struct FinishedArgs
{
public int TotalLines { get; set; }
public int LinesRemoved { get; set; }
public TimeSpan TotalTime { get; set; }
}
public delegate void RemovedLine(object sender, RemovedLineArgs args);
public struct RemovedLineArgs
{
public string RemovedLine { get; set; }
public int RemovedLineNumber { get; set; }
}
#endregion

View File

@ -0,0 +1,38 @@
#region Usings
using System.Drawing;
#endregion
#region Variable Storage
public class VarStorage
{
#region Asset Cache Definition
public class AssetCacheDef
{
public AssetCacheDef(string clas, string[] id, string[] ext,
string[] dir, string[] gamedir)
{
Class = clas;
Id = id;
Ext = ext;
Dir = dir;
GameDir = gamedir;
}
public string Class { get; set; }
public string[] Id { get; set; }
public string[] Ext { get; set; }
public string[] Dir { get; set; }
public string[] GameDir { get; set; }
}
#endregion
#region Part Colors
public class PartColors
{
public int ColorID { get; set; }
public Color ButtonColor { get; set; }
}
#endregion
}
#endregion

View File

@ -0,0 +1,85 @@
#region Usings
using Ionic.Zip;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
#endregion
#region Addon Loader
public class AddonLoader
{
private readonly OpenFileDialog openFileDialog1;
private string installOutcome = "";
private int fileListDisplay = 0;
public AddonLoader()
{
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select an addon .zip file",
Filter = "Compressed zip files (*.zip)|*.zip",
Title = "Open addon .zip"
};
}
public void setInstallOutcome(string text)
{
installOutcome = text;
}
public string getInstallOutcome()
{
return installOutcome;
}
public void setFileListDisplay(int number)
{
fileListDisplay = number;
}
public void LoadAddon()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
int filecount = 0;
StringBuilder filelistbuilder = new StringBuilder();
using (Stream str = openFileDialog1.OpenFile())
{
using (var zipFile = ZipFile.Read(str))
{
ZipEntry[] entries = zipFile.Entries.ToArray();
foreach (ZipEntry entry in entries)
{
filelistbuilder.Append(entry.FileName + " (" + entry.UncompressedSize + ")");
filelistbuilder.Append(Environment.NewLine);
}
zipFile.ExtractAll(GlobalPaths.BasePath, ExtractExistingFileAction.OverwriteSilently);
}
}
string filelist = filelistbuilder.ToString();
if (filecount > fileListDisplay)
{
installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!";
}
else
{
installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist;
}
}
catch (Exception ex)
{
installOutcome = "Error when installing addon: " + ex.Message;
}
}
}
}
#endregion

View File

@ -0,0 +1,65 @@
#region Usings
using System;
using System.IO;
using System.Windows.Forms;
#endregion
#region Icon Loader
public class IconLoader
{
private OpenFileDialog openFileDialog1;
private string installOutcome = "";
public IconLoader()
{
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select an icon .png file",
Filter = "Portable Network Graphics image (*.png)|*.png",
Title = "Open icon .png"
};
}
public void setInstallOutcome(string text)
{
installOutcome = text;
}
public string getInstallOutcome()
{
return installOutcome;
}
public void LoadImage()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
using (Stream str = openFileDialog1.OpenFile())
{
using (Stream output = new FileStream(GlobalPaths.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName + ".png", FileMode.Create))
{
byte[] buffer = new byte[32 * 1024];
int read;
while ((read = str.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
}
str.Close();
}
installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!";
}
catch (Exception ex)
{
installOutcome = "Error when installing icon: " + ex.Message;
}
}
}
}
#endregion

View File

@ -1,16 +1,4 @@
#region Usings
using Ionic.Zip;
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
#endregion

namespace NovetusLauncher
{
#region LocalVars
@ -22,801 +10,4 @@ namespace NovetusLauncher
public static bool LocalPlayMode = false;
}
#endregion
#region Downloader
class Downloader
{
private readonly string fileURL;
private readonly string fileName;
private readonly string fileFilter;
private string downloadOutcome;
private static string downloadOutcomeException;
public Downloader(string url, string name, string filter)
{
fileName = name;
fileURL = url;
fileFilter = filter;
}
public Downloader(string url, string name)
{
fileName = name;
fileURL = url;
fileFilter = "";
}
public void setDownloadOutcome(string text)
{
downloadOutcome = text;
}
public string getDownloadOutcome()
{
return downloadOutcome;
}
public void InitDownload(string path, string fileext, string additionalText = "")
{
string downloadOutcomeAddText = additionalText;
string outputfilename = fileName + fileext;
string fullpath = path + "\\" + outputfilename;
try
{
int read = DownloadFile(fileURL, fullpath);
downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
}
catch (Exception ex)
{
downloadOutcome = "Error when downloading file: " + ex.Message;
}
}
public void InitDownload(string additionalText = "")
{
string downloadOutcomeAddText = additionalText;
SaveFileDialog saveFileDialog1 = new SaveFileDialog
{
FileName = fileName,
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
Filter = fileFilter,
Title = "Save " + fileName
};
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
int read = DownloadFile(fileURL, saveFileDialog1.FileName);
downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
}
catch (Exception ex)
{
downloadOutcome = "Error when downloading file: " + ex.Message;
}
}
}
private static int DownloadFile(string remoteFilename, string localFilename)
{
//credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm)
//and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408)
// Function will return the number of bytes processed
// to the caller. Initialize to 0 here.
int bytesProcessed = 0;
// Assign values to these objects here so that they can
// be referenced in the finally block
Stream remoteStream = null;
Stream localStream = null;
WebResponse response = null;
// Use a try/catch/finally block as both the WebRequest and Stream
// classes throw exceptions upon error
//thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code!
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| (SecurityProtocolType)3072
| (SecurityProtocolType)768
| SecurityProtocolType.Ssl3;
// Create a request for the specified remote file name
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename);
request.UserAgent = "Roblox/WinINet";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
if (request != null)
{
// Send the request to the server and retrieve the
// WebResponse object
response = request.GetResponse();
if (response != null)
{
// Once the WebResponse object has been retrieved,
// get the stream object associated with the response's data
remoteStream = response.GetResponseStream();
// Create the local file
localStream = File.Create(localFilename);
// Allocate a 1k buffer
byte[] buffer = new byte[1024];
int bytesRead;
// Simple do/while loop to read from stream until
// no bytes are returned
do
{
// Read data (up to 1k) from the stream
bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
// Write the data to the local file
localStream.Write(buffer, 0, bytesRead);
// Increment total bytes processed
bytesProcessed += bytesRead;
} while (bytesRead > 0);
}
}
}
catch (Exception e)
{
downloadOutcomeException = " Exception detected: " + e.Message;
}
finally
{
// Close the response and streams objects here
// to make sure they're closed even if an exception
// is thrown at some point
if (response != null) response.Close();
if (remoteStream != null) remoteStream.Close();
if (localStream != null) localStream.Close();
}
// Return total bytes processed to caller.
return bytesProcessed;
}
}
#endregion
#region Addon Loader
public class AddonLoader
{
private readonly OpenFileDialog openFileDialog1;
private string installOutcome = "";
private int fileListDisplay = 0;
public AddonLoader()
{
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select an addon .zip file",
Filter = "Compressed zip files (*.zip)|*.zip",
Title = "Open addon .zip"
};
}
public void setInstallOutcome(string text)
{
installOutcome = text;
}
public string getInstallOutcome()
{
return installOutcome;
}
public void setFileListDisplay(int number)
{
fileListDisplay = number;
}
public void LoadAddon()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
int filecount = 0;
StringBuilder filelistbuilder = new StringBuilder();
using (Stream str = openFileDialog1.OpenFile())
{
using (var zipFile = ZipFile.Read(str))
{
ZipEntry[] entries = zipFile.Entries.ToArray();
foreach (ZipEntry entry in entries)
{
filelistbuilder.Append(entry.FileName + " (" + entry.UncompressedSize + ")");
filelistbuilder.Append(Environment.NewLine);
}
zipFile.ExtractAll(Directories.BasePath, ExtractExistingFileAction.OverwriteSilently);
}
}
string filelist = filelistbuilder.ToString();
if (filecount > fileListDisplay)
{
installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!";
}
else
{
installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist;
}
}
catch (Exception ex)
{
installOutcome = "Error when installing addon: " + ex.Message;
}
}
}
}
#endregion
#region Icon Loader
public class IconLoader
{
private OpenFileDialog openFileDialog1;
private string installOutcome = "";
public IconLoader()
{
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select an icon .png file",
Filter = "Portable Network Graphics image (*.png)|*.png",
Title = "Open icon .png"
};
}
public void setInstallOutcome(string text)
{
installOutcome = text;
}
public string getInstallOutcome()
{
return installOutcome;
}
public void LoadImage()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
using (Stream str = openFileDialog1.OpenFile())
{
using (Stream output = new FileStream(Directories.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName + ".png", FileMode.Create))
{
byte[] buffer = new byte[32 * 1024];
int read;
while ((read = str.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
}
str.Close();
}
installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!";
}
catch (Exception ex)
{
installOutcome = "Error when installing icon: " + ex.Message;
}
}
}
}
#endregion
#region Roblox Type Definitions
public class RobloxDefs
{
public static AssetCacheDef Fonts
{
get
{
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { Directories.AssetCacheDirFonts, Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheFontsGameDir, Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Sky
{
get
{
return new AssetCacheDef("Sky",
new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirSky },
new string[] { Directories.AssetCacheSkyGameDir });
}
}
public static AssetCacheDef Decal
{
get
{
return new AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Texture
{
get
{
return new AssetCacheDef("Texture",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef HopperBin
{
get
{ return new AssetCacheDef("HopperBin",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Tool
{
get
{
return new AssetCacheDef("Tool",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Sound
{
get
{
return new AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { Directories.AssetCacheDirSounds },
new string[] { Directories.AssetCacheSoundsGameDir });
}
}
public static AssetCacheDef ImageLabel
{
get
{
return new AssetCacheDef("ImageLabel",
new string[] { "Image" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Shirt
{
get
{
return new AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef ShirtGraphic
{
get
{
return new AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Pants
{
get
{
return new AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { Directories.AssetCacheDirTextures },
new string[] { Directories.AssetCacheTexturesGameDir });
}
}
public static AssetCacheDef Script
{
get
{
return new AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { Directories.AssetCacheDirScripts },
new string[] { Directories.AssetCacheScriptsGameDir });
}
}
public static AssetCacheDef LocalScript
{
get
{
return new AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { Directories.AssetCacheDirScripts },
new string[] { Directories.AssetCacheScriptsGameDir });
}
}
//item defs below
public static AssetCacheDef ItemHatFonts
{
get
{
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { Directories.hatdirFonts, Directories.hatdirTextures },
new string[] { Directories.hatGameDirFonts, Directories.hatGameDirTextures });
}
}
public static AssetCacheDef ItemHatSound
{
get
{
return new AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { Directories.hatdirSounds },
new string[] { Directories.hatGameDirSounds });
}
}
public static AssetCacheDef ItemHatScript
{
get
{
return new AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { Directories.hatdirScripts },
new string[] { Directories.hatGameDirScripts });
}
}
public static AssetCacheDef ItemHatLocalScript
{
get
{
return new AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { Directories.hatdirScripts },
new string[] { Directories.hatGameDirScripts });
}
}
public static AssetCacheDef ItemHeadFonts
{
get
{
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { Directories.headdirFonts, Directories.headdirTextures },
new string[] { Directories.headGameDirFonts, Directories.headGameDirTextures });
}
}
public static AssetCacheDef ItemFaceTexture
{
get
{
return new AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { Directories.facedirTextures },
new string[] { Directories.faceGameDirTextures });
}
}
public static AssetCacheDef ItemShirtTexture
{
get
{
return new AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { Directories.shirtdirTextures },
new string[] { Directories.shirtGameDirTextures });
}
}
public static AssetCacheDef ItemTShirtTexture
{
get
{
return new AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { Directories.tshirtdirTextures },
new string[] { Directories.tshirtGameDirTextures });
}
}
public static AssetCacheDef ItemPantsTexture
{
get
{
return new AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { Directories.pantsdirTextures },
new string[] { Directories.pantsGameDirTextures });
}
}
}
#endregion
#region Roblox XML Localizer
public static class RobloxXMLLocalizer
{
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, string name = "", string meshname = "")
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
}
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
}
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "")
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
try
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
select nodes;
foreach (var item in v)
{
var v2 = from nodes in item.Descendants("Content")
where nodes.Attribute("name").Value == itemIdValue
select nodes;
foreach (var item2 in v2)
{
var v3 = from nodes in item2.Descendants("url")
select nodes;
foreach (var item3 in v3)
{
if (!item3.Value.Contains("rbxassetid"))
{
if (!item3.Value.Contains("rbxasset"))
{
if (string.IsNullOrWhiteSpace(meshname))
{
string url = item3.Value;
string urlFixed = url.Replace("&amp;", "&").Replace("amp;", "&");
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{
if (urlFixed.Contains(peram))
{
string IDVal = urlFixed.After(peram);
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
item3.Value = inGameDir + IDVal + fileext;
}
}
else
{
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
item3.Value = inGameDir + name + fileext;
}
}
else
{
item3.Value = inGameDir + meshname;
}
}
}
else
{
if (string.IsNullOrWhiteSpace(meshname))
{
string url = item3.Value;
string rbxassetid = "rbxassetid://";
string urlFixed = "https://www.roblox.com/asset/?id=" + url.After(rbxassetid);
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{
if (urlFixed.Contains(peram))
{
string IDVal = urlFixed.After(peram);
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
item3.Value = inGameDir + IDVal + fileext;
}
}
else
{
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
item3.Value = inGameDir + name + fileext;
}
}
else
{
item3.Value = inGameDir + meshname;
}
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
doc.Save(filepath);
}
}
private static void DownloadFilesFromNode(string url, string path, string fileext, string id)
{
if (!string.IsNullOrWhiteSpace(id))
{
Downloader download = new Downloader(url, id);
try
{
download.InitDownload(path, fileext);
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
private static string RemoveInvalidXmlChars(string content)
{
return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray());
}
private static string ReplaceHexadecimalSymbols(string txt)
{
string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]";
return Regex.Replace(txt, r, "", RegexOptions.Compiled);
}
}
#endregion
#region Splash Reader
public static class SplashReader
{
private static string RandomSplash()
{
string[] splashes = File.ReadAllLines(Directories.ConfigDir + "\\splashes.txt");
string splash = "";
try
{
splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)];
}
catch (Exception)
{
try
{
splash = splashes[0];
}
catch (Exception)
{
splash = "missingno";
return splash;
}
}
CryptoRandom random = new CryptoRandom();
string formattedsplash = splash
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%nextversion%", (Convert.ToDouble(GlobalVars.ProgramInformation.Branch) + 0.1).ToString())
.Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, 32)));
return formattedsplash;
}
public static string GetSplash()
{
DateTime today = DateTime.Now;
string splash = "";
switch (today)
{
case DateTime christmaseve when christmaseve.Month.Equals(12) && christmaseve.Day.Equals(24):
case DateTime christmasday when christmasday.Month.Equals(12) && christmasday.Day.Equals(25):
splash = "Merry Christmas!";
break;
case DateTime newyearseve when newyearseve.Month.Equals(12) && newyearseve.Day.Equals(31):
case DateTime newyearsday when newyearsday.Month.Equals(1) && newyearsday.Day.Equals(1):
splash = "Happy New Year!";
break;
case DateTime halloween when halloween.Month.Equals(10) && halloween.Day.Equals(31):
splash = "Happy Halloween!";
break;
case DateTime bitlbirthday when bitlbirthday.Month.Equals(6) && bitlbirthday.Day.Equals(10):
splash = "Happy Birthday, Bitl!";
break;
case DateTime robloxbirthday when robloxbirthday.Month.Equals(8) && robloxbirthday.Day.Equals(27):
splash = "Happy Birthday, ROBLOX!";
break;
case DateTime novetusbirthday when novetusbirthday.Month.Equals(10) && novetusbirthday.Day.Equals(27):
splash = "Happy Birthday, Novetus!";
break;
case DateTime leiferikson when leiferikson.Month.Equals(10) && leiferikson.Day.Equals(9):
splash = "Happy Leif Erikson Day! HINGA DINGA DURGEN!";
break;
case DateTime smokeweedeveryday when smokeweedeveryday.Month.Equals(4) && smokeweedeveryday.Day.Equals(20):
CryptoRandom random = new CryptoRandom();
if (random.Next(0, 1) == 1)
{
splash = "smoke weed every day";
}
else
{
splash = "4/20 lol";
}
break;
case DateTime erikismyhero when erikismyhero.Month.Equals(2) && erikismyhero.Day.Equals(11):
splash = "RIP Erik Cassel";
break;
default:
splash = RandomSplash();
break;
}
return splash;
}
}
#endregion
}

View File

@ -0,0 +1,167 @@
#region Usings
using System;
using System.IO;
using System.Net;
using System.Windows.Forms;
#endregion
#region Downloader
class Downloader
{
private readonly string fileURL;
private readonly string fileName;
private readonly string fileFilter;
private string downloadOutcome;
private static string downloadOutcomeException;
public Downloader(string url, string name, string filter)
{
fileName = name;
fileURL = url;
fileFilter = filter;
}
public Downloader(string url, string name)
{
fileName = name;
fileURL = url;
fileFilter = "";
}
public void setDownloadOutcome(string text)
{
downloadOutcome = text;
}
public string getDownloadOutcome()
{
return downloadOutcome;
}
public void InitDownload(string path, string fileext, string additionalText = "")
{
string downloadOutcomeAddText = additionalText;
string outputfilename = fileName + fileext;
string fullpath = path + "\\" + outputfilename;
try
{
int read = DownloadFile(fileURL, fullpath);
downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
}
catch (Exception ex)
{
downloadOutcome = "Error when downloading file: " + ex.Message;
}
}
public void InitDownload(string additionalText = "")
{
string downloadOutcomeAddText = additionalText;
SaveFileDialog saveFileDialog1 = new SaveFileDialog
{
FileName = fileName,
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
Filter = fileFilter,
Title = "Save " + fileName
};
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
int read = DownloadFile(fileURL, saveFileDialog1.FileName);
downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
}
catch (Exception ex)
{
downloadOutcome = "Error when downloading file: " + ex.Message;
}
}
}
private static int DownloadFile(string remoteFilename, string localFilename)
{
//credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm)
//and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408)
// Function will return the number of bytes processed
// to the caller. Initialize to 0 here.
int bytesProcessed = 0;
// Assign values to these objects here so that they can
// be referenced in the finally block
Stream remoteStream = null;
Stream localStream = null;
WebResponse response = null;
// Use a try/catch/finally block as both the WebRequest and Stream
// classes throw exceptions upon error
//thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code!
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| (SecurityProtocolType)3072
| (SecurityProtocolType)768
| SecurityProtocolType.Ssl3;
// Create a request for the specified remote file name
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename);
request.UserAgent = "Roblox/WinINet";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
if (request != null)
{
// Send the request to the server and retrieve the
// WebResponse object
response = request.GetResponse();
if (response != null)
{
// Once the WebResponse object has been retrieved,
// get the stream object associated with the response's data
remoteStream = response.GetResponseStream();
// Create the local file
localStream = File.Create(localFilename);
// Allocate a 1k buffer
byte[] buffer = new byte[1024];
int bytesRead;
// Simple do/while loop to read from stream until
// no bytes are returned
do
{
// Read data (up to 1k) from the stream
bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
// Write the data to the local file
localStream.Write(buffer, 0, bytesRead);
// Increment total bytes processed
bytesProcessed += bytesRead;
} while (bytesRead > 0);
}
}
}
catch (Exception e)
{
downloadOutcomeException = " Exception detected: " + e.Message;
}
finally
{
// Close the response and streams objects here
// to make sure they're closed even if an exception
// is thrown at some point
if (response != null) response.Close();
if (remoteStream != null) remoteStream.Close();
if (localStream != null) localStream.Close();
}
// Return total bytes processed to caller.
return bytesProcessed;
}
}
#endregion

View File

@ -0,0 +1,439 @@
#region Usings
using NovetusLauncher;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
#endregion
#region Roblox File Types
public enum RobloxFileType
{
//RBXL and RBXM
RBXL,
RBXM,
//Items
Hat,
Head,
Face,
TShirt,
Shirt,
Pants
}
#endregion
#region Roblox Type Definitions
public struct RobloxDefs
{
public static VarStorage.AssetCacheDef Fonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.AssetCacheDirFonts, GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheFontsGameDir, GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Sky
{
get
{
return new VarStorage.AssetCacheDef("Sky",
new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirSky },
new string[] { GlobalPaths.AssetCacheSkyGameDir });
}
}
public static VarStorage.AssetCacheDef Decal
{
get
{
return new VarStorage.AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Texture
{
get
{
return new VarStorage.AssetCacheDef("Texture",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef HopperBin
{
get
{
return new VarStorage.AssetCacheDef("HopperBin",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Tool
{
get
{
return new VarStorage.AssetCacheDef("Tool",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Sound
{
get
{
return new VarStorage.AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { GlobalPaths.AssetCacheDirSounds },
new string[] { GlobalPaths.AssetCacheSoundsGameDir });
}
}
public static VarStorage.AssetCacheDef ImageLabel
{
get
{
return new VarStorage.AssetCacheDef("ImageLabel",
new string[] { "Image" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Shirt
{
get
{
return new VarStorage.AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef ShirtGraphic
{
get
{
return new VarStorage.AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Pants
{
get
{
return new VarStorage.AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
new string[] { GlobalPaths.AssetCacheTexturesGameDir });
}
}
public static VarStorage.AssetCacheDef Script
{
get
{
return new VarStorage.AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.AssetCacheDirScripts },
new string[] { GlobalPaths.AssetCacheScriptsGameDir });
}
}
public static VarStorage.AssetCacheDef LocalScript
{
get
{
return new VarStorage.AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.AssetCacheDirScripts },
new string[] { GlobalPaths.AssetCacheScriptsGameDir });
}
}
//item defs below
public static VarStorage.AssetCacheDef ItemHatFonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.hatdirFonts, GlobalPaths.hatdirTextures },
new string[] { GlobalPaths.hatGameDirFonts, GlobalPaths.hatGameDirTextures });
}
}
public static VarStorage.AssetCacheDef ItemHatSound
{
get
{
return new VarStorage.AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { GlobalPaths.hatdirSounds },
new string[] { GlobalPaths.hatGameDirSounds });
}
}
public static VarStorage.AssetCacheDef ItemHatScript
{
get
{
return new VarStorage.AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.hatdirScripts },
new string[] { GlobalPaths.hatGameDirScripts });
}
}
public static VarStorage.AssetCacheDef ItemHatLocalScript
{
get
{
return new VarStorage.AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.hatdirScripts },
new string[] { GlobalPaths.hatGameDirScripts });
}
}
public static VarStorage.AssetCacheDef ItemHeadFonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.headdirFonts, GlobalPaths.headdirTextures },
new string[] { GlobalPaths.headGameDirFonts, GlobalPaths.headGameDirTextures });
}
}
public static VarStorage.AssetCacheDef ItemFaceTexture
{
get
{
return new VarStorage.AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.facedirTextures },
new string[] { GlobalPaths.faceGameDirTextures });
}
}
public static VarStorage.AssetCacheDef ItemShirtTexture
{
get
{
return new VarStorage.AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.shirtdirTextures },
new string[] { GlobalPaths.shirtGameDirTextures });
}
}
public static VarStorage.AssetCacheDef ItemTShirtTexture
{
get
{
return new VarStorage.AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { GlobalPaths.tshirtdirTextures },
new string[] { GlobalPaths.tshirtGameDirTextures });
}
}
public static VarStorage.AssetCacheDef ItemPantsTexture
{
get
{
return new VarStorage.AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.pantsdirTextures },
new string[] { GlobalPaths.pantsGameDirTextures });
}
}
}
#endregion
#region Roblox XML Localizer
public static class RobloxXMLLocalizer
{
public static void DownloadFromNodes(string filepath, VarStorage.AssetCacheDef assetdef, string name = "", string meshname = "")
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
}
public static void DownloadFromNodes(string filepath, VarStorage.AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
}
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "")
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
try
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
select nodes;
foreach (var item in v)
{
var v2 = from nodes in item.Descendants("Content")
where nodes.Attribute("name").Value == itemIdValue
select nodes;
foreach (var item2 in v2)
{
var v3 = from nodes in item2.Descendants("url")
select nodes;
foreach (var item3 in v3)
{
if (!item3.Value.Contains("rbxassetid"))
{
if (!item3.Value.Contains("rbxasset"))
{
if (string.IsNullOrWhiteSpace(meshname))
{
string url = item3.Value;
string urlFixed = url.Replace("&amp;", "&").Replace("amp;", "&");
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{
if (urlFixed.Contains(peram))
{
string IDVal = urlFixed.After(peram);
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
item3.Value = inGameDir + IDVal + fileext;
}
}
else
{
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
item3.Value = inGameDir + name + fileext;
}
}
else
{
item3.Value = inGameDir + meshname;
}
}
}
else
{
if (string.IsNullOrWhiteSpace(meshname))
{
string url = item3.Value;
string rbxassetid = "rbxassetid://";
string urlFixed = "https://www.roblox.com/asset/?id=" + url.After(rbxassetid);
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{
if (urlFixed.Contains(peram))
{
string IDVal = urlFixed.After(peram);
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
item3.Value = inGameDir + IDVal + fileext;
}
}
else
{
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
item3.Value = inGameDir + name + fileext;
}
}
else
{
item3.Value = inGameDir + meshname;
}
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
doc.Save(filepath);
}
}
private static void DownloadFilesFromNode(string url, string path, string fileext, string id)
{
if (!string.IsNullOrWhiteSpace(id))
{
Downloader download = new Downloader(url, id);
try
{
download.InitDownload(path, fileext);
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
private static string RemoveInvalidXmlChars(string content)
{
return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray());
}
private static string ReplaceHexadecimalSymbols(string txt)
{
string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]";
return Regex.Replace(txt, r, "", RegexOptions.Compiled);
}
}
#endregion

View File

@ -0,0 +1,94 @@
#region Usings
using System;
using System.IO;
#endregion
#region Splash Reader
public static class SplashReader
{
private static string RandomSplash()
{
string[] splashes = File.ReadAllLines(GlobalPaths.ConfigDir + "\\splashes.txt");
string splash = "";
try
{
splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)];
}
catch (Exception)
{
try
{
splash = splashes[0];
}
catch (Exception)
{
splash = "missingno";
return splash;
}
}
CryptoRandom random = new CryptoRandom();
string formattedsplash = splash
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%nextversion%", (Convert.ToDouble(GlobalVars.ProgramInformation.Branch) + 0.1).ToString())
.Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, 32)));
return formattedsplash;
}
public static string GetSplash()
{
DateTime today = DateTime.Now;
string splash = "";
switch (today)
{
case DateTime christmaseve when christmaseve.Month.Equals(12) && christmaseve.Day.Equals(24):
case DateTime christmasday when christmasday.Month.Equals(12) && christmasday.Day.Equals(25):
splash = "Merry Christmas!";
break;
case DateTime newyearseve when newyearseve.Month.Equals(12) && newyearseve.Day.Equals(31):
case DateTime newyearsday when newyearsday.Month.Equals(1) && newyearsday.Day.Equals(1):
splash = "Happy New Year!";
break;
case DateTime halloween when halloween.Month.Equals(10) && halloween.Day.Equals(31):
splash = "Happy Halloween!";
break;
case DateTime bitlbirthday when bitlbirthday.Month.Equals(6) && bitlbirthday.Day.Equals(10):
splash = "Happy Birthday, Bitl!";
break;
case DateTime robloxbirthday when robloxbirthday.Month.Equals(8) && robloxbirthday.Day.Equals(27):
splash = "Happy Birthday, ROBLOX!";
break;
case DateTime novetusbirthday when novetusbirthday.Month.Equals(10) && novetusbirthday.Day.Equals(27):
splash = "Happy Birthday, Novetus!";
break;
case DateTime leiferikson when leiferikson.Month.Equals(10) && leiferikson.Day.Equals(9):
splash = "Happy Leif Erikson Day! HINGA DINGA DURGEN!";
break;
case DateTime smokeweedeveryday when smokeweedeveryday.Month.Equals(4) && smokeweedeveryday.Day.Equals(20):
CryptoRandom random = new CryptoRandom();
if (random.Next(0, 1) == 1)
{
splash = "smoke weed every day";
}
else
{
splash = "4/20 lol";
}
break;
case DateTime erikismyhero when erikismyhero.Month.Equals(2) && erikismyhero.Day.Equals(11):
splash = "RIP Erik Cassel";
break;
default:
splash = RandomSplash();
break;
}
return splash;
}
}
#endregion

View File

@ -0,0 +1,28 @@
#region Usings
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
#endregion
#region Form Extensions
public static class FormExt
{
[DllImport("user32")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32")]
public static extern bool EnableMenuItem(IntPtr hMenu, uint itemId, uint uEnable);
public static void DisableCloseButton(this Form form)
{
// The 1 parameter means to gray out. 0xF060 is SC_CLOSE.
EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 1);
}
public static void EnableCloseButton(this Form form)
{
// The zero parameter means to enable. 0xF060 is SC_CLOSE.
EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 0);
}
}
#endregion

View File

@ -0,0 +1,45 @@
#region Usings
using System;
using System.Windows.Forms;
#endregion
#region Tab Control without Header
//https://stackoverflow.com/questions/23247941/c-sharp-how-to-remove-tabcontrol-border
public partial class TabControlWithoutHeader : TabControl
{
int layoutval = 1;
public TabControlWithoutHeader(int layout)
{
SetLayout(layout);
}
public TabControlWithoutHeader()
{
SetLayout(1);
}
private void SetLayout(int layout)
{
layoutval = layout;
if (layoutval == 1)
{
if (!DesignMode) Multiline = true;
}
}
protected override void WndProc(ref Message m)
{
if (layoutval == 2)
{
base.WndProc(ref m);
return;
}
if (m.Msg == 0x1328 && !DesignMode)
m.Result = new IntPtr(1);
else
base.WndProc(ref m);
}
}
#endregion

View File

@ -0,0 +1,119 @@
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
#endregion
#region Tree Node Helper
public static class TreeNodeHelper
{
public static void ListDirectory(TreeView treeView, string path, string filter = ".*")
{
treeView.Nodes.Clear();
var rootDirectoryInfo = new DirectoryInfo(path);
treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo, filter));
}
public static TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo, string filter = ".*")
{
var directoryNode = new TreeNode(directoryInfo.Name);
foreach (var directory in directoryInfo.GetDirectories())
directoryNode.Nodes.Add(CreateDirectoryNode(directory, filter));
foreach (var file in directoryInfo.GetFiles("*" + filter))
directoryNode.Nodes.Add(new TreeNode(file.Name));
return directoryNode;
}
//https://stackoverflow.com/questions/42295131/searching-a-treeview-for-a-specific-string
public static TreeNode SearchTreeView(string p_sSearchTerm, TreeNodeCollection p_Nodes)
{
foreach (TreeNode node in p_Nodes)
{
if (node.Text == p_sSearchTerm)
return node;
if (node.Nodes.Count > 0)
{
TreeNode child = SearchTreeView(p_sSearchTerm, node.Nodes);
if (child != null)
{
return child;
}
}
}
return null;
}
public static string GetFolderNameFromPrefix(string source, string seperator = " -")
{
try
{
string result = source.Substring(0, source.IndexOf(seperator));
if (Directory.Exists(GlobalPaths.MapsDir + @"\\" + result))
{
return result + @"\\";
}
else
{
return "";
}
}
catch (Exception)
{
return "";
}
}
public static void CopyNodes(TreeNodeCollection oldcollection, TreeNodeCollection newcollection)
{
foreach (TreeNode node in oldcollection)
{
newcollection.Add((TreeNode)node.Clone());
}
}
public static List<TreeNode> GetAllNodes(this TreeView _self)
{
List<TreeNode> result = new List<TreeNode>();
foreach (TreeNode child in _self.Nodes)
{
result.AddRange(child.GetAllNodes());
}
return result;
}
public static List<TreeNode> GetAllNodes(this TreeNode _self)
{
List<TreeNode> result = new List<TreeNode>();
result.Add(_self);
foreach (TreeNode child in _self.Nodes)
{
result.AddRange(child.GetAllNodes());
}
return result;
}
public static List<TreeNode> Ancestors(this TreeNode node)
{
return AncestorsInternal(node).Reverse().ToList();
}
public static List<TreeNode> AncestorsAndSelf(this TreeNode node)
{
return AncestorsInternal(node, true).Reverse().ToList();
}
private static IEnumerable<TreeNode> AncestorsInternal(TreeNode node, bool self = false)
{
if (self)
yield return node;
while (node.Parent != null)
{
node = node.Parent;
yield return node;
}
}
}
#endregion

View File

@ -25,7 +25,7 @@ namespace NovetusLauncher
/// </summary>
public partial class MainForm_legacy : Form
{
DiscordRpc.EventHandlers handlers;
IDiscordRPC.EventHandlers handlers;
public MainForm_legacy()
{
@ -48,12 +48,12 @@ namespace NovetusLauncher
{
try
{
UPnP.InitUPnP(DeviceFound,DeviceLost);
NetFuncs.InitUPnP(DeviceFound,DeviceLost);
ConsolePrint("UPnP: Service initialized", 3);
}
catch (Exception ex)
{
ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2);
}
}
}
@ -64,7 +64,7 @@ namespace NovetusLauncher
{
try
{
UPnP.StartUPnP(device,protocol,port);
NetFuncs.StartUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -80,7 +80,7 @@ namespace NovetusLauncher
{
try
{
UPnP.StopUPnP(device,protocol,port);
NetFuncs.StopUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -149,7 +149,7 @@ namespace NovetusLauncher
{
}
public void RequestCallback(DiscordRpc.JoinRequest request)
public void RequestCallback(IDiscordRPC.JoinRequest request)
{
}
@ -157,14 +157,14 @@ namespace NovetusLauncher
{
if (GlobalVars.UserConfiguration.DiscordPresence)
{
handlers = new DiscordRpc.EventHandlers();
handlers = new IDiscordRPC.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true);
}
@ -179,7 +179,7 @@ namespace NovetusLauncher
{
try
{
GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort);
GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort);
ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3);
}
catch (Exception ex)
@ -272,7 +272,7 @@ namespace NovetusLauncher
textBox3.ScrollToCaret();
break;
case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]:
string mapdir = Directories.MapsDir;
string mapdir = GlobalPaths.MapsDir;
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
@ -283,7 +283,7 @@ namespace NovetusLauncher
listBox4.Items.Clear();
break;
case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]:
string clientdir = Directories.ClientDir;
string clientdir = GlobalPaths.ClientDir;
DirectoryInfo dinfo = new DirectoryInfo(clientdir);
DirectoryInfo[] Dirs = dinfo.GetDirectories();
foreach (DirectoryInfo dir in Dirs)
@ -299,8 +299,8 @@ namespace NovetusLauncher
listBox4.Items.Clear();
break;
case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]:
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox3.Items.AddRange(lines_server);
listBox4.Items.AddRange(lines_ports);
treeView1.Nodes.Clear();
@ -406,69 +406,69 @@ namespace NovetusLauncher
{
Text = "Novetus " + GlobalVars.ProgramInformation.Version;
ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4);
ConsolePrint("Novetus path: " + Directories.BasePath, 4);
if (File.Exists(Directories.RootPath + "\\changelog.txt"))
ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4);
if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt"))
{
richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt");
richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt");
}
else
{
ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2);
ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2);
}
if (File.Exists(Directories.RootPath + "\\credits.txt"))
if (File.Exists(GlobalPaths.RootPath + "\\credits.txt"))
{
richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt");
richTextBox3.Text = File.ReadAllText(GlobalPaths.RootPath + "\\credits.txt");
}
else
{
ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2);
ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\credits.txt not found.", 2);
}
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5);
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5);
WriteConfigValues();
}
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5);
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5);
WriteCustomizationValues();
}
if (!File.Exists(Directories.ConfigDir + "\\servers.txt"))
if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt"))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5);
File.Create(Directories.ConfigDir + "\\servers.txt").Dispose();
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5);
File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
}
if (!File.Exists(Directories.ConfigDir + "\\ports.txt"))
if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt"))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5);
File.Create(Directories.ConfigDir + "\\ports.txt").Dispose();
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5);
File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
}
if (!Directory.Exists(Directories.AssetCacheDirFonts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts))
{
Directory.CreateDirectory(Directories.AssetCacheDirFonts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts);
}
if (!Directory.Exists(Directories.AssetCacheDirSky))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSky))
{
Directory.CreateDirectory(Directories.AssetCacheDirSky);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky);
}
if (!Directory.Exists(Directories.AssetCacheDirSounds))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds))
{
Directory.CreateDirectory(Directories.AssetCacheDirSounds);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds);
}
if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI))
if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI))
{
Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI);
}
if (!Directory.Exists(Directories.AssetCacheDirScripts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts))
{
Directory.CreateDirectory(Directories.AssetCacheDirScripts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts);
}
label8.Text = Application.ProductVersion;
@ -492,7 +492,7 @@ namespace NovetusLauncher
}
if (GlobalVars.UserConfiguration.DiscordPresence)
{
DiscordRpc.Shutdown();
IDiscordRPC.Shutdown();
}
if (GlobalVars.IsWebServerOn)
{
@ -502,7 +502,7 @@ namespace NovetusLauncher
void ReadConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString();
@ -525,19 +525,19 @@ namespace NovetusLauncher
void WriteConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
ConsolePrint("Config Saved.", 3);
}
void WriteCustomizationValues()
{
LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
ConsolePrint("Config Saved.", 3);
}
void ReadClientValues(string ClientName)
{
string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
@ -697,21 +697,21 @@ namespace NovetusLauncher
void Button10Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
}
void Button11Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
}
void Button12Click(object sender, EventArgs e)
{
if (listBox3.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox3.SelectedItem.ToString() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp");
TextLineRemover.RemoveTextLines(new List<string> { listBox3.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp");
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
}
@ -720,42 +720,42 @@ namespace NovetusLauncher
{
if (listBox4.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox4.SelectedItem.ToString() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp");
TextLineRemover.RemoveTextLines(new List<string> { listBox4.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp");
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
}
void Button14Click(object sender, EventArgs e)
{
File.Create(Directories.ConfigDir + "\\servers.txt").Dispose();
File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
void Button15Click(object sender, EventArgs e)
{
File.Create(Directories.ConfigDir + "\\ports.txt").Dispose();
File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
void Button16Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
void Button17Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
@ -841,17 +841,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote;
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Client);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client);
args = "-script " + quote + luafile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
}
try
{
@ -947,17 +947,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Solo) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Solo);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Solo);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
}
try
{
@ -991,11 +991,11 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Server);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server);
args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote;
}
}
@ -1003,11 +1003,11 @@ namespace NovetusLauncher
{
if (!no3d)
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
}
}
try
@ -1043,17 +1043,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Studio) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Studio);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Studio);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<studio>", "</studio>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<studio>", "</studio>", mapfile, luafile, rbxexe);
}
try
{
@ -1081,24 +1081,24 @@ namespace NovetusLauncher
label12.Text = "<3";
string luafile = LauncherFuncs.GetLuaFileName();
string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg);
string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl";
string mapfile = GlobalPaths.ConfigDirData + "\\Appreciation.rbxl";
string quote = "\"";
string args = "";
if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%"))
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.EasterEgg) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.EasterEgg);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
}
try
{
@ -1238,7 +1238,7 @@ namespace NovetusLauncher
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe";
startInfo.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe";
startInfo.Arguments = "/regserver";
startInfo.Verb = "runas";
process.StartInfo = startInfo;
@ -1246,7 +1246,7 @@ namespace NovetusLauncher
Process process2 = new Process();
ProcessStartInfo startInfo2 = new ProcessStartInfo();
startInfo2.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe";
startInfo2.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe";
startInfo2.Arguments = "/regserver";
startInfo2.Verb = "runas";
process2.StartInfo = startInfo2;
@ -1296,7 +1296,7 @@ namespace NovetusLauncher
void Button23Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
}
void Button22Click(object sender, EventArgs e)
@ -1312,12 +1312,12 @@ namespace NovetusLauncher
{
GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString();
GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\");
GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip;
label28.Text = GlobalVars.UserConfiguration.Map;
if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
{
textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
}
else
{
@ -1328,7 +1328,7 @@ namespace NovetusLauncher
void Button6Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\"));
Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\",@"\"));
}
void CheckBox4CheckedChanged(object sender, EventArgs e)
@ -1345,14 +1345,14 @@ namespace NovetusLauncher
{
treeView1.Nodes.Clear();
_fieldsTreeCache.Nodes.Clear();
string mapdir = Directories.MapsDir;
string mapdir = GlobalPaths.MapsDir;
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes);
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
treeView1.Focus();
if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
{
textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
}
else
{
@ -1388,9 +1388,9 @@ namespace NovetusLauncher
private void button26_Click(object sender, EventArgs e)
{
if (Directory.Exists(Directories.AssetCacheDir))
if (Directory.Exists(GlobalPaths.AssetCacheDir))
{
Directory.Delete(Directories.AssetCacheDir, true);
Directory.Delete(GlobalPaths.AssetCacheDir, true);
ConsolePrint("Asset cache cleared!", 3);
MessageBox.Show("Asset cache cleared!");
}
@ -1516,7 +1516,7 @@ namespace NovetusLauncher
private void button36_Click(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Extended;
GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Extended;
WriteConfigValues();
Application.Restart();
}

View File

@ -18,17 +18,17 @@ namespace NovetusLauncher
void ReadConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
checkBox5.Checked = GlobalVars.UserConfiguration.ReShade;
checkBox6.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay;
checkBox7.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode;
switch (GlobalVars.UserConfiguration.GraphicsMode)
{
case GraphicsMode.DirectX:
case Settings.GraphicsOptions.Mode.DirectX:
comboBox1.SelectedIndex = 1;
break;
case GraphicsMode.OpenGL:
case Settings.GraphicsOptions.Mode.OpenGL:
default:
comboBox1.SelectedIndex = 0;
break;
@ -36,19 +36,19 @@ namespace NovetusLauncher
switch (GlobalVars.UserConfiguration.QualityLevel)
{
case QualityLevel.VeryLow:
case Settings.QualityOptions.Level.VeryLow:
comboBox2.SelectedIndex = 0;
break;
case QualityLevel.Low:
case Settings.QualityOptions.Level.Low:
comboBox2.SelectedIndex = 1;
break;
case QualityLevel.Medium:
case Settings.QualityOptions.Level.Medium:
comboBox2.SelectedIndex = 2;
break;
case QualityLevel.High:
case Settings.QualityOptions.Level.High:
comboBox2.SelectedIndex = 3;
break;
case QualityLevel.Ultra:
case Settings.QualityOptions.Level.Ultra:
default:
comboBox2.SelectedIndex = 4;
break;
@ -75,10 +75,10 @@ namespace NovetusLauncher
switch (comboBox1.SelectedIndex)
{
case 1:
GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX;
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.DirectX;
break;
default:
GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL;
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL;
break;
}
}
@ -88,20 +88,20 @@ namespace NovetusLauncher
switch (comboBox2.SelectedIndex)
{
case 0:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.VeryLow;
break;
case 1:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Low;
break;
case 2:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Medium;
break;
case 3:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.High;
break;
case 4:
default:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra;
break;
}
}

View File

@ -24,7 +24,7 @@ namespace NovetusLauncher
/// </summary>
public partial class MainForm : Form
{
DiscordRpc.EventHandlers handlers;
IDiscordRPC.EventHandlers handlers;
public MainForm()
{
@ -49,12 +49,12 @@ namespace NovetusLauncher
{
try
{
UPnP.InitUPnP(DeviceFound,DeviceLost);
NetFuncs.InitUPnP(DeviceFound,DeviceLost);
ConsolePrint("UPnP: Service initialized", 3);
}
catch (Exception ex)
{
ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2);
}
}
}
@ -65,7 +65,7 @@ namespace NovetusLauncher
{
try
{
UPnP.StartUPnP(device,protocol,port);
NetFuncs.StartUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -81,7 +81,7 @@ namespace NovetusLauncher
{
try
{
UPnP.StopUPnP(device,protocol,port);
NetFuncs.StopUPnP(device,protocol,port);
ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
}
catch (Exception ex)
@ -150,7 +150,7 @@ namespace NovetusLauncher
{
}
public void RequestCallback(DiscordRpc.JoinRequest request)
public void RequestCallback(IDiscordRPC.JoinRequest request)
{
}
@ -158,14 +158,14 @@ namespace NovetusLauncher
{
if (GlobalVars.UserConfiguration.DiscordPresence)
{
handlers = new DiscordRpc.EventHandlers();
handlers = new IDiscordRPC.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true);
}
@ -180,7 +180,7 @@ namespace NovetusLauncher
{
try
{
GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort);
GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort);
ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3);
}
catch (Exception ex)
@ -273,7 +273,7 @@ namespace NovetusLauncher
textBox3.ScrollToCaret();
break;
case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]:
string mapdir = Directories.MapsDir;
string mapdir = GlobalPaths.MapsDir;
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
@ -284,7 +284,7 @@ namespace NovetusLauncher
listBox4.Items.Clear();
break;
case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]:
string clientdir = Directories.ClientDir;
string clientdir = GlobalPaths.ClientDir;
DirectoryInfo dinfo = new DirectoryInfo(clientdir);
DirectoryInfo[] Dirs = dinfo.GetDirectories();
foreach (DirectoryInfo dir in Dirs)
@ -300,8 +300,8 @@ namespace NovetusLauncher
listBox4.Items.Clear();
break;
case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]:
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox3.Items.AddRange(lines_server);
listBox4.Items.AddRange(lines_ports);
treeView1.Nodes.Clear();
@ -407,69 +407,69 @@ namespace NovetusLauncher
{
Text = "Novetus " + GlobalVars.ProgramInformation.Version;
ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4);
ConsolePrint("Novetus path: " + Directories.BasePath, 4);
if (File.Exists(Directories.RootPath + "\\changelog.txt"))
ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4);
if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt"))
{
richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt");
richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt");
}
else
{
ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2);
ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2);
}
if (File.Exists(Directories.RootPath + "\\credits.txt"))
if (File.Exists(GlobalPaths.RootPath + "\\credits.txt"))
{
richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt");
richTextBox3.Text = File.ReadAllText(GlobalPaths.RootPath + "\\credits.txt");
}
else
{
ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2);
ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\credits.txt not found.", 2);
}
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5);
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5);
WriteConfigValues();
}
if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5);
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5);
WriteCustomizationValues();
}
if (!File.Exists(Directories.ConfigDir + "\\servers.txt"))
if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt"))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5);
File.Create(Directories.ConfigDir + "\\servers.txt").Dispose();
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5);
File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
}
if (!File.Exists(Directories.ConfigDir + "\\ports.txt"))
if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt"))
{
ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5);
File.Create(Directories.ConfigDir + "\\ports.txt").Dispose();
ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5);
File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
}
if (!Directory.Exists(Directories.AssetCacheDirFonts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts))
{
Directory.CreateDirectory(Directories.AssetCacheDirFonts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts);
}
if (!Directory.Exists(Directories.AssetCacheDirSky))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSky))
{
Directory.CreateDirectory(Directories.AssetCacheDirSky);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky);
}
if (!Directory.Exists(Directories.AssetCacheDirSounds))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds))
{
Directory.CreateDirectory(Directories.AssetCacheDirSounds);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds);
}
if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI))
if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI))
{
Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI);
}
if (!Directory.Exists(Directories.AssetCacheDirScripts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts))
{
Directory.CreateDirectory(Directories.AssetCacheDirScripts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts);
}
label8.Text = Application.ProductVersion;
@ -493,7 +493,7 @@ namespace NovetusLauncher
}
if (GlobalVars.UserConfiguration.DiscordPresence)
{
DiscordRpc.Shutdown();
IDiscordRPC.Shutdown();
}
if (GlobalVars.IsWebServerOn)
{
@ -503,7 +503,7 @@ namespace NovetusLauncher
void ReadConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString();
@ -525,10 +525,10 @@ namespace NovetusLauncher
switch (GlobalVars.UserConfiguration.GraphicsMode)
{
case GraphicsMode.DirectX:
case Settings.GraphicsOptions.Mode.DirectX:
comboBox1.SelectedIndex = 1;
break;
case GraphicsMode.OpenGL:
case Settings.GraphicsOptions.Mode.OpenGL:
default:
comboBox1.SelectedIndex = 0;
break;
@ -536,19 +536,19 @@ namespace NovetusLauncher
switch (GlobalVars.UserConfiguration.QualityLevel)
{
case QualityLevel.VeryLow:
case Settings.QualityOptions.Level.VeryLow:
comboBox2.SelectedIndex = 0;
break;
case QualityLevel.Low:
case Settings.QualityOptions.Level.Low:
comboBox2.SelectedIndex = 1;
break;
case QualityLevel.Medium:
case Settings.QualityOptions.Level.Medium:
comboBox2.SelectedIndex = 2;
break;
case QualityLevel.High:
case Settings.QualityOptions.Level.High:
comboBox2.SelectedIndex = 3;
break;
case QualityLevel.Ultra:
case Settings.QualityOptions.Level.Ultra:
default:
comboBox2.SelectedIndex = 4;
break;
@ -560,19 +560,19 @@ namespace NovetusLauncher
void WriteConfigValues()
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
ConsolePrint("Config Saved.", 3);
}
void WriteCustomizationValues()
{
LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
ConsolePrint("Config Saved.", 3);
}
void ReadClientValues(string ClientName)
{
string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
@ -732,21 +732,21 @@ namespace NovetusLauncher
void Button10Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
}
void Button11Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
}
void Button12Click(object sender, EventArgs e)
{
if (listBox3.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox3.SelectedItem.ToString() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp");
TextLineRemover.RemoveTextLines(new List<string> { listBox3.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp");
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
}
@ -755,42 +755,42 @@ namespace NovetusLauncher
{
if (listBox4.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox4.SelectedItem.ToString() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp");
TextLineRemover.RemoveTextLines(new List<string> { listBox4.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp");
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
}
void Button14Click(object sender, EventArgs e)
{
File.Create(Directories.ConfigDir + "\\servers.txt").Dispose();
File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
void Button15Click(object sender, EventArgs e)
{
File.Create(Directories.ConfigDir + "\\ports.txt").Dispose();
File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
void Button16Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt");
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
void Button17Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt");
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
@ -876,17 +876,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote;
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Client);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client);
args = "-script " + quote + luafile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
}
try
{
@ -982,17 +982,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Solo) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Solo);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Solo);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
}
try
{
@ -1026,11 +1026,11 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Server);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server);
args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote;
}
}
@ -1038,11 +1038,11 @@ namespace NovetusLauncher
{
if (!no3d)
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<server>", "</server>", mapfile, luafile, rbxexe);
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<no3d>", "</no3d>", mapfile, luafile, rbxexe);
}
}
try
@ -1078,17 +1078,17 @@ namespace NovetusLauncher
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Studio) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Studio);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Studio);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<studio>", "</studio>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<studio>", "</studio>", mapfile, luafile, rbxexe);
}
try
{
@ -1116,24 +1116,24 @@ namespace NovetusLauncher
label12.Text = "<3";
string luafile = LauncherFuncs.GetLuaFileName();
string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg);
string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl";
string mapfile = GlobalPaths.ConfigDirData + "\\Appreciation.rbxl";
string quote = "\"";
string args = "";
if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%"))
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote;
args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.EasterEgg) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.EasterEgg);
args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<solo>", "</solo>", mapfile, luafile, rbxexe);
}
try
{
@ -1273,7 +1273,7 @@ namespace NovetusLauncher
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe";
startInfo.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe";
startInfo.Arguments = "/regserver";
startInfo.Verb = "runas";
process.StartInfo = startInfo;
@ -1281,7 +1281,7 @@ namespace NovetusLauncher
Process process2 = new Process();
ProcessStartInfo startInfo2 = new ProcessStartInfo();
startInfo2.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe";
startInfo2.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe";
startInfo2.Arguments = "/regserver";
startInfo2.Verb = "runas";
process2.StartInfo = startInfo2;
@ -1331,7 +1331,7 @@ namespace NovetusLauncher
void Button23Click(object sender, EventArgs e)
{
File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
}
void Button22Click(object sender, EventArgs e)
@ -1347,12 +1347,12 @@ namespace NovetusLauncher
{
GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString();
GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\");
GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip;
label28.Text = GlobalVars.UserConfiguration.Map;
if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
{
textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
}
else
{
@ -1363,7 +1363,7 @@ namespace NovetusLauncher
void Button6Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\"));
Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\",@"\"));
}
void CheckBox4CheckedChanged(object sender, EventArgs e)
@ -1380,14 +1380,14 @@ namespace NovetusLauncher
{
treeView1.Nodes.Clear();
_fieldsTreeCache.Nodes.Clear();
string mapdir = Directories.MapsDir;
string mapdir = GlobalPaths.MapsDir;
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes);
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
treeView1.Focus();
if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
{
textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt");
}
else
{
@ -1423,9 +1423,9 @@ namespace NovetusLauncher
private void button26_Click(object sender, EventArgs e)
{
if (Directory.Exists(Directories.AssetCacheDir))
if (Directory.Exists(GlobalPaths.AssetCacheDir))
{
Directory.Delete(Directories.AssetCacheDir, true);
Directory.Delete(GlobalPaths.AssetCacheDir, true);
ConsolePrint("Asset cache cleared!", 3);
MessageBox.Show("Asset cache cleared!");
}
@ -1541,10 +1541,10 @@ namespace NovetusLauncher
switch (comboBox1.SelectedIndex)
{
case 1:
GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX;
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.DirectX;
break;
default:
GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL;
GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL;
break;
}
}
@ -1554,27 +1554,27 @@ namespace NovetusLauncher
switch (comboBox2.SelectedIndex)
{
case 0:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.VeryLow;
break;
case 1:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Low;
break;
case 2:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Medium;
break;
case 3:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.High;
break;
case 4:
default:
GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra;
GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra;
break;
}
}
private void button36_Click(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Compact;
GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Compact;
WriteConfigValues();
Application.Restart();
}

View File

@ -134,7 +134,17 @@
<Compile Include="CharacterCustomization\CharacterCustomization.Designer.cs">
<DependentUpon>CharacterCustomization.cs</DependentUpon>
</Compile>
<Compile Include="Classes\AddonLoader.cs" />
<Compile Include="Classes\CharCustom\IconLoader.cs" />
<Compile Include="Classes\SDK\Downloader.cs" />
<Compile Include="Classes\SDK\RobloxXMLLocalizer.cs" />
<Compile Include="Classes\SplashLoader.cs" />
<Compile Include="Classes\WinForms\FormExt.cs" />
<Compile Include="Classes\LocalVars.cs" />
<Compile Include="Classes\WinForms\TabControlWithoutHeader.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Classes\WinForms\TreeNodeHelper.cs" />
<Compile Include="MainForm\Compact\MainForm_legacy.cs">
<SubType>Form</SubType>
</Compile>
@ -296,6 +306,7 @@
<ItemGroup>
<Content Include="NovetusIcon.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="..\NovetusFuncs\NovetusFuncs.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>

View File

@ -29,13 +29,13 @@ namespace NovetusLauncher
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName);
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalVars.InfoName);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
if (args.Length == 0)
{
switch (GlobalVars.UserConfiguration.LauncherLayout)
{
case LauncherLayout.Compact:
case Settings.UIOptions.Style.Compact:
Application.Run(new MainForm_legacy());
break;
default:

View File

@ -70,9 +70,9 @@ namespace NovetusLauncher
comboBox1.SelectedItem = "RBXL";
comboBox2.SelectedItem = "None";
if (Directory.Exists(Directories.hatdirFonts))
if (Directory.Exists(GlobalPaths.hatdirFonts))
{
DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdirFonts);
DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdirFonts);
FileInfo[] Files = dinfo.GetFiles("*.mesh");
foreach (FileInfo file in Files)
{
@ -85,29 +85,29 @@ namespace NovetusLauncher
}
}
if (!Directory.Exists(Directories.AssetCacheDirFonts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts))
{
Directory.CreateDirectory(Directories.AssetCacheDirFonts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts);
}
if (!Directory.Exists(Directories.AssetCacheDirSky))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSky))
{
Directory.CreateDirectory(Directories.AssetCacheDirSky);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky);
}
if (!Directory.Exists(Directories.AssetCacheDirSounds))
if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds))
{
Directory.CreateDirectory(Directories.AssetCacheDirSounds);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds);
}
if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI))
if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI))
{
Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI);
}
if (!Directory.Exists(Directories.AssetCacheDirScripts))
if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts))
{
Directory.CreateDirectory(Directories.AssetCacheDirScripts);
Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts);
}
}

View File

@ -31,7 +31,7 @@ namespace NovetusLauncher
void ClientScriptDocumentationLoad(object sender, EventArgs e)
{
richTextBox1.Text = File.ReadAllText(Directories.BasePath + "\\documentation.txt");
richTextBox1.Text = File.ReadAllText(GlobalPaths.BasePath + "\\documentation.txt");
}
}
}

View File

@ -18,7 +18,7 @@ namespace NovetusLauncher
/// </summary>
public partial class ClientinfoEditor : Form
{
private ClientInfo loadedClientInfo = new ClientInfo();
private FileFormat.ClientInfo loadedClientInfo = new FileFormat.ClientInfo();
private string SelectedClientInfoPath = "";
private bool Locked = false;
private bool IsVersion2 = false;

View File

@ -41,7 +41,7 @@ namespace NovetusLauncher
private void NovetusSDK_Close(object sender, CancelEventArgs e)
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
@ -70,14 +70,14 @@ namespace NovetusLauncher
break;
case 6:
Process proc = new Process();
proc.StartInfo.FileName = Directories.ConfigDirData + "\\RSG.exe";
proc.StartInfo.FileName = GlobalPaths.ConfigDirData + "\\RSG.exe";
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.UseShellExecute = false;
proc.Start();
break;
case 7:
Process proc2 = new Process();
proc2.StartInfo.FileName = Directories.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe";
proc2.StartInfo.FileName = GlobalPaths.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe";
proc2.StartInfo.CreateNoWindow = false;
proc2.StartInfo.UseShellExecute = false;
proc2.Start();

View File

@ -25,7 +25,7 @@ namespace NovetusLauncher
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
ProcessOBJ(Directories.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName);
ProcessOBJ(GlobalPaths.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName);
}
}

View File

@ -0,0 +1,95 @@
#region Usings
using Microsoft.Win32;
using System;
using System.Windows.Forms;
#endregion
#region URI Registration
//code based off https://stackoverflow.com/questions/35626050/registering-custom-url-handler-in-c-sharp-on-windows-8
public class URIReg
{
private static string _Protocol = "";
private static string _ProtocolHandler = "";
private static readonly string _launch = string.Format(
"{0}{1}{0} {0}%1{0}", (char)34, Application.ExecutablePath);
private static readonly Version _win8Version = new Version(6, 2, 9200, 0);
private static readonly bool _isWin8 =
Environment.OSVersion.Platform == PlatformID.Win32NT &&
Environment.OSVersion.Version >= _win8Version;
public URIReg(string protocol, string protocolhandle)
{
_Protocol = protocol;
_ProtocolHandler = protocolhandle;
}
public void Register()
{
if (_isWin8) RegisterWin8();
else RegisterWin7();
}
private static void RegisterWin7()
{
var regKey = Registry.ClassesRoot.CreateSubKey(_Protocol);
regKey.CreateSubKey("DefaultIcon")
.SetValue(null, string.Format("{0}{1},1{0}", (char)34,
Application.ExecutablePath));
regKey.SetValue(null, "URL:" + _Protocol + " Protocol");
regKey.SetValue("URL Protocol", "");
regKey = regKey.CreateSubKey(@"shell\open\command");
regKey.SetValue(null, _launch);
}
private static void RegisterWin8()
{
RegisterWin7();
var regKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes")
.CreateSubKey(_ProtocolHandler);
regKey.SetValue(null, _Protocol);
regKey.CreateSubKey("DefaultIcon")
.SetValue(null, string.Format("{0}{1},1{0}", (char)34,
Application.ExecutablePath));
regKey.CreateSubKey(@"shell\open\command").SetValue(null, _launch);
Registry.LocalMachine.CreateSubKey(string.Format(
@"SOFTWARE\{0}\{1}\Capabilities\ApplicationDescription\URLAssociations",
Application.CompanyName, Application.ProductName))
.SetValue(_Protocol, _ProtocolHandler);
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications")
.SetValue(Application.ProductName, string.Format(
@"SOFTWARE\{0}\Capabilities", Application.ProductName));
}
public void Unregister()
{
if (!_isWin8)
{
Registry.ClassesRoot.DeleteSubKeyTree(_Protocol, false);
return;
}
// extra work required.
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes")
.DeleteSubKeyTree(_ProtocolHandler, false);
Registry.LocalMachine.DeleteSubKeyTree(string.Format(@"SOFTWARE\{0}\{1}",
Application.CompanyName, Application.ProductName));
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications")
.DeleteValue(Application.ProductName);
}
}
#endregion

View File

@ -85,6 +85,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Classes\URIReg.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -21,7 +21,7 @@ namespace NovetusURI
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false);
if (args.Length == 0)
{
Application.Run(new Form1());

View File

@ -20,7 +20,7 @@ namespace NovetusURI
/// </summary>
public partial class LoaderForm : Form
{
DiscordRpc.EventHandlers handlers;
IDiscordRPC.EventHandlers handlers;
public LoaderForm()
{
@ -54,7 +54,7 @@ namespace NovetusURI
{
}
public void RequestCallback(DiscordRpc.JoinRequest request)
public void RequestCallback(IDiscordRPC.JoinRequest request)
{
}
@ -69,14 +69,14 @@ namespace NovetusURI
{
if (GlobalVars.UserConfiguration.DiscordPresence)
{
handlers = new DiscordRpc.EventHandlers();
handlers = new IDiscordRPC.EventHandlers();
handlers.readyCallback = ReadyCallback;
handlers.disconnectedCallback += DisconnectedCallback;
handlers.errorCallback += ErrorCallback;
handlers.joinCallback += JoinCallback;
handlers.spectateCallback += SpectateCallback;
handlers.requestCallback += RequestCallback;
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
LauncherFuncs.UpdateRichPresence(LauncherState.LoadingURI, "", true);
}
@ -101,16 +101,16 @@ namespace NovetusURI
}
else
{
luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua";
}
string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode == true)
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe";
}
else
{
rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe";
}
string quote = "\"";
string args = "";
@ -118,17 +118,17 @@ namespace NovetusURI
{
if (!GlobalVars.SelectedClientInfo.Fix2007)
{
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote;
args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote;
}
else
{
ScriptGenerator.GenerateScriptForClient(ScriptType.Client);
ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client);
args = "-script " + quote + luafile + quote;
}
}
else
{
args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "<client>", "</client>", "", luafile, rbxexe);
}
try
{
@ -209,7 +209,7 @@ namespace NovetusURI
void ReadClientValues(string ClientName)
{
string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{

View File

@ -33,7 +33,7 @@ namespace NovetusURI
void QuickConfigureLoad(object sender, EventArgs e)
{
ReadConfigValues(Directories.ConfigDir + "\\" + GlobalVars.ConfigName);
ReadConfigValues(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName);
}
void Button3Click(object sender, EventArgs e)
@ -93,7 +93,7 @@ namespace NovetusURI
void QuickConfigureClose(object sender, CancelEventArgs e)
{
LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true);
LocalVars.ReadyToLaunch = true;
}
}