mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 09:41:33 +02:00
updated to code in new snapshot.
This commit is contained in:
parent
ebba6ca013
commit
5c8f240693
@ -36,7 +36,8 @@ namespace NovetusCMD
|
||||
try
|
||||
{
|
||||
NetFuncs.StartUPnP(device,protocol,port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -52,7 +53,8 @@ namespace NovetusCMD
|
||||
try
|
||||
{
|
||||
NetFuncs.StopUPnP(device,protocol,port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3);
|
||||
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)
|
||||
{
|
||||
@ -66,7 +68,8 @@ namespace NovetusCMD
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3);
|
||||
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);
|
||||
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -83,7 +86,8 @@ namespace NovetusCMD
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -196,7 +200,7 @@ namespace NovetusCMD
|
||||
LoadOverrideINIArgs(args);
|
||||
InitUPnP();
|
||||
|
||||
if (!GlobalVars.UserConfiguration.WebServer)
|
||||
if (GlobalVars.UserConfiguration.WebServer)
|
||||
{
|
||||
StartWebServer();
|
||||
}
|
||||
@ -317,6 +321,7 @@ namespace NovetusCMD
|
||||
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);
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
#region .NET Extentions
|
||||
@ -162,7 +165,7 @@ public static class NETExt
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Exeption Helpers
|
||||
#region Exception Helpers
|
||||
//https://github.com/AlexMelw/EasySharp/blob/master/NHelpers/ExceptionsDealing/Extensions/ExceptionExtensions.cs
|
||||
/// <summary>
|
||||
/// Gets the entire stack trace consisting of exception's footprints (File, Method, LineNumber)
|
||||
@ -209,5 +212,15 @@ public static class NETExt
|
||||
return stackTraceFootprints;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DirectoryInfo Extensions
|
||||
public static IEnumerable<FileInfo> GetFilesByExtensions(this DirectoryInfo dir, params string[] extensions)
|
||||
{
|
||||
if (extensions == null)
|
||||
throw new ArgumentNullException("extensions");
|
||||
IEnumerable<FileInfo> files = dir.EnumerateFiles();
|
||||
return files.Where(f => extensions.Contains(f.Extension));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
@ -9,19 +9,19 @@ using System.Windows.Forms;
|
||||
#region Tree Node Helper
|
||||
public static class TreeNodeHelper
|
||||
{
|
||||
public static void ListDirectory(TreeView treeView, string path, string filter = ".*")
|
||||
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 = ".*")
|
||||
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))
|
||||
foreach (var file in directoryInfo.GetFilesByExtensions(filter))
|
||||
directoryNode.Nodes.Add(new TreeNode(file.Name));
|
||||
return directoryNode;
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
NetFuncs.StartUPnP(device, protocol, port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -70,7 +71,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
NetFuncs.StopUPnP(device, protocol, port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -84,7 +86,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3, richTextBox1);
|
||||
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -101,7 +104,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3, richTextBox1);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -260,8 +264,8 @@ namespace NovetusLauncher
|
||||
break;
|
||||
case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]:
|
||||
string mapdir = GlobalPaths.MapsDir;
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxlx");
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx"};
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, fileexts);
|
||||
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
|
||||
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
|
||||
treeView1.Focus();
|
||||
@ -419,7 +423,7 @@ namespace NovetusLauncher
|
||||
ReadConfigValues(true);
|
||||
InitUPnP();
|
||||
StartDiscord();
|
||||
if (!GlobalVars.UserConfiguration.WebServer)
|
||||
if (GlobalVars.UserConfiguration.WebServer)
|
||||
{
|
||||
StartWebServer();
|
||||
}
|
||||
@ -1070,8 +1074,8 @@ namespace NovetusLauncher
|
||||
treeView1.Nodes.Clear();
|
||||
_fieldsTreeCache.Nodes.Clear();
|
||||
string mapdir = GlobalPaths.MapsDir;
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxlx");
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, fileexts);
|
||||
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
|
||||
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
|
||||
treeView1.Focus();
|
||||
|
@ -58,7 +58,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
NetFuncs.StartUPnP(device, protocol, port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -74,7 +75,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
NetFuncs.StopUPnP(device, protocol, port);
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3, richTextBox1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -88,7 +90,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3, richTextBox1);
|
||||
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -105,7 +108,8 @@ namespace NovetusLauncher
|
||||
try
|
||||
{
|
||||
INatDevice device = args.Device;
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3, richTextBox1);
|
||||
string IP = (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString());
|
||||
GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3, richTextBox1);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort);
|
||||
StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.WebServerPort);
|
||||
@ -264,8 +268,8 @@ namespace NovetusLauncher
|
||||
break;
|
||||
case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]:
|
||||
string mapdir = GlobalPaths.MapsDir;
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxlx");
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, fileexts);
|
||||
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
|
||||
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
|
||||
treeView1.Focus();
|
||||
@ -451,7 +455,7 @@ namespace NovetusLauncher
|
||||
ReadConfigValues(true);
|
||||
InitUPnP();
|
||||
StartDiscord();
|
||||
if (!GlobalVars.UserConfiguration.WebServer)
|
||||
if (GlobalVars.UserConfiguration.WebServer)
|
||||
{
|
||||
StartWebServer();
|
||||
}
|
||||
@ -1143,8 +1147,8 @@ namespace NovetusLauncher
|
||||
treeView1.Nodes.Clear();
|
||||
_fieldsTreeCache.Nodes.Clear();
|
||||
string mapdir = GlobalPaths.MapsDir;
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxlx");
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
||||
TreeNodeHelper.ListDirectory(treeView1, mapdir, fileexts);
|
||||
TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes);
|
||||
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
|
||||
treeView1.Focus();
|
||||
|
Loading…
Reference in New Issue
Block a user