Ejemplo n.º 1
0
        public void InstallAddon()
        {
            AddonLoader addon = new AddonLoader();

            addon.setFileListDisplay(10);
            try
            {
                addon.LoadAddon();
                if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
                {
                    GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 3, ConsoleBox);
                }
            }
            catch (Exception)
            {
                if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
                {
                    GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 2, ConsoleBox);
                }
            }

            if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
            {
                MessageBox.Show(addon.getInstallOutcome());
            }
        }
Ejemplo n.º 2
0
        public void LoadLauncher()
        {
            NovetusSDK im = new NovetusSDK();

            im.Show();
            GlobalFuncs.ConsolePrint("Novetus SDK Launcher Loaded.", 4, ConsoleBox);
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            _handler += new EventHandler(CloseHandler);
            SetConsoleCtrlHandler(_handler, true);

            var config  = new NLog.Config.LoggingConfiguration();
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = GlobalPaths.ConfigDir + "\\CMD-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log"
            };

            config.AddRuleForAllLevels(logfile);
            LogManager.Configuration = config;

            LoadCMDArgs(args);

            if (!LocalVars.PrintHelp)
            {
                GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true,
                                         GlobalPaths.RootPathLauncher + "\\Novetus.exe");
                GlobalFuncs.TurnOffInitialSequence();
                Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";

                GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);
                GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1);

                GlobalFuncs.ConsolePrint("NovetusCMD is now loading main server configurations from the INI file.", 5);

                if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName))
                {
                    GlobalFuncs.ConsolePrint("WARNING 2 - " + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5);
                    WriteConfigValues();
                }

                ReadConfigValues(true);
                LoadOverrideINIArgs(args);
                InitUPnP();

                GlobalFuncs.ConsolePrint("Launching a " + GlobalVars.UserConfiguration.SelectedClient + " server on " + GlobalVars.UserConfiguration.Map + " with " + GlobalVars.UserConfiguration.PlayerLimit + " players.", 1);

                switch (LocalVars.DebugMode)
                {
                case true:
                    GlobalFuncs.CreateTXT();
                    break;

                case false:
                default:
                    StartServer(LocalVars.StartInNo3D);
                    break;
                }
            }
            else
            {
                LocalFuncs.CommandInfo();
            }

            Console.ReadKey();
        }
Ejemplo n.º 4
0
        public void InitForm()
        {
            Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version;
            GlobalFuncs.ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4, ConsoleBox);
            GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4, ConsoleBox);

            if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt"))
            {
                ChangelogBox.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt");
            }
            else
            {
                GlobalFuncs.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2, ConsoleBox);
            }

            if (File.Exists(GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT"))
            {
                ReadmeBox.Text = File.ReadAllText(GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT");
            }
            else
            {
                GlobalFuncs.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT not found.", 2, ConsoleBox);
            }

            if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName))
            {
                GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5, ConsoleBox);
                WriteConfigValues();
            }
            if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization))
            {
                GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization + " not found. Creating one with default values.", 5, ConsoleBox);
                WriteCustomizationValues();
            }
            if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt"))
            {
                GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5, ConsoleBox);
                File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
            }
            if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt"))
            {
                GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5, ConsoleBox);
                File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
            }

            GlobalFuncs.CreateAssetCacheDirectories();

            ProductVersionLabel.Text = Application.ProductVersion;
            LocalVars.important      = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location);
            NovetusVersionLabel.Text = GlobalVars.ProgramInformation.Version;

            SplashLabel.Text     = SplashReader.GetSplash();
            LocalVars.prevsplash = SplashLabel.Text;

            ReadConfigValues(true);
            InitUPnP();
            StartDiscord();
        }
Ejemplo n.º 5
0
 public void WriteConfigValues(bool ShowBox = false)
 {
     GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
     GlobalFuncs.ReadClientValues(ConsoleBox);
     GlobalFuncs.ConsolePrint("Config Saved.", 3, ConsoleBox);
     if (ShowBox)
     {
         MessageBox.Show("Config Saved!");
     }
 }
Ejemplo n.º 6
0
 public void ClearAssetCache()
 {
     if (Directory.Exists(GlobalPaths.AssetCacheDir))
     {
         Directory.Delete(GlobalPaths.AssetCacheDir, true);
         GlobalFuncs.ConsolePrint("Asset cache cleared!", 3, ConsoleBox);
         MessageBox.Show("Asset cache cleared!");
     }
     else
     {
         MessageBox.Show("There is no asset cache to clear.");
     }
 }
Ejemplo n.º 7
0
 public void DeviceLost(object sender, DeviceEventArgs args)
 {
     try
     {
         INatDevice device = args.Device;
         string     IP     = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
         GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3, ConsoleBox);
         StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
         StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
     }
     catch (Exception ex)
     {
         GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox);
     }
 }
Ejemplo n.º 8
0
 private static void DeviceFound(object sender, DeviceEventArgs args)
 {
     try
     {
         INatDevice device = args.Device;
         string     IP     = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
         GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3);
         StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
         StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
     }
     catch (Exception ex)
     {
         GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2);
     }
 }
Ejemplo n.º 9
0
 public static void InitUPnP()
 {
     if (GlobalVars.UserConfiguration.UPnP)
     {
         try
         {
             NetFuncs.InitUPnP(DeviceFound, DeviceLost);
             GlobalFuncs.ConsolePrint("UPnP: Service initialized", 3);
         }
         catch (Exception ex)
         {
             GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
         }
     }
 }
Ejemplo n.º 10
0
 public static void StopUPnP(INatDevice device, Protocol protocol, int port)
 {
     if (GlobalVars.UserConfiguration.UPnP)
     {
         try
         {
             NetFuncs.StopUPnP(device, protocol, port);
             string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
             GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3);
         }
         catch (Exception ex)
         {
             GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2);
         }
     }
 }
Ejemplo n.º 11
0
        static void LoadCMDArgs(string[] args)
        {
            if (args.Length > 0)
            {
                CommandLineArguments.Arguments CommandLine = new CommandLineArguments.Arguments(args);

                if (CommandLine["help"] != null)
                {
                    LocalVars.PrintHelp = true;
                }

                if (CommandLine["no3d"] != null)
                {
                    LocalVars.StartInNo3D = true;
                    GlobalFuncs.ConsolePrint("NovetusCMD will now launch the server in No3D mode.", 4);
                    GlobalFuncs.ConsolePrint("Launching the server without graphics enables better performance. " +
                                             "However, launching the server with no graphics may cause some elements in later clients may be disabled, such as Dialog boxes." +
                                             "This feature may also make your server unstable.", 5);
                }

                if (CommandLine["outputinfo"] != null)
                {
                    GlobalVars.RequestToOutputInfo = true;
                }

                if (CommandLine["debug"] != null)
                {
                    LocalVars.DebugMode = true;
                }

                if (CommandLine["script"] != null)
                {
                    if (CommandLine["script"].Contains("rbxasset:") || CommandLine["script"].Contains("http:"))
                    {
                        GlobalPaths.AddonScriptPath = CommandLine["script"].Replace(@"\", @"\\");
                        GlobalFuncs.ConsolePrint("NovetusCMD detected a custom script. Loading " + GlobalPaths.AddonScriptPath, 4);
                    }
                    else
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD cannot load '" + CommandLine["script"] + "' as it doesn't use a rbxasset path or URL.", 2);
                    }
                }
            }
        }
Ejemplo n.º 12
0
 static void StopWebServer()
 {
     if (SecurityFuncs.IsElevated)
     {
         try
         {
             GlobalFuncs.ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2);
             GlobalVars.WebServer.Stop();
         }
         catch (Exception ex)
         {
             GlobalFuncs.ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2);
         }
     }
     else
     {
         GlobalFuncs.ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (Did not run as Administrator)", 2);
     }
 }
Ejemplo n.º 13
0
 static void StartWebServer()
 {
     if (SecurityFuncs.IsElevated)
     {
         try
         {
             GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.DataPath, GlobalVars.UserConfiguration.WebServerPort);
             GlobalFuncs.ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3);
         }
         catch (Exception ex)
         {
             GlobalFuncs.ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2);
         }
     }
     else
     {
         GlobalFuncs.ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (Did not run as Administrator)", 2);
     }
 }
Ejemplo n.º 14
0
 public void ConsoleHelp()
 {
     GlobalFuncs.ConsolePrint("Help:", 3, ConsoleBox);
     GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
     GlobalFuncs.ConsolePrint("= client | Launches client with launcher settings", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= solo | Launches client in Play Solo mode with launcher settings", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= server 3d | Launches server with launcher settings", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= server no3d | Launches server in NoGraphics mode with launcher settings", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= studio map | Launches Roblox Studio with the selected map", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= studio nomap | Launches Roblox Studio without the selected map", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= sdk | Launches the Novetus SDK Launcher", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
     GlobalFuncs.ConsolePrint("= config save | Saves the config file", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= config load | Reloads the config file", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= config reset | Resets the config file", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
     GlobalFuncs.ConsolePrint("= dlldelete off | Turn off the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("= dlldelete on | Turn on the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox);
     GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
 }
Ejemplo n.º 15
0
        static void LoadCMDArgs(string[] args)
        {
            if (args.Length > 0)
            {
                CommandLineArguments.Arguments CommandLine = new CommandLineArguments.Arguments(args);

                if (CommandLine["help"] != null)
                {
                    LocalVars.PrintHelp = true;
                }

                if (CommandLine["no3d"] != null)
                {
                    LocalVars.StartInNo3D = true;
                    GlobalFuncs.ConsolePrint("NovetusCMD will now launch the server in No3D mode.", 4);
                }

                if (CommandLine["outputinfo"] != null)
                {
                    GlobalVars.RequestToOutputInfo = true;
                }

                if (CommandLine["debug"] != null)
                {
                    LocalVars.DebugMode = true;
                }

                if (CommandLine["script"] != null)
                {
                    if (CommandLine["script"].Contains("rbxasset:") || CommandLine["script"].Contains("http:"))
                    {
                        GlobalPaths.AddonScriptPath = CommandLine["script"].Replace(@"\", @"\\");
                        GlobalFuncs.ConsolePrint("NovetusCMD detected a custom script. Loading " + GlobalPaths.AddonScriptPath, 4);
                    }
                    else
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD cannot load '" + CommandLine["script"] + "' as it doesn't use a rbxasset path or URL.", 2);
                    }
                }
            }
        }
Ejemplo n.º 16
0
 public static void CommandInfo()
 {
     GlobalFuncs.ConsolePrint("Novetus CMD Command Line Arguments", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("General", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("-help | Displays the help.", 4, true, true);
     GlobalFuncs.ConsolePrint("-no3d | Launches server in NoGraphics mode", 4, true, true);
     GlobalFuncs.ConsolePrint("-script <path to script> | Loads an additional server script.", 4, true, true);
     GlobalFuncs.ConsolePrint("-outputinfo | Outputs all information about the running server to a text file.", 4, true, true);
     GlobalFuncs.ConsolePrint("-debug | Disables launching of the server for debugging purposes.", 4, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Custom server options", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("-upnp | Turns on UPnP.", 4, true, true);
     GlobalFuncs.ConsolePrint("-map <map filename> | Sets the map.", 4, true, true);
     GlobalFuncs.ConsolePrint("-client <client name> | Sets the client.", 4, true, true);
     GlobalFuncs.ConsolePrint("-port <port number> | Sets the server port.", 4, true, true);
     GlobalFuncs.ConsolePrint("-maxplayers <number of players> | Sets the number of players.", 4, true, true);
     GlobalFuncs.ConsolePrint("-notifications <true/false> | Toggles server join/leave notifications.", 4, true, true);
     GlobalFuncs.ConsolePrint("-serverbrowsername <server name> | Changes the name the server uses upon connection to the master server.", 4, true, true);
     GlobalFuncs.ConsolePrint("-serverbrowseraddress <master server address> | Changes the master server address.", 4, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("How to launch:", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Create a shortcut to NovetusCMD in the bin folder of Novetus' Directory or", 4, true, true);
     GlobalFuncs.ConsolePrint("create a batch file that launches NovetusCMD.", 4, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Shortcuts", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Right-click your shortcut and then go to Properties -> Shortcut.", 4, true, true);
     GlobalFuncs.ConsolePrint("Go to 'Target' and then click the end of where it says 'NovetusCMD.exe'", 4, true, true);
     GlobalFuncs.ConsolePrint("Press space and then type in whatever arguments you please.", 4, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Batch", 3, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Click the end of where it says 'NovetusCMD.exe'", 4, true, true);
     GlobalFuncs.ConsolePrint("Press space and then type in whatever arguments you please.", 4, true, true);
     GlobalFuncs.ConsolePrint("---------", 1, true, true);
     GlobalFuncs.ConsolePrint("Press any key to close...", 2, true, true);
 }
Ejemplo n.º 17
0
    //https://stackoverflow.com/questions/38948801/dotnetzip-display-progress-of-extraction
    void ExtractProgress(object sender, ExtractProgressEventArgs e)
    {
        if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
        {
            double percentage = Math.Round(e.BytesTransferred / (0.01 * e.TotalBytesToTransfer), 2);
            int    intPercent = Convert.ToInt32(percentage);

            if (intPercent % 25 == 0 && pastPercentage != intPercent)
            {
                GlobalFuncs.ConsolePrint("AddonLoader - Extracting: "
                                         + e.CurrentEntry.FileName + ". Progress: "
                                         + e.BytesTransferred + "/" + e.TotalBytesToTransfer
                                         + " (" + intPercent + "%)", 3, consoleBox, true);

                pastPercentage = intPercent;
            }
        }
        else if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
        {
            GlobalFuncs.ConsolePrint("AddonLoader - Extracting: " + e.CurrentEntry.FileName, 3, consoleBox);
        }
    }
Ejemplo n.º 18
0
        public void InstallRegServer()
        {
            if (SecurityFuncs.IsElevated)
            {
                try
                {
                    Process          process   = new Process();
                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName  = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe";
                    startInfo.Arguments = "/regserver";
                    startInfo.Verb      = "runas";
                    process.StartInfo   = startInfo;
                    process.Start();

                    Process          process2   = new Process();
                    ProcessStartInfo startInfo2 = new ProcessStartInfo();
                    startInfo2.FileName  = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe";
                    startInfo2.Arguments = "/regserver";
                    startInfo2.Verb      = "runas";
                    process2.StartInfo   = startInfo2;
                    process2.Start();

                    GlobalFuncs.ConsolePrint("UserAgent Library successfully installed and registered!", 3, ConsoleBox);
                    MessageBox.Show("UserAgent Library successfully installed and registered!", "Novetus - Register UserAgent Library", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    GlobalFuncs.ConsolePrint("ERROR - Failed to register. (" + ex.Message + ")", 2, ConsoleBox);
                    MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                GlobalFuncs.ConsolePrint("ERROR - Failed to register. (Did not run as Administrator)", 2, ConsoleBox);
                MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 19
0
        public static void Main(string[] args)
        {
            var config  = new NLog.Config.LoggingConfiguration();
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = GlobalPaths.ConfigDir + "\\CMD-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log"
            };

            config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
            LogManager.Configuration = config;

            //https://stackify.com/csharp-catch-all-exceptions/
            AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
            {
                Logger log = LogManager.GetCurrentClassLogger();
                log.Error("EXEPTION THROWN: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.Message) ? eventArgs.Exception.Message : "N/A"));
                log.Error("EXCEPTION INFO: " + (eventArgs.Exception != null ? eventArgs.Exception.ToString() : "N/A"));
                log.Error("INNER EXCEPTION: " + (eventArgs.Exception.InnerException != null ? eventArgs.Exception.InnerException.ToString() : "N/A"));
                log.Error("STACK TRACE: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.StackTrace) ? eventArgs.Exception.StackTrace : "N/A"));
                log.Error("TARGET SITE: " + (eventArgs.Exception.TargetSite != null ? eventArgs.Exception.TargetSite.ToString() : "N/A"));
                log.Error("FOOTPRINTS: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.GetExceptionFootprints()) ? eventArgs.Exception.GetExceptionFootprints() : "N/A"));
            };

            LoadCMDArgs(args);

            if (!LocalVars.PrintHelp)
            {
                GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true);
                Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";

                GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);
                GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1);

                GlobalFuncs.ConsolePrint("NovetusCMD is now loading main server configurations from the INI file.", 5);

                if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName))
                {
                    GlobalFuncs.ConsolePrint("WARNING 2 - " + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5);
                    WriteConfigValues();
                }

                ReadConfigValues(true);
                LoadOverrideINIArgs(args);
                InitUPnP();

                if (GlobalVars.UserConfiguration.WebServer)
                {
                    StartWebServer();
                }

                AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProgramClose);

                GlobalFuncs.ConsolePrint("Launching a " + GlobalVars.UserConfiguration.SelectedClient + " server on " + GlobalVars.UserConfiguration.Map + " with " + GlobalVars.UserConfiguration.PlayerLimit + " players.", 1);

                switch (LocalVars.DebugMode)
                {
                case true:
                    GlobalFuncs.CreateTXT();
                    break;

                case false:
                default:
                    StartServer(LocalVars.StartInNo3D);
                    break;
                }
            }
            else
            {
                LocalFuncs.CommandInfo();
            }

            Console.ReadKey();
        }
Ejemplo n.º 20
0
 static void ReadConfigValues(bool initial = false)
 {
     GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
     GlobalFuncs.ConsolePrint("Config loaded.", 3);
     GlobalFuncs.ReadClientValues(initial);
 }
Ejemplo n.º 21
0
        static void LoadOverrideINIArgs(string[] args)
        {
            if (args.Length > 0)
            {
                CommandLineArguments.Arguments CommandLine = new CommandLineArguments.Arguments(args);

                if (CommandLine["upnp"] != null)
                {
                    LocalVars.OverrideINI             = true;
                    GlobalVars.UserConfiguration.UPnP = true;
                    GlobalFuncs.ConsolePrint("NovetusCMD will now use UPnP for port forwarding.", 4);
                }

                if (CommandLine["notifications"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.ShowServerNotifications = Convert.ToBoolean(CommandLine["notifications"]);

                    if (GlobalVars.UserConfiguration.ShowServerNotifications)
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD will show notifications on player join/leave.", 4);
                    }
                    else
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD will no longer show notifications on player join/leave.", 4);
                    }
                }

                if (CommandLine["map"] != null)
                {
                    LocalVars.OverrideINI                = true;
                    GlobalVars.UserConfiguration.Map     = CommandLine["map"];
                    GlobalVars.UserConfiguration.MapPath = CommandLine["map"];
                    GlobalFuncs.ConsolePrint("NovetusCMD will now launch the server with the map " + GlobalVars.UserConfiguration.MapPath, 4);
                }
                else
                {
                    GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the map defined in the INI file.", 4);
                }

                if (CommandLine["client"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.SelectedClient = CommandLine["client"];
                }
                else
                {
                    GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the client defined in the INI file.", 4);
                }

                if (CommandLine["port"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(CommandLine["port"]);
                }

                if (CommandLine["maxplayers"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]);
                }

                if (CommandLine["serverbrowsername"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.ServerBrowserServerName = CommandLine["serverbrowsername"];
                }

                if (CommandLine["serverbrowseraddress"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.ServerBrowserServerAddress = CommandLine["serverbrowseraddress"];
                }
            }
        }
Ejemplo n.º 22
0
 static void WriteConfigValues()
 {
     GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
     GlobalFuncs.ReadClientValues();
     GlobalFuncs.ConsolePrint("Config Saved.", 3);
 }
Ejemplo n.º 23
0
        public void ConsoleProcessCommands(string cmd)
        {
            switch (cmd)
            {
            case string server3d when string.Compare(server3d, "server 3d", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Server);

                break;

            case string serverno3d when string.Compare(serverno3d, "server no3d", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Server, true);

                break;

            case string client when string.Compare(client, "client", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Client);

                break;

            case string solo when string.Compare(solo, "solo", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Solo);

                break;

            case string studiomap when string.Compare(studiomap, "studio map", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Studio);

                break;

            case string studionomap when string.Compare(studionomap, "studio nomap", true, CultureInfo.InvariantCulture) == 0:
                StartGame(ScriptType.Studio, false, true);

                break;

            case string configsave when string.Compare(configsave, "config save", true, CultureInfo.InvariantCulture) == 0:
                WriteConfigValues();

                break;

            case string configload when string.Compare(configload, "config load", true, CultureInfo.InvariantCulture) == 0:
                ReadConfigValues();

                break;

            case string configreset when string.Compare(configreset, "config reset", true, CultureInfo.InvariantCulture) == 0:
                ResetConfigValues();

                break;

            case string help when string.Compare(help, "help", true, CultureInfo.InvariantCulture) == 0:
                ConsoleHelp();

                break;

            case string sdk when string.Compare(sdk, "sdk", true, CultureInfo.InvariantCulture) == 0:
                LoadLauncher();

                break;

            case string dlldeleteon when string.Compare(dlldeleteon, "dlldelete on", true, CultureInfo.InvariantCulture) == 0:
                GlobalVars.UserConfiguration.DisableReshadeDelete = false;

                GlobalFuncs.ConsolePrint("ReShade DLL deletion enabled.", 4, ConsoleBox);
                break;

            case string dlldeleteoff when string.Compare(dlldeleteoff, "dlldelete off", true, CultureInfo.InvariantCulture) == 0:
                GlobalVars.UserConfiguration.DisableReshadeDelete = true;

                GlobalFuncs.ConsolePrint("ReShade DLL deletion disabled.", 4, ConsoleBox);
                break;

            case string important when string.Compare(important, LocalVars.important, true, CultureInfo.InvariantCulture) == 0:
                GlobalVars.AdminMode = true;

                GlobalFuncs.ConsolePrint("ADMIN MODE ENABLED.", 4, ConsoleBox);
                GlobalFuncs.ConsolePrint("YOU ARE GOD.", 2, ConsoleBox);
                break;

            default:
                GlobalFuncs.ConsolePrint("ERROR 3 - Command is either not registered or valid", 2, ConsoleBox);
                break;
            }
        }
Ejemplo n.º 24
0
 public void WriteCustomizationValues()
 {
     GlobalFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
     GlobalFuncs.ConsolePrint("Config Saved.", 3, ConsoleBox);
 }
Ejemplo n.º 25
0
 public void ReadyCallback()
 {
     GlobalFuncs.ConsolePrint("Discord RPC: Ready", 3, ConsoleBox);
 }
Ejemplo n.º 26
0
        static void LoadOverrideINIArgs(string[] args)
        {
            if (args.Length > 0)
            {
                CommandLineArguments.Arguments CommandLine = new CommandLineArguments.Arguments(args);

                if (CommandLine["upnp"] != null)
                {
                    LocalVars.OverrideINI             = true;
                    GlobalVars.UserConfiguration.UPnP = true;
                    GlobalFuncs.ConsolePrint("NovetusCMD will now use UPnP for port forwarding.", 4);
                }

                if (CommandLine["webserver"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.WebServer = Convert.ToBoolean(CommandLine["webserver"]);

                    if (GlobalVars.UserConfiguration.WebServer)
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD will now launch the Web Server.", 4);
                    }
                    else
                    {
                        GlobalFuncs.ConsolePrint("NovetusCMD no longer will launch the Web Server.", 4);
                    }
                }

                if (CommandLine["map"] != null)
                {
                    LocalVars.OverrideINI                = true;
                    GlobalVars.UserConfiguration.Map     = CommandLine["map"];
                    GlobalVars.UserConfiguration.MapPath = CommandLine["map"];
                    GlobalFuncs.ConsolePrint("NovetusCMD will now launch the server with the map " + GlobalVars.UserConfiguration.MapPath, 4);
                }
                else
                {
                    GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the default map.", 4);
                }

                if (CommandLine["client"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.SelectedClient = CommandLine["client"];
                }
                else
                {
                    GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the default client.", 4);
                }

                if (CommandLine["port"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(CommandLine["port"]);
                }

                if (CommandLine["maxplayers"] != null)
                {
                    LocalVars.OverrideINI = true;
                    GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]);
                }
            }
        }
Ejemplo n.º 27
0
        public void ReadConfigValues(bool initial = false)
        {
            GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);

            CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
            PlayerIDTextBox.Text          = GlobalVars.UserConfiguration.UserID.ToString();
            PlayerTripcodeLabel.Text      = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
            PlayerLimitBox.Value          = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit);
            PlayerNameTextBox.Text        = GlobalVars.UserConfiguration.PlayerName;
            SelectedClientLabel.Text      = GlobalVars.UserConfiguration.SelectedClient;
            SelectedMapLabel.Text         = GlobalVars.UserConfiguration.Map;
            Tree.SelectedNode             = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
            Tree.Focus();
            JoinPortBox.Value = Convert.ToDecimal(GlobalVars.JoinPort);
            HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
            IPLabel.Text      = GlobalVars.IP;
            PortLabel.Text    = GlobalVars.JoinPort.ToString();
            DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence;
            if (FormStyle == Settings.UIOptions.Style.Extended)
            {
                if (ReShadeCheckbox != null)
                {
                    ReShadeCheckbox.Checked = GlobalVars.UserConfiguration.ReShade;
                }

                if (ReShadeFPSDisplayCheckBox != null)
                {
                    ReShadeFPSDisplayCheckBox.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay;
                }

                if (ReShadePerformanceModeCheckBox != null)
                {
                    ReShadePerformanceModeCheckBox.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode;
                }
            }
            uPnPCheckBox.Checked             = GlobalVars.UserConfiguration.UPnP;
            ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications;
            ServerBrowserNameBox.Text        = GlobalVars.UserConfiguration.ServerBrowserServerName;
            ServerBrowserAddressBox.Text     = GlobalVars.UserConfiguration.ServerBrowserServerAddress;

            if (FormStyle == Settings.UIOptions.Style.Extended)
            {
                if (GraphicsModeBox != null)
                {
                    switch (GlobalVars.UserConfiguration.GraphicsMode)
                    {
                    case Settings.GraphicsOptions.Mode.OpenGL:
                        GraphicsModeBox.SelectedIndex = 1;
                        break;

                    case Settings.GraphicsOptions.Mode.DirectX:
                        GraphicsModeBox.SelectedIndex = 2;
                        break;

                    default:
                        GraphicsModeBox.SelectedIndex = 0;
                        break;
                    }
                }

                if (GraphicsLevelBox != null)
                {
                    switch (GlobalVars.UserConfiguration.QualityLevel)
                    {
                    case Settings.GraphicsOptions.Level.VeryLow:
                        GraphicsLevelBox.SelectedIndex = 1;
                        break;

                    case Settings.GraphicsOptions.Level.Low:
                        GraphicsLevelBox.SelectedIndex = 2;
                        break;

                    case Settings.GraphicsOptions.Level.Medium:
                        GraphicsLevelBox.SelectedIndex = 3;
                        break;

                    case Settings.GraphicsOptions.Level.High:
                        GraphicsLevelBox.SelectedIndex = 4;
                        break;

                    case Settings.GraphicsOptions.Level.Ultra:
                        GraphicsLevelBox.SelectedIndex = 5;
                        break;

                    case Settings.GraphicsOptions.Level.Custom:
                        GraphicsLevelBox.SelectedIndex = 6;
                        break;

                    default:
                        GraphicsLevelBox.SelectedIndex = 0;
                        break;
                    }
                }
            }

            switch (GlobalVars.UserConfiguration.LauncherStyle)
            {
            case Settings.UIOptions.Style.Compact:
                StyleSelectorBox.SelectedIndex = 1;
                break;

            case Settings.UIOptions.Style.Extended:
            default:
                StyleSelectorBox.SelectedIndex = 0;
                break;
            }

            GlobalFuncs.ConsolePrint("Config loaded.", 3, ConsoleBox);
            ReadClientValues(initial);
        }
Ejemplo n.º 28
0
 public void ErrorCallback(int errorCode, string message)
 {
     GlobalFuncs.ConsolePrint("Discord RPC: Error. Reason - " + errorCode + ": " + message, 2, ConsoleBox);
 }