Extra polish

This commit is contained in:
Bitl 2021-10-31 16:12:00 -07:00
parent 4b1ccdb1e9
commit 43c3995361
11 changed files with 168 additions and 163 deletions

View File

@ -27,7 +27,6 @@
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\NetFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\ScriptFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\SecurityFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\VarStorage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinForms\FormExt.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinForms\CustomFormControls.cs">
<SubType>Component</SubType>

View File

@ -2375,5 +2375,23 @@ public class GlobalFuncs
return false;
}
public static bool IsIPValid(string IP)
{
IPAddress address;
if (IPAddress.TryParse(IP, out address))
{
switch (address.AddressFamily)
{
case System.Net.Sockets.AddressFamily.InterNetwork:
return true;
case System.Net.Sockets.AddressFamily.InterNetworkV6:
default:
break;
}
}
return false;
}
}
#endregion

View File

@ -253,16 +253,8 @@ public class SecurityFuncs
try
{
string url = "http://checkip.dyndns.org";
WebRequest req = WebRequest.Create(url);
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string response = sr.ReadToEnd().Trim();
string[] a = response.Split(':');
string a2 = a[1].Substring(1);
string[] a3 = a2.Split('<');
ipAddress = a3[0];
}
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
}
#if URI || LAUNCHER || CMD
catch (Exception ex)
{

View File

@ -1,92 +0,0 @@
#region Usings
using System;
using System.Drawing;
using System.Net.NetworkInformation;
using System.Net.Sockets;
#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 Game Server Definition
public class GameServer
{
public GameServer(string name, string ip, string port, string client)
{
ServerName = SecurityFuncs.Base64DecodeOld(name);
ServerIP = SecurityFuncs.Base64DecodeOld(ip);
ServerPort = Convert.ToInt32(SecurityFuncs.Base64DecodeOld(port));
ServerClient = SecurityFuncs.Base64DecodeOld(client);
ServerStatus = PingServer(ServerIP, ServerPort);
}
public bool IsValid()
{
if (!string.IsNullOrWhiteSpace(ServerName) &&
!string.IsNullOrWhiteSpace(ServerClient) &&
!string.IsNullOrWhiteSpace(ServerIP) &&
!string.IsNullOrWhiteSpace(ServerPort.ToString()) &&
GlobalFuncs.IsClientValid(ServerClient) &&
(!ServerIP.Equals("localhost") || !ServerIP.Equals("127.0.0.1")) &&
!GetStatusString().Equals("Offline"))
{
return true;
}
else
{
return false;
}
}
//Modified from https://stackoverflow.com/questions/22903861/how-to-check-remote-ip-and-port-is-available
public static bool PingServer(string hostUri, int portNumber)
{
try
{
using (var client = new UdpClient(hostUri, portNumber))
return true;
}
catch (SocketException ex)
{
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return false;
}
}
public string GetStatusString()
{
return (ServerStatus ? "Online" : "Offline");
}
public string ServerName { get; set; }
public string ServerIP { get; set; }
public int ServerPort { get; set; }
public string ServerClient { get; set; }
public bool ServerStatus { get; set; }
}
#endregion
}
#endregion

View File

@ -0,0 +1,65 @@
#region Usings
using System;
using System.Net.Sockets;
#endregion
#region Game Server Definition
public class GameServer
{
public GameServer(string name, string ip, string port, string client)
{
ServerName = SecurityFuncs.Base64DecodeOld(name);
ServerIP = SecurityFuncs.Base64DecodeOld(ip);
ServerPort = Convert.ToInt32(SecurityFuncs.Base64DecodeOld(port));
ServerClient = SecurityFuncs.Base64DecodeOld(client);
ServerStatus = PingServer(ServerIP, ServerPort);
}
public bool IsValid()
{
if (!string.IsNullOrWhiteSpace(ServerName) &&
!string.IsNullOrWhiteSpace(ServerClient) &&
!string.IsNullOrWhiteSpace(ServerIP) &&
!string.IsNullOrWhiteSpace(ServerPort.ToString()) &&
GlobalFuncs.IsClientValid(ServerClient) &&
GlobalFuncs.IsIPValid(ServerIP) &&
(!ServerIP.Equals("localhost") || !ServerIP.Equals("127.0.0.1")) &&
!GetStatusString().Equals("Offline"))
{
return true;
}
else
{
return false;
}
}
//Modified from https://stackoverflow.com/questions/22903861/how-to-check-remote-ip-and-port-is-available
public static bool PingServer(string hostUri, int portNumber)
{
try
{
using (var client = new UdpClient(hostUri, portNumber))
return true;
}
catch (SocketException ex)
{
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return false;
}
}
public string GetStatusString()
{
return (ServerStatus ? "Online" : "Offline");
}
public string ServerName { get; set; }
public string ServerIP { get; set; }
public int ServerPort { get; set; }
public string ServerClient { get; set; }
public bool ServerStatus { get; set; }
}
#endregion

View File

@ -33,14 +33,35 @@ public enum RobloxFileType
}
#endregion
#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 Roblox Type Definitions
public struct RobloxDefs
{
public static VarStorage.AssetCacheDef Fonts
public static AssetCacheDef Fonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.AssetCacheDirFonts, GlobalPaths.AssetCacheDirTextures },
@ -48,11 +69,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Sky
public static AssetCacheDef Sky
{
get
{
return new VarStorage.AssetCacheDef("Sky",
return new AssetCacheDef("Sky",
new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirSky },
@ -60,11 +81,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Decal
public static AssetCacheDef Decal
{
get
{
return new VarStorage.AssetCacheDef("Decal",
return new AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -72,11 +93,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Texture
public static AssetCacheDef Texture
{
get
{
return new VarStorage.AssetCacheDef("Texture",
return new AssetCacheDef("Texture",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -84,11 +105,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef HopperBin
public static AssetCacheDef HopperBin
{
get
{
return new VarStorage.AssetCacheDef("HopperBin",
return new AssetCacheDef("HopperBin",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -96,11 +117,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Tool
public static AssetCacheDef Tool
{
get
{
return new VarStorage.AssetCacheDef("Tool",
return new AssetCacheDef("Tool",
new string[] { "TextureId" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -108,11 +129,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Sound
public static AssetCacheDef Sound
{
get
{
return new VarStorage.AssetCacheDef("Sound",
return new AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { GlobalPaths.AssetCacheDirSounds },
@ -120,11 +141,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ImageLabel
public static AssetCacheDef ImageLabel
{
get
{
return new VarStorage.AssetCacheDef("ImageLabel",
return new AssetCacheDef("ImageLabel",
new string[] { "Image" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -132,11 +153,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Shirt
public static AssetCacheDef Shirt
{
get
{
return new VarStorage.AssetCacheDef("Shirt",
return new AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -144,11 +165,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ShirtGraphic
public static AssetCacheDef ShirtGraphic
{
get
{
return new VarStorage.AssetCacheDef("ShirtGraphic",
return new AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -156,11 +177,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Pants
public static AssetCacheDef Pants
{
get
{
return new VarStorage.AssetCacheDef("Pants",
return new AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.AssetCacheDirTextures },
@ -168,11 +189,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef Script
public static AssetCacheDef Script
{
get
{
return new VarStorage.AssetCacheDef("Script",
return new AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.AssetCacheDirScripts },
@ -180,11 +201,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef LocalScript
public static AssetCacheDef LocalScript
{
get
{
return new VarStorage.AssetCacheDef("LocalScript",
return new AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.AssetCacheDirScripts },
@ -193,11 +214,11 @@ public struct RobloxDefs
}
//item defs below
public static VarStorage.AssetCacheDef ItemHatFonts
public static AssetCacheDef ItemHatFonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.hatdirFonts, GlobalPaths.hatdirTextures },
@ -205,11 +226,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemHatSound
public static AssetCacheDef ItemHatSound
{
get
{
return new VarStorage.AssetCacheDef("Sound",
return new AssetCacheDef("Sound",
new string[] { "SoundId" },
new string[] { ".wav" },
new string[] { GlobalPaths.hatdirSounds },
@ -217,11 +238,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemHatScript
public static AssetCacheDef ItemHatScript
{
get
{
return new VarStorage.AssetCacheDef("Script",
return new AssetCacheDef("Script",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.hatdirScripts },
@ -229,11 +250,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemHatLocalScript
public static AssetCacheDef ItemHatLocalScript
{
get
{
return new VarStorage.AssetCacheDef("LocalScript",
return new AssetCacheDef("LocalScript",
new string[] { "LinkedSource" },
new string[] { ".lua" },
new string[] { GlobalPaths.hatdirScripts },
@ -241,11 +262,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemHeadFonts
public static AssetCacheDef ItemHeadFonts
{
get
{
return new VarStorage.AssetCacheDef("SpecialMesh",
return new AssetCacheDef("SpecialMesh",
new string[] { "MeshId", "TextureId" },
new string[] { ".mesh", ".png" },
new string[] { GlobalPaths.headdirFonts, GlobalPaths.headdirTextures },
@ -253,11 +274,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemFaceTexture
public static AssetCacheDef ItemFaceTexture
{
get
{
return new VarStorage.AssetCacheDef("Decal",
return new AssetCacheDef("Decal",
new string[] { "Texture" },
new string[] { ".png" },
new string[] { GlobalPaths.facedirTextures },
@ -265,11 +286,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemShirtTexture
public static AssetCacheDef ItemShirtTexture
{
get
{
return new VarStorage.AssetCacheDef("Shirt",
return new AssetCacheDef("Shirt",
new string[] { "ShirtTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.shirtdirTextures },
@ -277,11 +298,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemTShirtTexture
public static AssetCacheDef ItemTShirtTexture
{
get
{
return new VarStorage.AssetCacheDef("ShirtGraphic",
return new AssetCacheDef("ShirtGraphic",
new string[] { "Graphic" },
new string[] { ".png" },
new string[] { GlobalPaths.tshirtdirTextures },
@ -289,11 +310,11 @@ public struct RobloxDefs
}
}
public static VarStorage.AssetCacheDef ItemPantsTexture
public static AssetCacheDef ItemPantsTexture
{
get
{
return new VarStorage.AssetCacheDef("Pants",
return new AssetCacheDef("Pants",
new string[] { "PantsTemplate" },
new string[] { ".png" },
new string[] { GlobalPaths.pantsdirTextures },

View File

@ -330,12 +330,12 @@ public partial class AssetSDK : Form
}
}
public static void DownloadFromNodes(XDocument doc, VarStorage.AssetCacheDef assetdef, string name = "", string meshname = "")
public static void DownloadFromNodes(XDocument doc, AssetCacheDef assetdef, string name = "", string meshname = "")
{
DownloadFromNodes(doc, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
}
public static void DownloadFromNodes(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
public static void DownloadFromNodes(XDocument doc, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
{
DownloadFromNodes(doc, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
}

View File

@ -406,7 +406,7 @@ public partial class ItemCreationSDK : Form
#region Functions
#region XML Editing/Fetching
public static void SetItemFontVals(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex, int outputPathIndex, int inGameDirIndex, string assetpath, string assetfilename)
public static void SetItemFontVals(XDocument doc, AssetCacheDef assetdef, int idIndex, int outputPathIndex, int inGameDirIndex, string assetpath, string assetfilename)
{
SetItemFontVals(doc, assetdef.Class, assetdef.Id[idIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], assetpath, assetfilename);
}
@ -440,7 +440,7 @@ public partial class ItemCreationSDK : Form
}
}
public static void SetItemFontValEmpty(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex)
public static void SetItemFontValEmpty(XDocument doc, AssetCacheDef assetdef, int idIndex)
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == assetdef.Class
@ -465,7 +465,7 @@ public partial class ItemCreationSDK : Form
}
}
public static string GetItemFontVals(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex)
public static string GetItemFontVals(XDocument doc, AssetCacheDef assetdef, int idIndex)
{
return GetItemFontVals(doc, assetdef.Class, assetdef.Id[idIndex]);
}
@ -497,7 +497,7 @@ public partial class ItemCreationSDK : Form
return "";
}
public static void SetItemCoordVals(XDocument doc, VarStorage.AssetCacheDef assetdef, Vector3 coord, string CoordClass, string CoordName)
public static void SetItemCoordVals(XDocument doc, AssetCacheDef assetdef, Vector3 coord, string CoordClass, string CoordName)
{
SetItemCoordVals(doc, assetdef.Class, coord, CoordClass, CoordName);
}
@ -556,7 +556,7 @@ public partial class ItemCreationSDK : Form
}
}
public static string GetItemCoordVals(XDocument doc, VarStorage.AssetCacheDef assetdef, string CoordClass, string CoordName)
public static string GetItemCoordVals(XDocument doc, AssetCacheDef assetdef, string CoordClass, string CoordName)
{
return GetItemCoordVals(doc, assetdef.Class, CoordClass, CoordName);
}
@ -619,7 +619,7 @@ public partial class ItemCreationSDK : Form
return coord;
}
public static void SetItemRotationVals(XDocument doc, VarStorage.AssetCacheDef assetdef, Vector3 right, Vector3 up, Vector3 forward, string CoordClass, string CoordName)
public static void SetItemRotationVals(XDocument doc, AssetCacheDef assetdef, Vector3 right, Vector3 up, Vector3 forward, string CoordClass, string CoordName)
{
SetItemRotationVals(doc, assetdef.Class, right, up, forward, CoordClass, CoordName);
}
@ -726,7 +726,7 @@ public partial class ItemCreationSDK : Form
}
}
public static string GetItemRotationVals(XDocument doc, VarStorage.AssetCacheDef assetdef, string CoordClass, string CoordName)
public static string GetItemRotationVals(XDocument doc, AssetCacheDef assetdef, string CoordClass, string CoordName)
{
return GetItemRotationVals(doc, assetdef.Class, CoordClass, CoordName);
}

View File

@ -16,8 +16,8 @@ namespace NovetusLauncher
public partial class ServerBrowser : Form
{
#region Private Variables
List<VarStorage.GameServer> serverList = new List<VarStorage.GameServer>();
private VarStorage.GameServer selectedServer;
List<GameServer> serverList = new List<GameServer>();
private GameServer selectedServer;
private string oldIP;
private int oldPort;
#endregion
@ -136,8 +136,11 @@ namespace NovetusLauncher
{
string DecodedLine = SecurityFuncs.Base64DecodeOld(line);
string[] serverInfo = DecodedLine.Split('|');
VarStorage.GameServer gameServer = new VarStorage.GameServer(serverInfo[0], serverInfo[1], serverInfo[2], serverInfo[3]);
serverList.Add(gameServer);
GameServer gameServer = new GameServer(serverInfo[0], serverInfo[1], serverInfo[2], serverInfo[3]);
if (gameServer.IsValid())
{
serverList.Add(gameServer);
}
}
}
}
@ -181,9 +184,6 @@ namespace NovetusLauncher
foreach (var server in serverList)
{
if (!server.IsValid())
continue;
var serverItem = new ListViewItem(server.ServerName);
var serverClient = new ListViewItem.ListViewSubItem(serverItem, server.ServerClient);

View File

@ -158,6 +158,7 @@
<DependentUpon>CharacterCustomizationExtended.cs</DependentUpon>
</Compile>
<Compile Include="Classes\Launcher\AddonLoader.cs" />
<Compile Include="Classes\Launcher\GameServer.cs" />
<Compile Include="Classes\Launcher\SplashLoader.cs" />
<Compile Include="Classes\Launcher\TreeNodeHelper.cs" />
<Compile Include="Classes\LocalVars.cs" />

View File

@ -52,6 +52,7 @@ Changes from Pre-Release 5:
- Server hosters may now insert a "SkipSecurity" object into Lighting that will skip security. SkipSecurity may also be removed to re-enable security.
- Increased the speed of loading outfits in 2011 clients.
- Fixed issues with launching Novetus from itch.io.
- The server browser now pings the server and shows the current server status.
Changes from 1.2.4.1:
- The OBJ2MeshV1GUI, The Asset Localizer, and the Item SDK have been merged to form the Asset SDK!
- Works with the Roblox Asset Delivery API! Note: Script assets wil have to be downloaded manually in order to be used in scripts.