new snapshot incoming

This commit is contained in:
Bitl 2024-01-20 22:46:52 -07:00
parent 44c550eb0c
commit e4bee54448
48 changed files with 757 additions and 503 deletions

View File

@ -493,17 +493,17 @@ class CharacterCustomizationShared
return;
}
ChangeColorOfPart(Convert.ToInt32(ColorView.Items[selectedIndex].Tag));
ChangeColorOfPart(ConvertSafe.ToInt32Safe(ColorView.Items[selectedIndex].Tag));
}
Color ConvertStringtoColor(string CString)
{
var p = CString.Split(new char[] { ',', ']' });
int A = Convert.ToInt32(p[0].Substring(p[0].IndexOf('=') + 1));
int R = Convert.ToInt32(p[1].Substring(p[1].IndexOf('=') + 1));
int G = Convert.ToInt32(p[2].Substring(p[2].IndexOf('=') + 1));
int B = Convert.ToInt32(p[3].Substring(p[3].IndexOf('=') + 1));
int A = ConvertSafe.ToInt32Safe(p[0].Substring(p[0].IndexOf('=') + 1));
int R = ConvertSafe.ToInt32Safe(p[1].Substring(p[1].IndexOf('=') + 1));
int G = ConvertSafe.ToInt32Safe(p[2].Substring(p[2].IndexOf('=') + 1));
int B = ConvertSafe.ToInt32Safe(p[3].Substring(p[3].IndexOf('=') + 1));
return Color.FromArgb(A, R, G, B);
}

View File

@ -109,7 +109,7 @@ namespace Novetus.Core
if (File.Exists(name) && read > 0)
{
downloadSize = read;
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + Util.SizeSuffix(Convert.ToInt64(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + Util.SizeSuffix(ConvertSafe.ToInt64Safe(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
}
else
{

View File

@ -34,7 +34,7 @@ namespace Novetus.Core
{
if (File.Exists(path))
{
Util.FixedFileDelete(path);
IOSafe.File.Delete(path);
}
File.Create(path).Close();

View File

@ -50,7 +50,7 @@ namespace Novetus.Core
}
//FixedFileMove deletes the original file and moves the temp file in.
Util.FixedFileMove(tempFilename, filename, true);
IOSafe.File.Move(tempFilename, filename, true);
// Final calculations
DateTime endTime = DateTime.Now;

View File

@ -63,15 +63,21 @@ namespace Novetus.Core
/// </summary>
public RedistKeyLocation Location { get; }
/// <summary>
/// Optional?
/// </summary>
public bool Optional { get; }
/// <summary>
/// Possible keys
/// </summary>
public string[] Keys { get; }
public RedistInformation(RedistKeyLocation location, string[] keys)
public RedistInformation(RedistKeyLocation location, string[] keys, bool optional)
{
Location = location;
Keys = keys;
Optional = optional;
}
}
@ -82,9 +88,9 @@ namespace Novetus.Core
/// </summary>
private static Dictionary<VCPPRedist, RedistInformation> _VCRedistToRedistKeysMap = new Dictionary<VCPPRedist, RedistInformation>()
{
[VCPPRedist.VCPP2005] = new RedistInformation(RedistKeyLocation.Products, new[] { "b25099274a207264182f8181add555d0", "c1c4f01781cc94c4c8fb1542c0981a2a" }),
[VCPPRedist.VCPP2008] = new RedistInformation(RedistKeyLocation.Products, new[] { "6E815EB96CCE9A53884E7857C57002F0" }),
[VCPPRedist.VCPP2012] = new RedistInformation(RedistKeyLocation.Dependencies, new[] { "{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}", "{95716cce-fc71-413f-8ad5-56c2892d4b3a}" })
[VCPPRedist.VCPP2005] = new RedistInformation(RedistKeyLocation.Products, new[] { "b25099274a207264182f8181add555d0", "c1c4f01781cc94c4c8fb1542c0981a2a" }, false),
[VCPPRedist.VCPP2008] = new RedistInformation(RedistKeyLocation.Products, new[] { "6E815EB96CCE9A53884E7857C57002F0", "6F9E66FF7E38E3A3FA41D89E8A906A4A", "D20352A90C039D93DBF6126ECE614057" }, false),
[VCPPRedist.VCPP2012] = new RedistInformation(RedistKeyLocation.Dependencies, new[] { "{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}", "{95716cce-fc71-413f-8ad5-56c2892d4b3a}" }, true)
};
/// <summary>
@ -106,7 +112,7 @@ namespace Novetus.Core
foreach (string key in information.Keys)
{
using RegistryKey? redist = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\" + path + @"\" + key);
using RegistryKey redist = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\" + path + @"\" + key);
if (redist != null)
return true;
@ -115,6 +121,16 @@ namespace Novetus.Core
return false;
}
/// <summary>
/// Checks if redist is optional
/// </summary>
/// <param name="information">Redist information</param>
/// <returns>Optional</returns>
private static bool CheckIfOptional(RedistInformation information)
{
return information.Optional;
}
/// <summary>
/// Check if a VC++ redist is installed
/// </summary>
@ -150,6 +166,13 @@ namespace Novetus.Core
RedistInformation information = kvPair.Value;
bool installed = CheckIfInstallerKeyExists(information);
// if we're optional, lie.
if (!installed && CheckIfOptional(information))
{
installed = true;
}
_VCRedistResults[redist] = installed;
}
}

View File

@ -0,0 +1,97 @@
using System;
namespace Novetus.Core
{
public static class ConvertSafe
{
public static int ToInt32Safe(object obj)
{
int result = 0;
try
{
result = Convert.ToInt32(obj);
}
catch (Exception)
{
}
return result;
}
public static bool ToBooleanSafe(object obj)
{
bool result = false;
try
{
result = Convert.ToBoolean(obj);
}
catch (Exception)
{
}
return result;
}
public static long ToInt64Safe(object obj)
{
long result = 0;
try
{
result = Convert.ToInt64(obj);
}
catch (Exception)
{
}
return result;
}
public static decimal ToDecimalSafe(object obj)
{
decimal result = 0;
try
{
result = Convert.ToDecimal(obj);
}
catch (Exception)
{
}
return result;
}
public static double ToDoubleSafe(object obj)
{
double result = 0;
try
{
result = Convert.ToDouble(obj);
}
catch (Exception)
{
}
return result;
}
public static float ToSingleSafe(object obj)
{
float result = 0;
try
{
result = Convert.ToSingle(obj);
}
catch (Exception)
{
}
return result;
}
}
}

View File

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace Novetus.Core
{
public static class IOSafe
{
public static class File
{
public static void Copy(string src, string dest, bool overwrite, bool overwritewarning = false)
{
if (System.IO.File.Exists(dest))
{
if (overwrite && overwritewarning)
{
if (ShowOverrideWarning(dest) == DialogResult.No)
{
return;
}
}
System.IO.File.SetAttributes(dest, FileAttributes.Normal);
}
System.IO.File.Copy(src, dest, overwrite);
System.IO.File.SetAttributes(dest, FileAttributes.Normal);
}
public static void Delete(string src)
{
if (System.IO.File.Exists(src))
{
System.IO.File.SetAttributes(src, FileAttributes.Normal);
System.IO.File.Delete(src);
}
}
public static void Move(string src, string dest, bool overwrite, bool overwritewarning = false)
{
if (src.Equals(dest))
return;
if (!System.IO.File.Exists(dest))
{
System.IO.File.SetAttributes(src, FileAttributes.Normal);
System.IO.File.Move(src, dest);
}
else
{
if (overwrite)
{
if (overwritewarning)
{
if (ShowOverrideWarning(dest) == DialogResult.No)
{
return;
}
}
Delete(dest);
System.IO.File.SetAttributes(src, FileAttributes.Normal);
System.IO.File.Move(src, dest);
}
else
{
throw new IOException("Cannot create a file when that file already exists. FixedFileMove cannot override files with overwrite disabled.");
}
}
}
}
private static DialogResult ShowOverrideWarning(string dest)
{
DialogResult box = MessageBox.Show("A file with a similar name was detected in the directory as '" + dest +
"'.\n\nWould you like to override it?", "Novetus - Override Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
return box;
}
}
}

View File

@ -0,0 +1,232 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using System;
using System.Linq;
namespace Novetus.Core
{
public static class NetExtensions
{
#region Extensions
//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 Rich Text Box Extensions
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
box.SelectionColor = color;
box.AppendText(text);
//box.SelectionColor = box.ForeColor;
}
#endregion
#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 Substring Extensions
/// <summary>
/// Get string value between [first] a and [last] b.
/// </summary>
public static string Between(this string value, string a, string b)
{
int posA = value.IndexOf(a);
int posB = value.LastIndexOf(b);
if (posA == -1)
{
return "";
}
if (posB == -1)
{
return "";
}
int adjustedPosA = posA + a.Length;
if (adjustedPosA >= posB)
{
return "";
}
return value.Substring(adjustedPosA, posB - adjustedPosA);
}
/// <summary>
/// Get string value after [first] a.
/// </summary>
public static string Before(this string value, string a)
{
int posA = value.IndexOf(a);
if (posA == -1)
{
return "";
}
return value.Substring(0, posA);
}
/// <summary>
/// Get string value after [last] a.
/// </summary>
public static string After(this string value, string a)
{
int posA = value.LastIndexOf(a);
if (posA == -1)
{
return "";
}
int adjustedPosA = posA + a.Length;
if (adjustedPosA >= value.Length)
{
return "";
}
return value.Substring(adjustedPosA);
}
#endregion
#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 };
public static string Crypt(this string text)
{
SymmetricAlgorithm algorithm = DES.Create();
ICryptoTransform transform = algorithm.CreateEncryptor(key, iv);
byte[] inputbuffer = Encoding.Unicode.GetBytes(text);
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
return Convert.ToBase64String(outputBuffer);
}
public static string Decrypt(this string text)
{
SymmetricAlgorithm algorithm = DES.Create();
ICryptoTransform transform = algorithm.CreateDecryptor(key, iv);
byte[] inputbuffer = Convert.FromBase64String(text);
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
return Encoding.Unicode.GetString(outputBuffer);
}
#endregion
#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)
/// </summary>
/// <param name="exception">Source <see cref="Exception" /></param>
/// <returns>
/// <see cref="string" /> that represents the entire stack trace consisting of exception's footprints (File,
/// Method, LineNumber)
/// </returns>
public static string GetExceptionFootprints(this Exception exception)
{
StackTrace stackTrace = new StackTrace(exception, true);
StackFrame[] frames = stackTrace.GetFrames();
if (ReferenceEquals(frames, null))
{
return string.Empty;
}
var traceStringBuilder = new StringBuilder();
for (var i = 0; i < frames.Length; i++)
{
StackFrame frame = frames[i];
if (frame.GetFileLineNumber() < 1)
continue;
traceStringBuilder.AppendLine($"File: {frame.GetFileName()}");
traceStringBuilder.AppendLine($"Method: {frame.GetMethod().Name}");
traceStringBuilder.AppendLine($"LineNumber: {frame.GetFileLineNumber()}");
if (i == frames.Length - 1)
break;
traceStringBuilder.AppendLine(" ---> ");
}
string stackTraceFootprints = traceStringBuilder.ToString();
if (string.IsNullOrWhiteSpace(stackTraceFootprints))
return "NO DETECTED FOOTPRINTS";
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
#region DateTime Extensions
//https://stackoverflow.com/questions/5672862/check-if-datetime-instance-falls-in-between-other-two-datetime-objects
public static bool IsBetweenTwoDates(this DateTime dt, DateTime start, DateTime end)
{
return dt >= start && dt <= end;
}
#endregion
#region Form Extensions
[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
#endregion
}
}

View File

@ -9,11 +9,14 @@
<Import_RootNamespace>NovetusCore</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)NETEnhancements\ConvertSafe.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\INIFile.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\Script.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\SemaphoreLocker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\VCPPRedistInstallationDetector.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\WebProxy.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NETEnhancements\IOSafe.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NETEnhancements\NETExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\ClientManagement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\Downloader.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Classes\CommandLineArguments.cs" />
@ -25,9 +28,8 @@
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\NovetusFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\GlobalPaths.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\GlobalVars.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\Roblox Helpers\RobloxTypes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\Roblox Helpers\RobloxXML.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\Roblox Helpers\Vector3.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\RobloxHelpers\RobloxTypes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\RobloxHelpers\RobloxXML.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\Util.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\NetFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\SecurityFuncs.cs" />

View File

@ -77,7 +77,7 @@ namespace Novetus.Core
if (!File.Exists(fullpath))
{
Util.FixedFileCopy(dir, fullpath, false);
IOSafe.File.Copy(dir, fullpath, false);
}
}
}
@ -290,26 +290,26 @@ namespace Novetus.Core
commandlineargs = SecurityFuncs.Decode(result[10]);
}
info.UsesPlayerName = Convert.ToBoolean(usesplayername);
info.UsesID = Convert.ToBoolean(usesid);
info.UsesPlayerName = ConvertSafe.ToBooleanSafe(usesplayername);
info.UsesID = ConvertSafe.ToBooleanSafe(usesid);
info.Warning = warning;
info.LegacyMode = Convert.ToBoolean(legacymode);
info.LegacyMode = ConvertSafe.ToBooleanSafe(legacymode);
info.ClientMD5 = clientmd5;
info.ScriptMD5 = scriptmd5;
info.Description = desc;
info.Fix2007 = Convert.ToBoolean(fix2007);
info.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity);
info.Fix2007 = ConvertSafe.ToBooleanSafe(fix2007);
info.AlreadyHasSecurity = ConvertSafe.ToBooleanSafe(alreadyhassecurity);
if (clientloadoptions.Equals("True") || clientloadoptions.Equals("False"))
{
info.ClientLoadOptions = Settings.GetClientLoadOptionsForBool(Convert.ToBoolean(clientloadoptions));
info.ClientLoadOptions = Settings.GetClientLoadOptionsForBool(ConvertSafe.ToBooleanSafe(clientloadoptions));
}
else
{
info.ClientLoadOptions = (Settings.ClientLoadOptions)Convert.ToInt32(clientloadoptions);
info.ClientLoadOptions = (Settings.ClientLoadOptions)ConvertSafe.ToInt32Safe(clientloadoptions);
}
info.SeperateFolders = Convert.ToBoolean(folders);
info.UsesCustomClientEXEName = Convert.ToBoolean(usescustomname);
info.SeperateFolders = ConvertSafe.ToBooleanSafe(folders);
info.UsesCustomClientEXEName = ConvertSafe.ToBooleanSafe(usescustomname);
info.CustomClientEXEName = customname;
info.CommandLineArgs = commandlineargs;
}
@ -425,7 +425,7 @@ namespace Novetus.Core
foreach (string file in fileListToDelete)
{
string fullFilePath = Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + file;
Util.FixedFileDelete(fullFilePath);
IOSafe.File.Delete(fullFilePath);
}
if (GlobalVars.UserConfiguration.ReadSettingInt("QualityLevel") != (int)Settings.Level.Custom)
@ -610,7 +610,7 @@ namespace Novetus.Core
{
if (dir.Contains(terms) && !dir.Contains("_default"))
{
Util.FixedFileCopy(dir, Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + Path.GetFileName(dir).Replace(terms, "")
IOSafe.File.Copy(dir, Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + Path.GetFileName(dir).Replace(terms, "")
.Replace(dir.Substring(dir.LastIndexOf('-') + 1), "")
.Replace("-", ".xml"), true);
}
@ -765,7 +765,7 @@ namespace Novetus.Core
finally
{
doc.Save(dir);
Util.FixedFileCopy(dir, Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + Path.GetFileName(dir).Replace(terms, "")
IOSafe.File.Copy(dir, Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + Path.GetFileName(dir).Replace(terms, "")
.Replace(dir.Substring(dir.LastIndexOf('-') + 1), "")
.Replace("-", ".xml"), true);
}
@ -970,7 +970,7 @@ namespace Novetus.Core
{
if (GlobalVars.isMapCompressed)
{
Util.FixedFileDelete(GlobalVars.UserConfiguration.ReadSetting("MapPath"));
IOSafe.File.Delete(GlobalVars.UserConfiguration.ReadSetting("MapPath"));
GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalVars.UserConfiguration.ReadSetting("MapPath").Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"));
GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.UserConfiguration.ReadSetting("Map").Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"));
GlobalVars.isMapCompressed = false;
@ -1420,7 +1420,7 @@ namespace Novetus.Core
string script = "\r\n" + File.ReadAllText(scriptFileName);
byte[] signature = rsaCSP.SignData(Encoding.Default.GetBytes(script), shaCSP);
// override file.
Util.FixedFileDelete(scriptFileName);
IOSafe.File.Delete(scriptFileName);
File.WriteAllText(scriptFileName, string.Format(format, Convert.ToBase64String(signature), script));
}
else
@ -1475,7 +1475,8 @@ namespace Novetus.Core
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
string serverIP = (type == ScriptType.SoloServer ? "localhost" : GlobalVars.CurrentServer.ServerIP);
int serverjoinport = (type == ScriptType.Solo ? GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort") : GlobalVars.CurrentServer.ServerPort);
int serverjoinport = (type == ScriptType.Solo ? GlobalVars.PlaySoloPort : GlobalVars.CurrentServer.ServerPort);
int serverhostport = (type == ScriptType.SoloServer ? GlobalVars.PlaySoloPort : GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort"));
string playerLimit = (type == ScriptType.SoloServer ? "1" : GlobalVars.UserConfiguration.ReadSetting("PlayerLimit"));
string joinNotifs = (type == ScriptType.SoloServer ? "false" : GlobalVars.UserConfiguration.ReadSetting("ShowServerNotifications").ToLower());
@ -1496,7 +1497,7 @@ namespace Novetus.Core
case ScriptType.Server:
case ScriptType.SoloServer:
return "_G.CSServer("
+ GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort") + ","
+ serverhostport + ","
+ playerLimit + ","
+ md5s + ","
+ joinNotifs
@ -1545,7 +1546,7 @@ namespace Novetus.Core
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + ClientManagement.GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua" :
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua");
Util.FixedFileDelete(outputPath);
IOSafe.File.Delete(outputPath);
bool shouldUseLoadFile = GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%useloadfile%");
string execScriptMethod = shouldUseLoadFile ? "loadfile" : "dofile";
@ -1735,7 +1736,7 @@ namespace Novetus.Core
public static string CopyMapToRBXAsset()
{
string clientcontentpath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\\content\\temp.rbxl";
Util.FixedFileCopy(GlobalVars.UserConfiguration.ReadSetting("MapPath"), clientcontentpath, true);
IOSafe.File.Copy(GlobalVars.UserConfiguration.ReadSetting("MapPath"), clientcontentpath, true);
return GlobalPaths.AltBaseGameDir + "temp.rbxl";
}

View File

@ -430,7 +430,7 @@ namespace Novetus.Core
{
string colorFixed = Regex.Replace(item.ColorRGB, @"[\[\]\{\}\(\)\<\> ]", "");
string[] rgbValues = colorFixed.Split(',');
item.ColorObject = Color.FromArgb(Convert.ToInt32(rgbValues[0]), Convert.ToInt32(rgbValues[1]), Convert.ToInt32(rgbValues[2]));
item.ColorObject = Color.FromArgb(ConvertSafe.ToInt32Safe(rgbValues[0]), ConvertSafe.ToInt32Safe(rgbValues[1]), ConvertSafe.ToInt32Safe(rgbValues[2]));
if (!(item.ColorName.Contains("[") && item.ColorName.Contains("]")))
{
@ -744,7 +744,7 @@ namespace Novetus.Core
{
try
{
Util.FixedFileCopy(openFileDialog1.FileName, dir + ".png", true);
IOSafe.File.Copy(openFileDialog1.FileName, dir + ".png", true);
if (CopyToItemDir)
{
@ -817,7 +817,7 @@ namespace Novetus.Core
try
{
GlobalVars.ExtendedVersionNumber = Convert.ToBoolean(extendedversionnumber);
GlobalVars.ExtendedVersionNumber = ConvertSafe.ToBooleanSafe(extendedversionnumber);
if (GlobalVars.ExtendedVersionNumber)
{
if (!string.IsNullOrWhiteSpace(exepath))
@ -840,7 +840,7 @@ namespace Novetus.Core
.Replace("%version-name%", verNumber);
}
bool changelogedit = Convert.ToBoolean(isSnapshot);
bool changelogedit = ConvertSafe.ToBooleanSafe(isSnapshot);
if (changelogedit)
{
@ -866,9 +866,9 @@ namespace Novetus.Core
GlobalVars.ProgramInformation.DefaultMap = defaultmap;
GlobalVars.ProgramInformation.RegisterClient1 = regclient1;
GlobalVars.ProgramInformation.RegisterClient2 = regclient2;
GlobalVars.ProgramInformation.InitialBootup = Convert.ToBoolean(initialBootup);
GlobalVars.ProgramInformation.InitialBootup = ConvertSafe.ToBooleanSafe(initialBootup);
GlobalVars.ProgramInformation.VersionName = verNumber;
GlobalVars.ProgramInformation.IsSnapshot = Convert.ToBoolean(isSnapshot);
GlobalVars.ProgramInformation.IsSnapshot = ConvertSafe.ToBooleanSafe(isSnapshot);
}
catch (Exception ex)
{
@ -884,7 +884,7 @@ namespace Novetus.Core
string section = "ProgramInfo";
string initialBootup = ini.IniReadValue(section, "InitialBootup", "True");
if (Convert.ToBoolean(initialBootup) == true)
if (ConvertSafe.ToBooleanSafe(initialBootup) == true)
{
ini.IniWriteValue(section, "InitialBootup", "False");
}

View File

@ -49,7 +49,7 @@ namespace Novetus.Core
{
string[] vals = input.Split(':');
string ip = vals[0];
int port = Convert.ToInt32(vals[1]);
int port = ConvertSafe.ToInt32Safe(vals[1]);
ServerIP = ip;
ServerPort = port;
@ -150,6 +150,7 @@ namespace Novetus.Core
public static bool isMapCompressed = false;
public static int Clicks = 0;
public static bool EasterEggMode = false;
public static int PlaySoloPort = 1027;
#endregion
}
#endregion

View File

@ -1,18 +0,0 @@
#region Vector3
namespace Novetus.Core
{
public class Vector3
{
public double X;
public double Y;
public double Z;
public Vector3(double aX, double aY, double aZ)
{
X = aX;
Y = aY;
Z = aZ;
}
}
}
#endregion

View File

@ -28,291 +28,7 @@ namespace Novetus.Core
public static class Util
{
#region Extensions
//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 Rich Text Box Extensions
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
box.SelectionColor = color;
box.AppendText(text);
//box.SelectionColor = box.ForeColor;
}
#endregion
#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 Substring Extensions
/// <summary>
/// Get string value between [first] a and [last] b.
/// </summary>
public static string Between(this string value, string a, string b)
{
int posA = value.IndexOf(a);
int posB = value.LastIndexOf(b);
if (posA == -1)
{
return "";
}
if (posB == -1)
{
return "";
}
int adjustedPosA = posA + a.Length;
if (adjustedPosA >= posB)
{
return "";
}
return value.Substring(adjustedPosA, posB - adjustedPosA);
}
/// <summary>
/// Get string value after [first] a.
/// </summary>
public static string Before(this string value, string a)
{
int posA = value.IndexOf(a);
if (posA == -1)
{
return "";
}
return value.Substring(0, posA);
}
/// <summary>
/// Get string value after [last] a.
/// </summary>
public static string After(this string value, string a)
{
int posA = value.LastIndexOf(a);
if (posA == -1)
{
return "";
}
int adjustedPosA = posA + a.Length;
if (adjustedPosA >= value.Length)
{
return "";
}
return value.Substring(adjustedPosA);
}
#endregion
#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 };
public static string Crypt(this string text)
{
SymmetricAlgorithm algorithm = DES.Create();
ICryptoTransform transform = algorithm.CreateEncryptor(key, iv);
byte[] inputbuffer = Encoding.Unicode.GetBytes(text);
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
return Convert.ToBase64String(outputBuffer);
}
public static string Decrypt(this string text)
{
SymmetricAlgorithm algorithm = DES.Create();
ICryptoTransform transform = algorithm.CreateDecryptor(key, iv);
byte[] inputbuffer = Convert.FromBase64String(text);
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
return Encoding.Unicode.GetString(outputBuffer);
}
#endregion
#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)
/// </summary>
/// <param name="exception">Source <see cref="Exception" /></param>
/// <returns>
/// <see cref="string" /> that represents the entire stack trace consisting of exception's footprints (File,
/// Method, LineNumber)
/// </returns>
public static string GetExceptionFootprints(this Exception exception)
{
StackTrace stackTrace = new StackTrace(exception, true);
StackFrame[] frames = stackTrace.GetFrames();
if (ReferenceEquals(frames, null))
{
return string.Empty;
}
var traceStringBuilder = new StringBuilder();
for (var i = 0; i < frames.Length; i++)
{
StackFrame frame = frames[i];
if (frame.GetFileLineNumber() < 1)
continue;
traceStringBuilder.AppendLine($"File: {frame.GetFileName()}");
traceStringBuilder.AppendLine($"Method: {frame.GetMethod().Name}");
traceStringBuilder.AppendLine($"LineNumber: {frame.GetFileLineNumber()}");
if (i == frames.Length - 1)
break;
traceStringBuilder.AppendLine(" ---> ");
}
string stackTraceFootprints = traceStringBuilder.ToString();
if (string.IsNullOrWhiteSpace(stackTraceFootprints))
return "NO DETECTED FOOTPRINTS";
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
#region DateTime Extensions
//https://stackoverflow.com/questions/5672862/check-if-datetime-instance-falls-in-between-other-two-datetime-objects
public static bool IsBetweenTwoDates(this DateTime dt, DateTime start, DateTime end)
{
return dt >= start && dt <= end;
}
#endregion
#region Form Extensions
[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
#endregion
#region Utility Functions
private static DialogResult ShowOverrideWarning(string dest)
{
DialogResult box = MessageBox.Show("A file with a similar name was detected in the directory as '" + dest +
"'.\n\nWould you like to override it?", "Novetus - Override Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
return box;
}
public static void FixedFileCopy(string src, string dest, bool overwrite, bool overwritewarning = false)
{
if (File.Exists(dest))
{
if (overwrite && overwritewarning)
{
if (ShowOverrideWarning(dest) == DialogResult.No)
{
return;
}
}
File.SetAttributes(dest, FileAttributes.Normal);
}
File.Copy(src, dest, overwrite);
File.SetAttributes(dest, FileAttributes.Normal);
}
public static void FixedFileDelete(string src)
{
if (File.Exists(src))
{
File.SetAttributes(src, FileAttributes.Normal);
File.Delete(src);
}
}
public static void FixedFileMove(string src, string dest, bool overwrite, bool overwritewarning = false)
{
if (src.Equals(dest))
return;
if (!File.Exists(dest))
{
File.SetAttributes(src, FileAttributes.Normal);
File.Move(src, dest);
}
else
{
if (overwrite)
{
if (overwritewarning)
{
if (ShowOverrideWarning(dest) == DialogResult.No)
{
return;
}
}
FixedFileDelete(dest);
File.SetAttributes(src, FileAttributes.Normal);
File.Move(src, dest);
}
else
{
throw new IOException("Cannot create a file when that file already exists. FixedFileMove cannot override files with overwrite disabled.");
}
}
}
//modified from the following:
//https://stackoverflow.com/questions/28887314/performance-of-image-loading
@ -345,8 +61,8 @@ namespace Novetus.Core
{
LogExceptions(ex);
#else
catch (Exception)
{
catch (Exception)
{
#endif
if (!string.IsNullOrWhiteSpace(fallbackFileFullName))
image = LoadImage(fallbackFileFullName);
@ -482,7 +198,7 @@ namespace Novetus.Core
fileName = Regex.Replace(fileName, @"[^\w-.'_!()& ]", "");
string finalPath = pathWithoutFilename + "\\" + fileName;
FixedFileMove(path, finalPath, File.Exists(finalPath));
IOSafe.File.Move(path, finalPath, File.Exists(finalPath));
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
@ -750,7 +466,7 @@ namespace Novetus.Core
try
{
string[] vals = line.Split('|');
ConsolePrint(vals[0], Convert.ToInt32(vals[1]), true, scrollDown);
ConsolePrint(vals[0], ConvertSafe.ToInt32Safe(vals[1]), true, scrollDown);
}
catch (Exception)
{

View File

@ -144,7 +144,7 @@ public class ModManager
{
try
{
Util.FixedFileCopy(openFileDialog1.FileName, GlobalPaths.AddonDir + @"\" + openFileDialog1.SafeFileName, false);
IOSafe.File.Copy(openFileDialog1.FileName, GlobalPaths.AddonDir + @"\" + openFileDialog1.SafeFileName, false);
string AddonPath = GlobalPaths.AddonCoreDir + "\\" + GlobalPaths.AddonLoaderFileName;
var lines = File.ReadLines(AddonPath);
@ -194,7 +194,7 @@ public class ModManager
if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
{
double percentage = Math.Round(e.BytesTransferred / (0.01 * e.TotalBytesToTransfer), 2);
int intPercent = Convert.ToInt32(percentage);
int intPercent = ConvertSafe.ToInt32Safe(percentage);
if (intPercent % 25 == 0 && pastPercentage != intPercent)
{
@ -259,7 +259,7 @@ public class ModManager
Directory.CreateDirectory(fileInfo.DirectoryName);
}
Util.FixedFileMove(originalPath, destPath, true);
IOSafe.File.Move(originalPath, destPath, true);
++filecount;
}

View File

@ -114,7 +114,7 @@ public class Splash
if (date.Contains('/'))
{
string[] subs = date.Split('/');
return new DateTime(DateTime.Now.Year, Convert.ToInt32(subs[0]), Convert.ToInt32(subs[1]), CultureInfo.InvariantCulture.Calendar);
return new DateTime(DateTime.Now.Year, ConvertSafe.ToInt32Safe(subs[0]), ConvertSafe.ToInt32Safe(subs[1]), CultureInfo.InvariantCulture.Calendar);
}
return DateTime.Now;
@ -165,8 +165,6 @@ public class Splash
.Replace("%nextyear%", (now.Year + 1).ToString())
.Replace("%newline%", "\n")
.Replace("%branch%", GlobalVars.ProgramInformation.Branch)
// this caused a shitton of issues.
//.Replace("%nextbranch%", (Convert.ToDouble(GlobalVars.ProgramInformation.Branch) + 0.1).ToString())
.Replace("[normal]", "")
.Replace("[stylish]", "");
}

View File

@ -74,7 +74,7 @@ namespace NovetusLauncher
try
{
MeshDetail = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float));
MeshDetail = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float));
GraphicsMeshQuality.Value = MeshDetail;
}
catch (Exception)
@ -84,7 +84,7 @@ namespace NovetusLauncher
try
{
ShadingQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float));
ShadingQuality = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float));
GraphicsShadingQuality.Value = ShadingQuality;
}
catch (Exception)
@ -94,14 +94,14 @@ namespace NovetusLauncher
try
{
MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token));
MaterialQuality = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token));
GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
}
catch (Exception)
{
try
{
MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token));
MaterialQuality = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token));
GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
}
catch (Exception)
@ -112,7 +112,7 @@ namespace NovetusLauncher
try
{
AA = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token));
AA = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token));
GraphicsAntiAliasing.SelectedIndex = AA;
}
catch (Exception)
@ -122,7 +122,7 @@ namespace NovetusLauncher
try
{
AASamples = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "AASamples", XMLTypes.Token));
AASamples = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "AASamples", XMLTypes.Token));
switch (AASamples)
{
@ -144,7 +144,7 @@ namespace NovetusLauncher
try
{
Bevels = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token));
Bevels = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token));
GraphicsBevels.SelectedIndex = Bevels;
}
catch (Exception)
@ -154,7 +154,7 @@ namespace NovetusLauncher
try
{
Shadows_2008 = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token));
Shadows_2008 = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token));
GraphicsShadows2008.SelectedIndex = Shadows_2008;
}
catch (Exception)
@ -164,14 +164,14 @@ namespace NovetusLauncher
try
{
Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool));
Shadows_2007 = ConvertSafe.ToBooleanSafe(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool));
}
catch (Exception)
{
// try doing march 2007.
try
{
Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool));
Shadows_2007 = ConvertSafe.ToBooleanSafe(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool));
}
catch (Exception)
{
@ -216,7 +216,7 @@ namespace NovetusLauncher
try
{
QualityLevel = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token));
QualityLevel = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token));
GraphicsLevel.Value = QualityLevel;
}
catch (Exception)
@ -278,7 +278,7 @@ namespace NovetusLauncher
try
{
ModernResolution = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Resolution", XMLTypes.Token));
ModernResolution = ConvertSafe.ToInt32Safe(RobloxXML.GetRenderSettings(doc, "Resolution", XMLTypes.Token));
GraphicsModernResolution.SelectedIndex = ModernResolution;
}
catch (Exception ex)
@ -313,7 +313,7 @@ namespace NovetusLauncher
GraphicsLevel.Value = 19;
}
QualityLevel = Convert.ToInt32(GraphicsLevel.Value);
QualityLevel = ConvertSafe.ToInt32Safe(GraphicsLevel.Value);
}
private void GraphicsLevel_Click(object sender, EventArgs e)
@ -327,12 +327,12 @@ namespace NovetusLauncher
private void GraphicsMeshQuality_ValueChanged(object sender, EventArgs e)
{
MeshDetail = Convert.ToInt32(GraphicsMeshQuality.Value);
MeshDetail = ConvertSafe.ToInt32Safe(GraphicsMeshQuality.Value);
}
private void GraphicsShadingQuality_ValueChanged(object sender, EventArgs e)
{
ShadingQuality = Convert.ToInt32(GraphicsShadingQuality.Value);
ShadingQuality = ConvertSafe.ToInt32Safe(GraphicsShadingQuality.Value);
}
private void GraphicsMaterialQuality_SelectedIndexChanged(object sender, EventArgs e)

View File

@ -179,7 +179,7 @@ namespace NovetusLauncher
void NumericUpDown3ValueChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", Convert.ToInt32(numericUpDown3.Value));
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", ConvertSafe.ToInt32Safe(numericUpDown3.Value));
}
void Button22Click(object sender, EventArgs e)

View File

@ -184,7 +184,7 @@ namespace NovetusLauncher
void NumericUpDown3ValueChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", Convert.ToInt32(numericUpDown3.Value));
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", ConvertSafe.ToInt32Safe(numericUpDown3.Value));
}
void Button22Click(object sender, EventArgs e)

View File

@ -27,7 +27,7 @@ namespace NovetusLauncher
{
string[] subs = text.Split('|');
NameText = subs[0];
NameID = Convert.ToInt32(subs[1]);
NameID = ConvertSafe.ToInt32Safe(subs[1]);
}
}
@ -131,12 +131,13 @@ namespace NovetusLauncher
}
}
//TODO: these next five methods are temporary. REMOVE THEM.
public void CheckDependencies()
{
bool VC2005 = CheckClientDependency(VCPPRedist.VCPP2005);
bool VC2008 = CheckClientDependency(VCPPRedist.VCPP2008);
bool VC2012 = CheckClientDependency(VCPPRedist.VCPP2012);
bool isAllInstalled = VC2005 && VC2008 && (VC2012 || !VC2012);
bool isAllInstalled = VC2005 && VC2008 && VC2012;
if (isAllInstalled)
{
@ -687,7 +688,7 @@ namespace NovetusLauncher
CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.ReadSettingBool("CloseOnLaunch");
PlayerIDTextBox.Text = GlobalVars.UserConfiguration.ReadSetting("UserID");
PlayerTripcodeLabel.Text = GlobalVars.PlayerTripcode.ToString();
PlayerLimitBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.ReadSettingInt("PlayerLimit"));
PlayerLimitBox.Value = ConvertSafe.ToDecimalSafe(GlobalVars.UserConfiguration.ReadSettingInt("PlayerLimit"));
PlayerNameTextBox.Text = GlobalVars.UserConfiguration.ReadSetting("PlayerName");
SelectedClientLabel.Text = GlobalVars.UserConfiguration.ReadSetting("SelectedClient");
ChangeClient();
@ -695,7 +696,7 @@ namespace NovetusLauncher
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.ReadSetting("Map"), Tree.Nodes);
Tree.Focus();
IPBox.Text = GlobalVars.CurrentServer.ToString();
HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort"));
HostPortBox.Value = ConvertSafe.ToDecimalSafe(GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort"));
IPLabel.Text = GlobalVars.CurrentServer.ServerIP;
PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString();
DiscordRichPresenceCheckbox.Checked = GlobalVars.UserConfiguration.ReadSettingBool("DiscordRichPresence");
@ -1038,13 +1039,13 @@ namespace NovetusLauncher
public void SelectPortListing()
{
GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(PortBox.SelectedItem.ToString());
GlobalVars.CurrentServer.ServerPort = ConvertSafe.ToInt32Safe(PortBox.SelectedItem.ToString());
IPBox.Text = GlobalVars.CurrentServer.ToString();
}
public void ResetCurPort(NumericUpDown box)
{
box.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
box.Value = ConvertSafe.ToDecimalSafe(GlobalVars.DefaultRobloxPort);
}
public void ChangeServerAddress()
@ -1070,7 +1071,7 @@ namespace NovetusLauncher
public void ChangeServerPort()
{
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", Convert.ToInt32(HostPortBox.Value));
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", ConvertSafe.ToInt32Safe(HostPortBox.Value));
}
public void ChangeClient()
@ -1172,7 +1173,7 @@ namespace NovetusLauncher
}
else
{
GlobalVars.UserConfiguration.SaveSettingInt("UserID", Convert.ToInt32(PlayerIDTextBox.Text));
GlobalVars.UserConfiguration.SaveSettingInt("UserID", ConvertSafe.ToInt32Safe(PlayerIDTextBox.Text));
}
}
else
@ -1222,7 +1223,7 @@ namespace NovetusLauncher
try
{
Util.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true);
IOSafe.File.Copy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true);
}
catch (Exception ex)
{

View File

@ -311,22 +311,7 @@ namespace NovetusLauncher
if (!IsLoaded)
return;
int parsedValue;
if (int.TryParse(userIDBox.Text, out parsedValue))
{
if (userIDBox.Text.Equals(""))
{
GlobalVars.UserConfiguration.SaveSettingInt("UserID", 0);
}
else
{
GlobalVars.UserConfiguration.SaveSettingInt("UserID", Convert.ToInt32(userIDBox.Text));
}
}
else
{
GlobalVars.UserConfiguration.SaveSettingInt("UserID", 0);
}
GlobalVars.UserConfiguration.SaveSettingInt("UserID", ConvertSafe.ToInt32Safe(userIDBox.Text));
}
private void ipAddressBox_TextChanged(object sender, TextChangedEventArgs e)
@ -340,14 +325,14 @@ namespace NovetusLauncher
{
if (!IsLoaded)
return;
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", Convert.ToInt32(serverPortBox.Text));
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", ConvertSafe.ToInt32Safe(serverPortBox.Text));
}
private void maxPlayersBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (!IsLoaded)
return;
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", Convert.ToInt32(maxPlayersBox.Text));
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", ConvertSafe.ToInt32Safe(maxPlayersBox.Text));
}
private void uPnPBox_Checked(object sender, RoutedEventArgs e)

View File

@ -150,12 +150,12 @@ namespace NovetusLauncher
if (ConsoleArgs["hostport"] != null)
{
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", Convert.ToInt32(ConsoleArgs["hostport"]));
GlobalVars.UserConfiguration.SaveSettingInt("RobloxPort", ConvertSafe.ToInt32Safe(ConsoleArgs["hostport"]));
}
if (ConsoleArgs["upnp"] != null)
{
GlobalVars.UserConfiguration.SaveSettingBool("UPnP", Convert.ToBoolean(ConsoleArgs["upnp"]));
GlobalVars.UserConfiguration.SaveSettingBool("UPnP", ConvertSafe.ToBooleanSafe(ConsoleArgs["upnp"]));
if (GlobalVars.UserConfiguration.ReadSettingBool("UPnP"))
{
@ -169,7 +169,7 @@ namespace NovetusLauncher
if (ConsoleArgs["notifications"] != null)
{
GlobalVars.UserConfiguration.SaveSettingBool("ShowServerNotifications", Convert.ToBoolean(ConsoleArgs["notifications"]));
GlobalVars.UserConfiguration.SaveSettingBool("ShowServerNotifications", ConvertSafe.ToBooleanSafe(ConsoleArgs["notifications"]));
if (GlobalVars.UserConfiguration.ReadSettingBool("ShowServerNotifications"))
{
@ -183,7 +183,7 @@ namespace NovetusLauncher
if (ConsoleArgs["maxplayers"] != null)
{
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", Convert.ToInt32(ConsoleArgs["maxplayers"]));
GlobalVars.UserConfiguration.SaveSettingInt("PlayerLimit", ConvertSafe.ToInt32Safe(ConsoleArgs["maxplayers"]));
}
if (ConsoleArgs["serverbrowsername"] != null)

View File

@ -227,7 +227,7 @@ public partial class AssetDownloader : Form
AssetDownloader_AssetNameBox.Text,
url,
AssetDownloader_AssetIDBox.Text,
Convert.ToInt32(AssetDownloader_AssetVersionSelector.Value),
ConvertSafe.ToInt32Safe(AssetDownloader_AssetVersionSelector.Value),
isWebSite);
}
else
@ -275,7 +275,7 @@ public partial class AssetDownloader : Form
linesplit[0] + extension,
url,
linesplit[1],
Convert.ToInt32(linesplit[2]),
ConvertSafe.ToInt32Safe(linesplit[2]),
isWebSite, basepath);
if (!noErrors)
@ -288,7 +288,7 @@ public partial class AssetDownloader : Form
string extraText = (lines.Count() != lineCount) ? "\n" + (lines.Count() - lineCount) + " errors were detected during the download. Make sure your IDs and links are valid." : "";
MessageBox.Show("Batch download complete! " + lineCount + " items downloaded! " + Util.SizeSuffix(Convert.ToInt64(batchDownloadSize), 2) + " written (" + batchDownloadSize + " bytes)!" + extraText, "Asset Downloader - Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Batch download complete! " + lineCount + " items downloaded! " + Util.SizeSuffix(ConvertSafe.ToInt64Safe(batchDownloadSize), 2) + " written (" + batchDownloadSize + " bytes)!" + extraText, "Asset Downloader - Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)

View File

@ -333,7 +333,7 @@ public partial class AssetFixer : Form
{
try
{
Util.FixedFileCopy(fixedPath, fixedPath + ".bak", false);
IOSafe.File.Copy(fixedPath, fixedPath + ".bak", false);
}
catch (Exception ex)
{
@ -349,7 +349,7 @@ public partial class AssetFixer : Form
{
if (compressedMap)
{
Util.FixedFileDelete(fixedPath);
IOSafe.File.Delete(fixedPath);
compressedMap = false;
}
@ -363,7 +363,7 @@ public partial class AssetFixer : Form
{
//compress adds bz2 to our file though? this shouldn't be necessary.
Util.Compress(fixedPath, true);
Util.FixedFileDelete(fixedPath);
IOSafe.File.Delete(fixedPath);
compressedMap = false;
}
}

View File

@ -179,7 +179,7 @@ public partial class ClientinfoEditor : Form
if (!GlobalVars.AdminMode)
{
bool lockcheck = Convert.ToBoolean(locked);
bool lockcheck = ConvertSafe.ToBooleanSafe(locked);
if (lockcheck)
{
NewClientInfo();
@ -194,21 +194,21 @@ public partial class ClientinfoEditor : Form
}
else
{
Locked = Convert.ToBoolean(locked);
Locked = ConvertSafe.ToBooleanSafe(locked);
checkBox4.Checked = Locked;
}
SelectedClientInfo.UsesPlayerName = Convert.ToBoolean(usesplayername);
SelectedClientInfo.UsesID = Convert.ToBoolean(usesid);
SelectedClientInfo.UsesPlayerName = ConvertSafe.ToBooleanSafe(usesplayername);
SelectedClientInfo.UsesID = ConvertSafe.ToBooleanSafe(usesid);
SelectedClientInfo.Warning = warning;
SelectedClientInfo.LegacyMode = Convert.ToBoolean(legacymode);
SelectedClientInfo.LegacyMode = ConvertSafe.ToBooleanSafe(legacymode);
SelectedClientInfo.ClientMD5 = clientmd5;
SelectedClientInfo.ScriptMD5 = scriptmd5;
SelectedClientInfo.Description = desc;
SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007);
SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity);
SelectedClientInfo.SeperateFolders = Convert.ToBoolean(folders);
SelectedClientInfo.UsesCustomClientEXEName = Convert.ToBoolean(usescustomname);
SelectedClientInfo.Fix2007 = ConvertSafe.ToBooleanSafe(fix2007);
SelectedClientInfo.AlreadyHasSecurity = ConvertSafe.ToBooleanSafe(alreadyhassecurity);
SelectedClientInfo.SeperateFolders = ConvertSafe.ToBooleanSafe(folders);
SelectedClientInfo.UsesCustomClientEXEName = ConvertSafe.ToBooleanSafe(usescustomname);
SelectedClientInfo.CustomClientEXEName = customname;
try
@ -218,11 +218,11 @@ public partial class ClientinfoEditor : Form
if (cmdargsorclientoptions.Equals("True") || cmdargsorclientoptions.Equals("False"))
{
label9.Text = "v2 (Last used in v1.2.3)";
SelectedClientInfo.ClientLoadOptions = Settings.GetClientLoadOptionsForBool(Convert.ToBoolean(cmdargsorclientoptions));
SelectedClientInfo.ClientLoadOptions = Settings.GetClientLoadOptionsForBool(ConvertSafe.ToBooleanSafe(cmdargsorclientoptions));
}
else
{
SelectedClientInfo.ClientLoadOptions = (Settings.ClientLoadOptions)Convert.ToInt32(cmdargsorclientoptions);
SelectedClientInfo.ClientLoadOptions = (Settings.ClientLoadOptions)ConvertSafe.ToInt32Safe(cmdargsorclientoptions);
}
SelectedClientInfo.CommandLineArgs = commandargsver2;
}

View File

@ -1,5 +1,6 @@
#region Usings
using Novetus.Core;
using RobloxFiles.DataTypes;
using System;
using System.Collections.Generic;
using System.Drawing;
@ -133,22 +134,22 @@ public partial class ItemCreationSDK : Form
type,
ItemName,
new string[] { Option1Path, Option2Path, Option1TextBox.Text, Option2TextBox.Text },
new Vector3(Convert.ToDouble(XBox.Value), Convert.ToDouble(YBox.Value), Convert.ToDouble(ZBox.Value)),
new Vector3(Convert.ToDouble(XBox360.Value), Convert.ToDouble(YBox2.Value), Convert.ToDouble(ZBox2.Value)),
new Vector3(Convert.ToDouble(XBoxOne.Value), Convert.ToDouble(YBox3.Value), Convert.ToDouble(ZBox3.Value)),
new Vector3(ConvertSafe.ToSingleSafe(XBox.Value), ConvertSafe.ToSingleSafe(YBox.Value), ConvertSafe.ToSingleSafe(ZBox.Value)),
new Vector3(ConvertSafe.ToSingleSafe(XBox360.Value), ConvertSafe.ToSingleSafe(YBox2.Value), ConvertSafe.ToSingleSafe(ZBox2.Value)),
new Vector3(ConvertSafe.ToSingleSafe(XBoxOne.Value), ConvertSafe.ToSingleSafe(YBox3.Value), ConvertSafe.ToSingleSafe(ZBox3.Value)),
new Vector3[] {
new Vector3(Convert.ToDouble(rightXBox.Value), Convert.ToDouble(rightYBox.Value), Convert.ToDouble(rightZBox.Value)),
new Vector3(Convert.ToDouble(upXBox.Value), Convert.ToDouble(upYBox.Value), Convert.ToDouble(upZBox.Value)),
new Vector3(Convert.ToDouble(-forwardXBox.Value), Convert.ToDouble(-forwardYBox.Value), Convert.ToDouble(-forwardZBox.Value)) },
Convert.ToDouble(transparencyBox.Value),
Convert.ToDouble(reflectivenessBox.Value),
new object[] { Convert.ToDouble(BevelBox.Value),
Convert.ToDouble(RoundnessBox.Value),
Convert.ToDouble(BulgeBox.Value),
new Vector3(ConvertSafe.ToSingleSafe(rightXBox.Value), ConvertSafe.ToSingleSafe(rightYBox.Value), ConvertSafe.ToSingleSafe(rightZBox.Value)),
new Vector3(ConvertSafe.ToSingleSafe(upXBox.Value), ConvertSafe.ToSingleSafe(upYBox.Value), ConvertSafe.ToSingleSafe(upZBox.Value)),
new Vector3(ConvertSafe.ToSingleSafe(-forwardXBox.Value), ConvertSafe.ToSingleSafe(-forwardYBox.Value), ConvertSafe.ToSingleSafe(-forwardZBox.Value)) },
ConvertSafe.ToDoubleSafe(transparencyBox.Value),
ConvertSafe.ToDoubleSafe(reflectivenessBox.Value),
new object[] { ConvertSafe.ToDoubleSafe(BevelBox.Value),
ConvertSafe.ToDoubleSafe(RoundnessBox.Value),
ConvertSafe.ToDoubleSafe(BulgeBox.Value),
SpecialMeshTypeBox.SelectedIndex,
MeshTypeBox.SelectedItem.ToString(),
Convert.ToInt32(LODXBox.Value),
Convert.ToInt32(LODYBox.Value)},
ConvertSafe.ToInt32Safe(LODXBox.Value),
ConvertSafe.ToInt32Safe(LODYBox.Value)},
DescBox.Text
))
{
@ -307,7 +308,7 @@ public partial class ItemCreationSDK : Form
{
if (!string.IsNullOrWhiteSpace(assetpath))
{
Util.FixedFileCopy(assetpath, outputPath + "\\" + assetfilename, true);
IOSafe.File.Copy(assetpath, outputPath + "\\" + assetfilename, true);
}
item3.Value = inGameDir + assetfilename;
}
@ -1364,13 +1365,13 @@ public partial class ItemCreationSDK : Form
SetItemFontVals(doc, RobloxDefs.ItemPantsTexture, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
break;
case RobloxFileType.HeadNoCustomMesh:
SetHeadBevel(doc, Convert.ToDouble(headoptions[0]),
Convert.ToDouble(headoptions[1]),
Convert.ToDouble(headoptions[2]),
Convert.ToInt32(headoptions[3]),
SetHeadBevel(doc, ConvertSafe.ToDoubleSafe(headoptions[0]),
ConvertSafe.ToDoubleSafe(headoptions[1]),
ConvertSafe.ToDoubleSafe(headoptions[2]),
ConvertSafe.ToInt32Safe(headoptions[3]),
headoptions[4].ToString(),
Convert.ToInt32(headoptions[5]),
Convert.ToInt32(headoptions[6]));
ConvertSafe.ToInt32Safe(headoptions[5]),
ConvertSafe.ToInt32Safe(headoptions[6]));
SetItemCoordValsNoClassSearch(doc, coordoptions, "Vector3", "Scale");
SetItemCoordValsNoClassSearch(doc, coordoptions2, "Vector3", "VertexColor");
break;
@ -1444,9 +1445,9 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HatCoords))
{
string[] HatCoordsSplit = HatCoords.Split(',');
XBox.Value = Convert.ToDecimal(HatCoordsSplit[0]);
YBox.Value = Convert.ToDecimal(HatCoordsSplit[1]);
ZBox.Value = Convert.ToDecimal(HatCoordsSplit[2]);
XBox.Value = ConvertSafe.ToDecimalSafe(HatCoordsSplit[0]);
YBox.Value = ConvertSafe.ToDecimalSafe(HatCoordsSplit[1]);
ZBox.Value = ConvertSafe.ToDecimalSafe(HatCoordsSplit[2]);
}
string HatScaleCoords = GetHatMeshVals(doc, "Vector3", "Scale");
@ -1454,9 +1455,9 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HatScaleCoords))
{
string[] HatScaleCoordsSplit = HatScaleCoords.Split(',');
XBox360.Value = Convert.ToDecimal(HatScaleCoordsSplit[0]);
YBox2.Value = Convert.ToDecimal(HatScaleCoordsSplit[1]);
ZBox2.Value = Convert.ToDecimal(HatScaleCoordsSplit[2]);
XBox360.Value = ConvertSafe.ToDecimalSafe(HatScaleCoordsSplit[0]);
YBox2.Value = ConvertSafe.ToDecimalSafe(HatScaleCoordsSplit[1]);
ZBox2.Value = ConvertSafe.ToDecimalSafe(HatScaleCoordsSplit[2]);
}
string HatColorCoords = GetHatMeshVals(doc, "Vector3", "VertexColor");
@ -1464,9 +1465,9 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HatColorCoords))
{
string[] HatColorCoordsSplit = HatColorCoords.Split(',');
XBoxOne.Value = Convert.ToDecimal(HatColorCoordsSplit[0]);
YBox3.Value = Convert.ToDecimal(HatColorCoordsSplit[1]);
ZBox3.Value = Convert.ToDecimal(HatColorCoordsSplit[2]);
XBoxOne.Value = ConvertSafe.ToDecimalSafe(HatColorCoordsSplit[0]);
YBox3.Value = ConvertSafe.ToDecimalSafe(HatColorCoordsSplit[1]);
ZBox3.Value = ConvertSafe.ToDecimalSafe(HatColorCoordsSplit[2]);
}
string HatRotation = GetItemRotationVals(doc, "Hat", "CoordinateFrame", "AttachmentPoint");
@ -1474,15 +1475,15 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HatRotation))
{
string[] HatRotationSplit = HatRotation.Split(',');
rightXBox.Value = Convert.ToDecimal(HatRotationSplit[0]);
rightYBox.Value = Convert.ToDecimal(HatRotationSplit[1]);
rightZBox.Value = Convert.ToDecimal(HatRotationSplit[2]);
upXBox.Value = Convert.ToDecimal(HatRotationSplit[3]);
upYBox.Value = Convert.ToDecimal(HatRotationSplit[4]);
upZBox.Value = Convert.ToDecimal(HatRotationSplit[5]);
forwardXBox.Value = -Convert.ToDecimal(HatRotationSplit[6]);
forwardYBox.Value = -Convert.ToDecimal(HatRotationSplit[7]);
forwardZBox.Value = -Convert.ToDecimal(HatRotationSplit[8]);
rightXBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[0]);
rightYBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[1]);
rightZBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[2]);
upXBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[3]);
upYBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[4]);
upZBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[5]);
forwardXBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[6]);
forwardYBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[7]);
forwardZBox.Value = ConvertSafe.ToDecimalSafe(HatRotationSplit[8]);
}
string HatPartVals = GetHatPartVals(doc);
@ -1490,10 +1491,10 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HatPartVals))
{
string[] HatPartValsSplit = HatPartVals.Split(',');
partColorID = Convert.ToInt32(HatPartValsSplit[0]);
partColorID = ConvertSafe.ToInt32Safe(HatPartValsSplit[0]);
partColorLabel.Text = partColorID.ToString();
reflectivenessBox.Value = Convert.ToDecimal(HatPartValsSplit[1]);
transparencyBox.Value = Convert.ToDecimal(HatPartValsSplit[2]);
reflectivenessBox.Value = ConvertSafe.ToDecimalSafe(HatPartValsSplit[1]);
transparencyBox.Value = ConvertSafe.ToDecimalSafe(HatPartValsSplit[2]);
}
break;
@ -1506,15 +1507,15 @@ public partial class ItemCreationSDK : Form
{
string[] BevelCoordsSplit = BevelCoords.Split(',');
BevelBox.Value = Convert.ToDecimal(BevelCoordsSplit[0]);
RoundnessBox.Value = Convert.ToDecimal(BevelCoordsSplit[1]);
BulgeBox.Value = Convert.ToDecimal(BevelCoordsSplit[2]);
LODXBox.Value = Convert.ToDecimal(BevelCoordsSplit[3]);
LODYBox.Value = Convert.ToDecimal(BevelCoordsSplit[4]);
BevelBox.Value = ConvertSafe.ToDecimalSafe(BevelCoordsSplit[0]);
RoundnessBox.Value = ConvertSafe.ToDecimalSafe(BevelCoordsSplit[1]);
BulgeBox.Value = ConvertSafe.ToDecimalSafe(BevelCoordsSplit[2]);
LODXBox.Value = ConvertSafe.ToDecimalSafe(BevelCoordsSplit[3]);
LODYBox.Value = ConvertSafe.ToDecimalSafe(BevelCoordsSplit[4]);
if (!string.IsNullOrWhiteSpace(BevelCoordsSplit[5]))
{
SpecialMeshTypeBox.SelectedIndex = Convert.ToInt32(BevelCoordsSplit[5]);
SpecialMeshTypeBox.SelectedIndex = ConvertSafe.ToInt32Safe(BevelCoordsSplit[5]);
}
}
@ -1522,18 +1523,18 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HeadScaleCoords))
{
string[] HeadScaleCoordsSplit = HeadScaleCoords.Split(',');
XBox.Value = Convert.ToDecimal(HeadScaleCoordsSplit[0]);
YBox.Value = Convert.ToDecimal(HeadScaleCoordsSplit[1]);
ZBox.Value = Convert.ToDecimal(HeadScaleCoordsSplit[2]);
XBox.Value = ConvertSafe.ToDecimalSafe(HeadScaleCoordsSplit[0]);
YBox.Value = ConvertSafe.ToDecimalSafe(HeadScaleCoordsSplit[1]);
ZBox.Value = ConvertSafe.ToDecimalSafe(HeadScaleCoordsSplit[2]);
}
string HeadColorCoords = GetItemCoordValsNoClassSearch(doc, "Vector3", "VertexColor");
if (!string.IsNullOrWhiteSpace(HeadColorCoords))
{
string[] HeadColorCoordsSplit = HeadColorCoords.Split(',');
XBox360.Value = Convert.ToDecimal(HeadColorCoordsSplit[0]);
YBox2.Value = Convert.ToDecimal(HeadColorCoordsSplit[1]);
ZBox2.Value = Convert.ToDecimal(HeadColorCoordsSplit[2]);
XBox360.Value = ConvertSafe.ToDecimalSafe(HeadColorCoordsSplit[0]);
YBox2.Value = ConvertSafe.ToDecimalSafe(HeadColorCoordsSplit[1]);
ZBox2.Value = ConvertSafe.ToDecimalSafe(HeadColorCoordsSplit[2]);
}
ItemTypeListBox.SelectedIndex = 2;
@ -1550,18 +1551,18 @@ public partial class ItemCreationSDK : Form
if (!string.IsNullOrWhiteSpace(HeadMeshScaleCoords))
{
string[] HeadMeshScaleCoordsSplit = HeadMeshScaleCoords.Split(',');
XBox.Value = Convert.ToDecimal(HeadMeshScaleCoordsSplit[0]);
YBox.Value = Convert.ToDecimal(HeadMeshScaleCoordsSplit[1]);
ZBox.Value = Convert.ToDecimal(HeadMeshScaleCoordsSplit[2]);
XBox.Value = ConvertSafe.ToDecimalSafe(HeadMeshScaleCoordsSplit[0]);
YBox.Value = ConvertSafe.ToDecimalSafe(HeadMeshScaleCoordsSplit[1]);
ZBox.Value = ConvertSafe.ToDecimalSafe(HeadMeshScaleCoordsSplit[2]);
}
string HeadMeshColorCoords = GetItemCoordVals(doc, RobloxDefs.ItemHeadFonts, "Vector3", "VertexColor");
if (!string.IsNullOrWhiteSpace(HeadMeshColorCoords))
{
string[] HeadMeshColorCoordsSplit = HeadMeshColorCoords.Split(',');
XBox360.Value = Convert.ToDecimal(HeadMeshColorCoordsSplit[0]);
YBox2.Value = Convert.ToDecimal(HeadMeshColorCoordsSplit[1]);
ZBox2.Value = Convert.ToDecimal(HeadMeshColorCoordsSplit[2]);
XBox360.Value = ConvertSafe.ToDecimalSafe(HeadMeshColorCoordsSplit[0]);
YBox2.Value = ConvertSafe.ToDecimalSafe(HeadMeshColorCoordsSplit[1]);
ZBox2.Value = ConvertSafe.ToDecimalSafe(HeadMeshColorCoordsSplit[2]);
}
ItemTypeListBox.SelectedIndex = 1;
@ -1857,7 +1858,7 @@ public partial class ItemCreationSDK : Form
if (File.Exists(previconpath) && !File.Exists(rbxmpath))
{
Util.FixedFileDelete(previconpath);
IOSafe.File.Delete(previconpath);
}
}

View File

@ -34,7 +34,7 @@ public partial class ItemCreationSDKColorMenu : Form
return;
}
parent.partColorID = Convert.ToInt32(colorMenu.Items[selectedIndex].Tag);
parent.partColorID = ConvertSafe.ToInt32Safe(colorMenu.Items[selectedIndex].Tag);
parent.partColorLabel.Text = parent.partColorID.ToString();
Close();
}

View File

@ -271,7 +271,7 @@ public partial class XMLContentEditor : Form
case XMLContentType.PartColors:
PartColor pc = new PartColor();
pc.ColorRawName = data.Cells[0].Value.ToString();
pc.ColorID = Convert.ToInt32(data.Cells[1].Value);
pc.ColorID = ConvertSafe.ToInt32Safe(data.Cells[1].Value);
pc.ColorRGB = data.Cells[2].Value.ToString();
partColorList.Add(pc);
break;

View File

@ -255,7 +255,7 @@ namespace NovetusLauncher
{
ServerName = SecurityFuncs.Decode(name, true);
ServerIP = SecurityFuncs.Decode(ip, true);
ServerPort = Convert.ToInt32(SecurityFuncs.Decode(port, true));
ServerPort = ConvertSafe.ToInt32Safe(SecurityFuncs.Decode(port, true));
ServerClient = SecurityFuncs.Decode(client, true);
ServerVersion = SecurityFuncs.Decode(version, true);
}

View File

@ -112,7 +112,8 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="ReachFramework" />
<Reference Include="RobloxFileFormat">
<Reference Include="RobloxFileFormat, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\RobloxFileFormat.dll</HintPath>
</Reference>
<Reference Include="System" />

View File

@ -89,7 +89,7 @@ namespace NovetusURI
string client = SecurityFuncs.Decode(SplitArg[2]);
GlobalVars.UserConfiguration.SaveSetting("SelectedClient", client);
GlobalVars.CurrentServer.ServerIP = ip;
GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(port);
GlobalVars.CurrentServer.ServerPort = ConvertSafe.ToInt32Safe(port);
ClientManagement.ReadClientValues();
}
catch (Exception ex)

View File

@ -61,7 +61,7 @@ namespace NovetusURI
}
else
{
GlobalVars.UserConfiguration.SaveSettingInt("UserID", Convert.ToInt32(IDBox.Text));
GlobalVars.UserConfiguration.SaveSettingInt("UserID", ConvertSafe.ToInt32Safe(IDBox.Text));
}
}
else

View File

@ -1,3 +1,12 @@
EDGE Snapshot v24.8785.40763.1
Enhancements:
- Play Solo now uses its own port (1027)
- Added extremely basic support for local packages in the Extra slot.
Fixes:
- Fixed a crash involving setting certain fields wrong in the Stylish Style.
- Fixed some clothing types not functioning in 2011 clients.
---------------------------------------------------------------------------
EDGE Snapshot v23.8783.34531.1
Notes:
- This release was put out to address concerns from the itch.io forums about the pop-ups upon launching Novetus. As a result, this was posted as an article in the news posting for those interested in this update. The way these two features are handled will be streamlined in a later snapshot.

View File

@ -124,7 +124,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = 5
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -124,7 +124,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = 5
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -153,7 +153,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = 5
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -153,7 +153,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = 5
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -228,7 +228,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -283,7 +283,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -283,7 +283,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -287,7 +287,7 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else

View File

@ -287,11 +287,51 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else
newItem[1].Parent = newChar
if newItem[1].Name == "Package" then
for _,packageVal in pairs(newItem[1]:GetChildren()) do
if packageVal.Name == "Head" then
newHead = Instance.new("SpecialMesh")
newHead.MeshId = packageVal.Value
newHead.MeshType = 5
newHead.Parent = charparts[1]
elseif packageVal.Name == "Torso" then
newTorso = Instance.new("SpecialMesh")
newTorso.MeshId = packageVal.Value
newTorso.MeshType = 5
newTorso.Parent = charparts[2]
elseif packageVal.Name == "Left Arm" then
newLeftArm = Instance.new("SpecialMesh")
newLeftArm.MeshId = packageVal.Value
newLeftArm.MeshType = 5
newLeftArm.Parent = charparts[3]
elseif packageVal.Name == "Right Arm" then
newRightArm = Instance.new("SpecialMesh")
newRightArm.MeshId = packageVal.Value
newRightArm.MeshType = 5
newRightArm.Parent = charparts[4]
elseif packageVal.Name == "Left Leg" then
newLeftLeg = Instance.new("SpecialMesh")
newLeftLeg.MeshId = packageVal.Value
newLeftLeg.MeshType = 5
newLeftLeg.Parent = charparts[5]
elseif packageVal.Name == "Right Leg" then
newRightLeg = Instance.new("SpecialMesh")
newRightLeg.MeshId = packageVal.Value
newRightLeg.MeshType = 5
newRightLeg.Parent = charparts[6]
end
packageVal:remove()
end
newItem[1]:remove()
else
newItem[1].Parent = newChar
end
end
end
end)

View File

@ -65,6 +65,8 @@ function LoadCharacterNew(playerApp,newChar)
PlayerService = game:GetService("Players")
Player = PlayerService:GetPlayerFromCharacter(newChar)
wait(0.65)
local function kick()
KickPlayer(Player, "Modified Client")
@ -287,11 +289,51 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else
newItem[1].Parent = newChar
if newItem[1].Name == "Package" then
for _,packageVal in pairs(newItem[1]:GetChildren()) do
if packageVal.Name == "Head" then
newHead = Instance.new("SpecialMesh")
newHead.MeshId = packageVal.Value
newHead.MeshType = 5
newHead.Parent = charparts[1]
elseif packageVal.Name == "Torso" then
newTorso = Instance.new("SpecialMesh")
newTorso.MeshId = packageVal.Value
newTorso.MeshType = 5
newTorso.Parent = charparts[2]
elseif packageVal.Name == "Left Arm" then
newLeftArm = Instance.new("SpecialMesh")
newLeftArm.MeshId = packageVal.Value
newLeftArm.MeshType = 5
newLeftArm.Parent = charparts[3]
elseif packageVal.Name == "Right Arm" then
newRightArm = Instance.new("SpecialMesh")
newRightArm.MeshId = packageVal.Value
newRightArm.MeshType = 5
newRightArm.Parent = charparts[4]
elseif packageVal.Name == "Left Leg" then
newLeftLeg = Instance.new("SpecialMesh")
newLeftLeg.MeshId = packageVal.Value
newLeftLeg.MeshType = 5
newLeftLeg.Parent = charparts[5]
elseif packageVal.Name == "Right Leg" then
newRightLeg = Instance.new("SpecialMesh")
newRightLeg.MeshId = packageVal.Value
newRightLeg.MeshType = 5
newRightLeg.Parent = charparts[6]
end
packageVal:remove()
end
newItem[1]:remove()
else
newItem[1].Parent = newChar
end
end
end
end)

View File

@ -290,11 +290,51 @@ function LoadCharacterNew(playerApp,newChar)
newWaitForChild(charparts[1],"face"):remove()
newItem[1].Parent = charparts[1]
newItem[1].Face = "Front"
elseif newPart[1].className == "SpecialMesh" or newPart[1].className == "CylinderMesh" or newPart[1].className == "BlockMesh" then
elseif newItem[1].className == "SpecialMesh" or newItem[1].className == "CylinderMesh" or newItem[1].className == "BlockMesh" then
newWaitForChild(charparts[1],"Mesh"):remove()
newItem[1].Parent = charparts[1]
else
newItem[1].Parent = newChar
if newItem[1].Name == "Package" then
for _,packageVal in pairs(newItem[1]:GetChildren()) do
if packageVal.Name == "Head" then
newHead = Instance.new("SpecialMesh")
newHead.MeshId = packageVal.Value
newHead.MeshType = 5
newHead.Parent = charparts[1]
elseif packageVal.Name == "Torso" then
newTorso = Instance.new("SpecialMesh")
newTorso.MeshId = packageVal.Value
newTorso.MeshType = 5
newTorso.Parent = charparts[2]
elseif packageVal.Name == "Left Arm" then
newLeftArm = Instance.new("SpecialMesh")
newLeftArm.MeshId = packageVal.Value
newLeftArm.MeshType = 5
newLeftArm.Parent = charparts[3]
elseif packageVal.Name == "Right Arm" then
newRightArm = Instance.new("SpecialMesh")
newRightArm.MeshId = packageVal.Value
newRightArm.MeshType = 5
newRightArm.Parent = charparts[4]
elseif packageVal.Name == "Left Leg" then
newLeftLeg = Instance.new("SpecialMesh")
newLeftLeg.MeshId = packageVal.Value
newLeftLeg.MeshType = 5
newLeftLeg.Parent = charparts[5]
elseif packageVal.Name == "Right Leg" then
newRightLeg = Instance.new("SpecialMesh")
newRightLeg.MeshId = packageVal.Value
newRightLeg.MeshType = 5
newRightLeg.Parent = charparts[6]
end
packageVal:remove()
end
newItem[1]:remove()
else
newItem[1].Parent = newChar
end
end
end
end)

View File

@ -6,9 +6,9 @@ UserAgentRegisterClient1=2007M
UserAgentRegisterClient2=2010L
IsSnapshot=True
ExtendedVersionNumber=True
//ExtendedVersionTemplate=%version% vX.23.%extended-revision% (%version-name%)
//ExtendedVersionTemplate=%version% Snapshot v23.%build%.%revision%.%extended-revision%
ExtendedVersionTemplate=EDGE Snapshot v23.%build%.%revision%.%extended-revision%
//ExtendedVersionTemplate=%version% vX.24.%extended-revision% (%version-name%)
//ExtendedVersionTemplate=%version% Snapshot v24.%build%.%revision%.%extended-revision%
ExtendedVersionTemplate=EDGE Snapshot v24.%build%.%revision%.%extended-revision%
ExtendedVersionRevision=1
InitialBootup=False
IsLite=False