add Novetus.Core namespace. Basic web proxy Extension support.
This commit is contained in:
parent
b0b2bad019
commit
f46b7d9a9c
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using Novetus.Core;
|
||||||
|
|
||||||
partial class CharacterCustomizationCompact
|
partial class CharacterCustomizationCompact
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
*
|
*
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||||
*/
|
*/
|
||||||
|
using Novetus.Core;
|
||||||
|
|
||||||
partial class CharacterCustomizationExtended
|
partial class CharacterCustomizationExtended
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ using System.Collections.Specialized;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CommandLineArguments
|
namespace Novetus.Core
|
||||||
|
{
|
||||||
|
#region CommandLineArguments
|
||||||
public class CommandLineArguments
|
public class CommandLineArguments
|
||||||
{
|
{
|
||||||
//https://www.codeproject.com/Articles/3111/C-NET-Command-Line-Arguments-Parser
|
//https://www.codeproject.com/Articles/3111/C-NET-Command-Line-Arguments-Parser
|
||||||
|
|
@ -118,3 +120,4 @@ using System.Text.RegularExpressions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,49 +3,52 @@ using System;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CryptoRandom
|
namespace Novetus.Core
|
||||||
|
|
||||||
public class CryptoRandom : RandomNumberGenerator
|
|
||||||
{
|
{
|
||||||
private static RandomNumberGenerator r;
|
#region CryptoRandom
|
||||||
|
|
||||||
public CryptoRandom()
|
public class CryptoRandom : RandomNumberGenerator
|
||||||
{
|
{
|
||||||
r = Create();
|
private static RandomNumberGenerator r;
|
||||||
}
|
|
||||||
|
|
||||||
///<param name=”buffer”>An array of bytes to contain random numbers.</param>
|
public CryptoRandom()
|
||||||
public override void GetBytes(byte[] buffer)
|
{
|
||||||
{
|
r = Create();
|
||||||
r.GetBytes(buffer);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public override void GetNonZeroBytes(byte[] data)
|
///<param name=”buffer”>An array of bytes to contain random numbers.</param>
|
||||||
{
|
public override void GetBytes(byte[] buffer)
|
||||||
r.GetNonZeroBytes(data);
|
{
|
||||||
}
|
r.GetBytes(buffer);
|
||||||
public double NextDouble()
|
}
|
||||||
{
|
|
||||||
byte[] b = new byte[4];
|
|
||||||
r.GetBytes(b);
|
|
||||||
return (double)BitConverter.ToUInt32(b, 0) / UInt32.MaxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
///<param name=”minValue”>The inclusive lower bound of the random number returned.</param>
|
public override void GetNonZeroBytes(byte[] data)
|
||||||
///<param name=”maxValue”>The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.</param>
|
{
|
||||||
public int Next(int minValue, int maxValue)
|
r.GetNonZeroBytes(data);
|
||||||
{
|
}
|
||||||
return (int)Math.Round(NextDouble() * (maxValue - minValue - 1)) + minValue;
|
public double NextDouble()
|
||||||
}
|
{
|
||||||
public int Next()
|
byte[] b = new byte[4];
|
||||||
{
|
r.GetBytes(b);
|
||||||
return Next(0, int.MaxValue);
|
return (double)BitConverter.ToUInt32(b, 0) / UInt32.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
///<param name=”maxValue”>The inclusive upper bound of the random number returned. maxValue must be greater than or equal 0</param>
|
///<param name=”minValue”>The inclusive lower bound of the random number returned.</param>
|
||||||
public int Next(int maxValue)
|
///<param name=”maxValue”>The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.</param>
|
||||||
{
|
public int Next(int minValue, int maxValue)
|
||||||
return Next(0, maxValue);
|
{
|
||||||
|
return (int)Math.Round(NextDouble() * (maxValue - minValue - 1)) + minValue;
|
||||||
|
}
|
||||||
|
public int Next()
|
||||||
|
{
|
||||||
|
return Next(0, int.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
///<param name=”maxValue”>The inclusive upper bound of the random number returned. maxValue must be greater than or equal 0</param>
|
||||||
|
public int Next(int maxValue)
|
||||||
|
{
|
||||||
|
return Next(0, maxValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -6,245 +6,248 @@ using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Downloader
|
namespace Novetus.Core
|
||||||
|
|
||||||
class Downloader
|
|
||||||
{
|
{
|
||||||
public readonly string fileURL;
|
#region Downloader
|
||||||
public readonly string fileName;
|
|
||||||
public readonly string fileFilter;
|
|
||||||
public readonly string filePath;
|
|
||||||
public static bool showErrorInfo = true;
|
|
||||||
public static bool overwrite = true;
|
|
||||||
public int downloadSize;
|
|
||||||
private string downloadOutcome;
|
|
||||||
private static string downloadOutcomeException;
|
|
||||||
|
|
||||||
public Downloader(string url, string name, string filter)
|
class Downloader
|
||||||
{
|
{
|
||||||
fileName = name;
|
public readonly string fileURL;
|
||||||
fileURL = url;
|
public readonly string fileName;
|
||||||
fileFilter = filter;
|
public readonly string fileFilter;
|
||||||
}
|
public readonly string filePath;
|
||||||
|
public static bool showErrorInfo = true;
|
||||||
|
public static bool overwrite = true;
|
||||||
|
public int downloadSize;
|
||||||
|
private string downloadOutcome;
|
||||||
|
private static string downloadOutcomeException;
|
||||||
|
|
||||||
public Downloader(string url, string name, string filter, string path)
|
public Downloader(string url, string name, string filter)
|
||||||
{
|
|
||||||
fileName = name;
|
|
||||||
fileURL = url;
|
|
||||||
fileFilter = filter;
|
|
||||||
filePath = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Downloader(string url, string name)
|
|
||||||
{
|
|
||||||
fileName = name;
|
|
||||||
fileURL = url;
|
|
||||||
fileFilter = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadOptions(bool ExtraErrorInfo, bool OverwriteFiles)
|
|
||||||
{
|
|
||||||
showErrorInfo = ExtraErrorInfo;
|
|
||||||
overwrite = OverwriteFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string getDownloadOutcome()
|
|
||||||
{
|
|
||||||
return downloadOutcome;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitDownloadDirect(string path, string fileext, string additionalText = "", bool removeSpaces = false)
|
|
||||||
{
|
|
||||||
string outputfilename = "";
|
|
||||||
|
|
||||||
if (removeSpaces == true)
|
|
||||||
{
|
{
|
||||||
outputfilename = (fileName + fileext).Replace(" ", "");
|
fileName = name;
|
||||||
}
|
fileURL = url;
|
||||||
else
|
fileFilter = filter;
|
||||||
{
|
|
||||||
outputfilename = fileName + fileext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string fullpath = path + "\\" + outputfilename;
|
public Downloader(string url, string name, string filter, string path)
|
||||||
|
|
||||||
InitDownloadNoDialog(fullpath, additionalText);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitDownload(string additionalText = "")
|
|
||||||
{
|
|
||||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog
|
|
||||||
{
|
{
|
||||||
FileName = fileName,
|
fileName = name;
|
||||||
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
|
fileURL = url;
|
||||||
Filter = fileFilter,
|
fileFilter = filter;
|
||||||
Title = "Save " + fileName
|
filePath = path;
|
||||||
};
|
|
||||||
|
|
||||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
InitDownloadNoDialog(saveFileDialog1.FileName, additionalText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitDownloadNoDialog(string name, string additionalText = "")
|
|
||||||
{
|
|
||||||
if (!overwrite && File.Exists(name))
|
|
||||||
{
|
|
||||||
downloadOutcome = "Download skipped due to same file name.";
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int read = 0;
|
public Downloader(string url, string name)
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
read = DownloadFile(fileURL, name);
|
fileName = name;
|
||||||
|
fileURL = url;
|
||||||
|
fileFilter = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDownloadOptions(bool ExtraErrorInfo, bool OverwriteFiles)
|
||||||
|
{
|
||||||
|
showErrorInfo = ExtraErrorInfo;
|
||||||
|
overwrite = OverwriteFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string getDownloadOutcome()
|
||||||
|
{
|
||||||
|
return downloadOutcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitDownloadDirect(string path, string fileext, string additionalText = "", bool removeSpaces = false)
|
||||||
|
{
|
||||||
|
string outputfilename = "";
|
||||||
|
|
||||||
|
if (removeSpaces == true)
|
||||||
|
{
|
||||||
|
outputfilename = (fileName + fileext).Replace(" ", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outputfilename = fileName + fileext;
|
||||||
|
}
|
||||||
|
|
||||||
|
string fullpath = path + "\\" + outputfilename;
|
||||||
|
|
||||||
|
InitDownloadNoDialog(fullpath, additionalText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitDownload(string additionalText = "")
|
||||||
|
{
|
||||||
|
SaveFileDialog saveFileDialog1 = new SaveFileDialog
|
||||||
|
{
|
||||||
|
FileName = fileName,
|
||||||
|
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
|
||||||
|
Filter = fileFilter,
|
||||||
|
Title = "Save " + fileName
|
||||||
|
};
|
||||||
|
|
||||||
|
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
InitDownloadNoDialog(saveFileDialog1.FileName, additionalText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitDownloadNoDialog(string name, string additionalText = "")
|
||||||
|
{
|
||||||
|
if (!overwrite && File.Exists(name))
|
||||||
|
{
|
||||||
|
downloadOutcome = "Download skipped due to same file name.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
read = DownloadFile(fileURL, name);
|
||||||
|
}
|
||||||
#if URI || LAUNCHER || BASICLAUNCHER
|
#if URI || LAUNCHER || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.LogExceptions(ex);
|
Util.LogExceptions(ex);
|
||||||
#else
|
#else
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
downloadOutcome = "Error when downloading file: " + ex.Message;
|
downloadOutcome = "Error when downloading file: " + ex.Message;
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
//wait a few seconds for the download to finish
|
|
||||||
//Thread.Sleep(2000);
|
|
||||||
if (File.Exists(name) && read > 0)
|
|
||||||
{
|
|
||||||
downloadSize = read;
|
|
||||||
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + Util.SizeSuffix(Convert.ToInt64(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
|
|
||||||
}
|
}
|
||||||
else
|
finally
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(downloadOutcomeException))
|
//wait a few seconds for the download to finish
|
||||||
|
//Thread.Sleep(2000);
|
||||||
|
if (File.Exists(name) && read > 0)
|
||||||
{
|
{
|
||||||
downloadOutcome = "Error: Download of file " + Path.GetFileName(name) + " failed. " + downloadOutcomeException;
|
downloadSize = read;
|
||||||
|
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + Util.SizeSuffix(Convert.ToInt64(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
downloadOutcome = "Error: Download of file " + Path.GetFileName(name) + " failed. The file wasn't downloaded to the assigned directory.";
|
if (!string.IsNullOrWhiteSpace(downloadOutcomeException))
|
||||||
}
|
|
||||||
|
|
||||||
if (showErrorInfo)
|
|
||||||
{
|
|
||||||
downloadOutcome += "\n\nMore error info:\n\nFile URL: " + fileURL + "\n\nFile Path: " + name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetFullDLPath()
|
|
||||||
{
|
|
||||||
return filePath + Path.DirectorySeparatorChar + fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int DownloadFile(string remoteFilename, string localFilename)
|
|
||||||
{
|
|
||||||
//credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm)
|
|
||||||
//and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408)
|
|
||||||
|
|
||||||
// Function will return the number of bytes processed
|
|
||||||
// to the caller. Initialize to 0 here.
|
|
||||||
int bytesProcessed = 0;
|
|
||||||
|
|
||||||
// Assign values to these objects here so that they can
|
|
||||||
// be referenced in the finally block
|
|
||||||
Stream remoteStream = null;
|
|
||||||
Stream localStream = null;
|
|
||||||
WebResponse response = null;
|
|
||||||
|
|
||||||
// Use a try/catch/finally block as both the WebRequest and Stream
|
|
||||||
// classes throw exceptions upon error
|
|
||||||
//thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code!
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
|
|
||||||
| (SecurityProtocolType)3072
|
|
||||||
| (SecurityProtocolType)768
|
|
||||||
| SecurityProtocolType.Ssl3;
|
|
||||||
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
|
|
||||||
// Create a request for the specified remote file name
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename);
|
|
||||||
//changing it to just "roblox" since roblox is breaking everything.
|
|
||||||
//request.UserAgent = "Roblox/WinINet";
|
|
||||||
request.UserAgent = "Roblox";
|
|
||||||
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
|
|
||||||
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
|
||||||
if (request != null)
|
|
||||||
{
|
|
||||||
// Send the request to the server and retrieve the
|
|
||||||
// WebResponse object
|
|
||||||
response = request.GetResponse();
|
|
||||||
if (response != null)
|
|
||||||
{
|
|
||||||
// Once the WebResponse object has been retrieved,
|
|
||||||
// get the stream object associated with the response's data
|
|
||||||
remoteStream = response.GetResponseStream();
|
|
||||||
|
|
||||||
// Create the local file
|
|
||||||
localStream = File.Create(localFilename);
|
|
||||||
|
|
||||||
// Allocate a 1k buffer
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int bytesRead;
|
|
||||||
|
|
||||||
// Simple do/while loop to read from stream until
|
|
||||||
// no bytes are returned
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
// Read data (up to 1k) from the stream
|
downloadOutcome = "Error: Download of file " + Path.GetFileName(name) + " failed. " + downloadOutcomeException;
|
||||||
bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
downloadOutcome = "Error: Download of file " + Path.GetFileName(name) + " failed. The file wasn't downloaded to the assigned directory.";
|
||||||
|
}
|
||||||
|
|
||||||
// Write the data to the local file
|
if (showErrorInfo)
|
||||||
localStream.Write(buffer, 0, bytesRead);
|
{
|
||||||
|
downloadOutcome += "\n\nMore error info:\n\nFile URL: " + fileURL + "\n\nFile Path: " + name;
|
||||||
// Increment total bytes processed
|
}
|
||||||
bytesProcessed += bytesRead;
|
|
||||||
} while (bytesRead > 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
|
public string GetFullDLPath()
|
||||||
{
|
{
|
||||||
#if URI || LAUNCHER || BASICLAUNCHER
|
return filePath + Path.DirectorySeparatorChar + fileName;
|
||||||
Util.LogExceptions(e);
|
}
|
||||||
#endif
|
|
||||||
if (e is WebException && bytesProcessed == 0)
|
private static int DownloadFile(string remoteFilename, string localFilename)
|
||||||
|
{
|
||||||
|
//credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm)
|
||||||
|
//and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408)
|
||||||
|
|
||||||
|
// Function will return the number of bytes processed
|
||||||
|
// to the caller. Initialize to 0 here.
|
||||||
|
int bytesProcessed = 0;
|
||||||
|
|
||||||
|
// Assign values to these objects here so that they can
|
||||||
|
// be referenced in the finally block
|
||||||
|
Stream remoteStream = null;
|
||||||
|
Stream localStream = null;
|
||||||
|
WebResponse response = null;
|
||||||
|
|
||||||
|
// Use a try/catch/finally block as both the WebRequest and Stream
|
||||||
|
// classes throw exceptions upon error
|
||||||
|
//thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code!
|
||||||
|
try
|
||||||
{
|
{
|
||||||
WebException ex = (WebException)e;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
|
||||||
HttpWebResponse errorResponse = ex.Response as HttpWebResponse;
|
| (SecurityProtocolType)3072
|
||||||
if (errorResponse.StatusCode == HttpStatusCode.Conflict || errorResponse.StatusCode == HttpStatusCode.Forbidden)
|
| (SecurityProtocolType)768
|
||||||
|
| SecurityProtocolType.Ssl3;
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
|
||||||
|
// Create a request for the specified remote file name
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename);
|
||||||
|
//changing it to just "roblox" since roblox is breaking everything.
|
||||||
|
//request.UserAgent = "Roblox/WinINet";
|
||||||
|
request.UserAgent = "Roblox";
|
||||||
|
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
|
||||||
|
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
||||||
|
if (request != null)
|
||||||
{
|
{
|
||||||
downloadOutcomeException = "Error: Unable to download item. The item may not be publically available.";
|
// Send the request to the server and retrieve the
|
||||||
|
// WebResponse object
|
||||||
|
response = request.GetResponse();
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
// Once the WebResponse object has been retrieved,
|
||||||
|
// get the stream object associated with the response's data
|
||||||
|
remoteStream = response.GetResponseStream();
|
||||||
|
|
||||||
|
// Create the local file
|
||||||
|
localStream = File.Create(localFilename);
|
||||||
|
|
||||||
|
// Allocate a 1k buffer
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int bytesRead;
|
||||||
|
|
||||||
|
// Simple do/while loop to read from stream until
|
||||||
|
// no bytes are returned
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// Read data (up to 1k) from the stream
|
||||||
|
bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
|
// Write the data to the local file
|
||||||
|
localStream.Write(buffer, 0, bytesRead);
|
||||||
|
|
||||||
|
// Increment total bytes processed
|
||||||
|
bytesProcessed += bytesRead;
|
||||||
|
} while (bytesRead > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
#if URI || LAUNCHER || BASICLAUNCHER
|
||||||
|
Util.LogExceptions(e);
|
||||||
|
#endif
|
||||||
|
if (e is WebException && bytesProcessed == 0)
|
||||||
|
{
|
||||||
|
WebException ex = (WebException)e;
|
||||||
|
HttpWebResponse errorResponse = ex.Response as HttpWebResponse;
|
||||||
|
if (errorResponse.StatusCode == HttpStatusCode.Conflict || errorResponse.StatusCode == HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
downloadOutcomeException = "Error: Unable to download item. The item may not be publically available.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
downloadOutcomeException = "Exception: " + ex.Message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
downloadOutcomeException = "Exception: " + ex.Message;
|
downloadOutcomeException = "Exception: " + e.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
finally
|
||||||
{
|
{
|
||||||
downloadOutcomeException = "Exception: " + e.Message;
|
// Close the response and streams objects here
|
||||||
|
// to make sure they're closed even if an exception
|
||||||
|
// is thrown at some point
|
||||||
|
if (response != null) response.Close();
|
||||||
|
if (remoteStream != null) remoteStream.Close();
|
||||||
|
if (localStream != null) localStream.Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// Close the response and streams objects here
|
|
||||||
// to make sure they're closed even if an exception
|
|
||||||
// is thrown at some point
|
|
||||||
if (response != null) response.Close();
|
|
||||||
if (remoteStream != null) remoteStream.Close();
|
|
||||||
if (localStream != null) localStream.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return total bytes processed to caller.
|
// Return total bytes processed to caller.
|
||||||
return bytesProcessed;
|
return bytesProcessed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -2,95 +2,98 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Discord RPC
|
namespace Novetus.Core
|
||||||
//code by discord obv. just renamed it to fit better.
|
|
||||||
public class DiscordRPC
|
|
||||||
{
|
{
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
#region Discord RPC
|
||||||
public delegate void ReadyCallback();
|
//code by discord obv. just renamed it to fit better.
|
||||||
|
public class DiscordRPC
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void DisconnectedCallback(int errorCode, string message);
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void ErrorCallback(int errorCode, string message);
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void JoinCallback(string secret);
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void SpectateCallback(string secret);
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void RequestCallback(JoinRequest request);
|
|
||||||
|
|
||||||
public struct EventHandlers
|
|
||||||
{
|
{
|
||||||
public ReadyCallback readyCallback;
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public DisconnectedCallback disconnectedCallback;
|
public delegate void ReadyCallback();
|
||||||
public ErrorCallback errorCallback;
|
|
||||||
public JoinCallback joinCallback;
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public SpectateCallback spectateCallback;
|
public delegate void DisconnectedCallback(int errorCode, string message);
|
||||||
public RequestCallback requestCallback;
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void ErrorCallback(int errorCode, string message);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void JoinCallback(string secret);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void SpectateCallback(string secret);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void RequestCallback(JoinRequest request);
|
||||||
|
|
||||||
|
public struct EventHandlers
|
||||||
|
{
|
||||||
|
public ReadyCallback readyCallback;
|
||||||
|
public DisconnectedCallback disconnectedCallback;
|
||||||
|
public ErrorCallback errorCallback;
|
||||||
|
public JoinCallback joinCallback;
|
||||||
|
public SpectateCallback spectateCallback;
|
||||||
|
public RequestCallback requestCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public struct RichPresence
|
||||||
|
{
|
||||||
|
public string state;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public string details;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public long startTimestamp;
|
||||||
|
public long endTimestamp;
|
||||||
|
public string largeImageKey;
|
||||||
|
/* max 32 bytes */
|
||||||
|
public string largeImageText;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public string smallImageKey;
|
||||||
|
/* max 32 bytes */
|
||||||
|
public string smallImageText;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public string partyId;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public int partySize;
|
||||||
|
public int partyMax;
|
||||||
|
public string matchSecret;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public string joinSecret;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public string spectateSecret;
|
||||||
|
/* max 128 bytes */
|
||||||
|
public bool instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public struct JoinRequest
|
||||||
|
{
|
||||||
|
public string userId;
|
||||||
|
public string username;
|
||||||
|
public string avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Reply
|
||||||
|
{
|
||||||
|
No = 0,
|
||||||
|
Yes = 1,
|
||||||
|
Ignore = 2
|
||||||
|
}
|
||||||
|
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
|
||||||
|
|
||||||
|
[DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void Shutdown();
|
||||||
|
|
||||||
|
[DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void RunCallbacks();
|
||||||
|
|
||||||
|
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void UpdatePresence(ref RichPresence presence);
|
||||||
|
|
||||||
|
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void Respond(string userId, Reply reply);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
[System.Serializable]
|
|
||||||
public struct RichPresence
|
|
||||||
{
|
|
||||||
public string state;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public string details;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public long startTimestamp;
|
|
||||||
public long endTimestamp;
|
|
||||||
public string largeImageKey;
|
|
||||||
/* max 32 bytes */
|
|
||||||
public string largeImageText;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public string smallImageKey;
|
|
||||||
/* max 32 bytes */
|
|
||||||
public string smallImageText;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public string partyId;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public int partySize;
|
|
||||||
public int partyMax;
|
|
||||||
public string matchSecret;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public string joinSecret;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public string spectateSecret;
|
|
||||||
/* max 128 bytes */
|
|
||||||
public bool instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public struct JoinRequest
|
|
||||||
{
|
|
||||||
public string userId;
|
|
||||||
public string username;
|
|
||||||
public string avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Reply
|
|
||||||
{
|
|
||||||
No = 0,
|
|
||||||
Yes = 1,
|
|
||||||
Ignore = 2
|
|
||||||
}
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
|
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void Shutdown();
|
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void RunCallbacks();
|
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void UpdatePresence(ref RichPresence presence);
|
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void Respond(string userId, Reply reply);
|
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -5,95 +5,98 @@ using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region INI File Parser
|
namespace Novetus.Core
|
||||||
//modified from https://www.codeproject.com/articles/1966/an-ini-file-handling-class-using-c?fid=425860&df=90&mpp=25&prof=True&sort=Position&view=Normal&spc=Relaxed&fr=51
|
|
||||||
|
|
||||||
public class INIFile
|
|
||||||
{
|
{
|
||||||
public string path;
|
#region INI File Parser
|
||||||
|
//modified from https://www.codeproject.com/articles/1966/an-ini-file-handling-class-using-c?fid=425860&df=90&mpp=25&prof=True&sort=Position&view=Normal&spc=Relaxed&fr=51
|
||||||
|
|
||||||
[DllImport("kernel32")]
|
public class INIFile
|
||||||
private static extern long WritePrivateProfileString(string section,
|
{
|
||||||
string key, string val, string filePath);
|
public string path;
|
||||||
[DllImport("kernel32")]
|
|
||||||
private static extern int GetPrivateProfileString(string section,
|
|
||||||
string key, string def, StringBuilder retVal,
|
|
||||||
int size, string filePath);
|
|
||||||
|
|
||||||
/// <summary>
|
[DllImport("kernel32")]
|
||||||
/// INIFile Constructor.
|
private static extern long WritePrivateProfileString(string section,
|
||||||
/// </summary>
|
string key, string val, string filePath);
|
||||||
/// <PARAM name="INIPath"></PARAM>
|
[DllImport("kernel32")]
|
||||||
public INIFile(string INIPath)
|
private static extern int GetPrivateProfileString(string section,
|
||||||
{
|
string key, string def, StringBuilder retVal,
|
||||||
path = INIPath;
|
int size, string filePath);
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Write Data to the INI File
|
|
||||||
/// </summary>
|
|
||||||
/// <PARAM name="Section"></PARAM>
|
|
||||||
/// Section name
|
|
||||||
/// <PARAM name="Key"></PARAM>
|
|
||||||
/// Key Name
|
|
||||||
/// <PARAM name="Value"></PARAM>
|
|
||||||
/// Value Name
|
|
||||||
public void IniWriteValue(string Section, string Key, string Value)
|
|
||||||
{
|
|
||||||
WritePrivateProfileString(Section, Key, Value, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read Data Value From the Ini File
|
/// INIFile Constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <PARAM name="Section"></PARAM>
|
/// <PARAM name="INIPath"></PARAM>
|
||||||
/// <PARAM name="Key"></PARAM>
|
public INIFile(string INIPath)
|
||||||
/// <PARAM name="Default Value. Optional for creating values in case they are invalid."></PARAM>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string IniReadValue(string Section, string Key, string DefaultValue = "")
|
|
||||||
{
|
|
||||||
if (IniValueExists(Key))
|
|
||||||
{
|
{
|
||||||
StringBuilder temp = new StringBuilder(255);
|
path = INIPath;
|
||||||
int i = GetPrivateProfileString(Section, Key, "", temp,
|
|
||||||
255, path);
|
|
||||||
return temp.ToString();
|
|
||||||
}
|
}
|
||||||
else
|
/// <summary>
|
||||||
|
/// Write Data to the INI File
|
||||||
|
/// </summary>
|
||||||
|
/// <PARAM name="Section"></PARAM>
|
||||||
|
/// Section name
|
||||||
|
/// <PARAM name="Key"></PARAM>
|
||||||
|
/// Key Name
|
||||||
|
/// <PARAM name="Value"></PARAM>
|
||||||
|
/// Value Name
|
||||||
|
public void IniWriteValue(string Section, string Key, string Value)
|
||||||
{
|
{
|
||||||
IniWriteValue(Section, Key, DefaultValue);
|
WritePrivateProfileString(Section, Key, Value, path);
|
||||||
return DefaultValue;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool IniValueExists(string SearchString)
|
/// <summary>
|
||||||
{
|
/// Read Data Value From the Ini File
|
||||||
try
|
/// </summary>
|
||||||
|
/// <PARAM name="Section"></PARAM>
|
||||||
|
/// <PARAM name="Key"></PARAM>
|
||||||
|
/// <PARAM name="Default Value. Optional for creating values in case they are invalid."></PARAM>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string IniReadValue(string Section, string Key, string DefaultValue = "")
|
||||||
{
|
{
|
||||||
if (File.Exists(path))
|
if (IniValueExists(Key))
|
||||||
{
|
{
|
||||||
string[] lines = File.ReadAllLines(path);
|
StringBuilder temp = new StringBuilder(255);
|
||||||
|
int i = GetPrivateProfileString(Section, Key, "", temp,
|
||||||
|
255, path);
|
||||||
|
return temp.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IniWriteValue(Section, Key, DefaultValue);
|
||||||
|
return DefaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (string line in lines)
|
public bool IniValueExists(string SearchString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
if (line.Contains(SearchString))
|
string[] lines = File.ReadAllLines(path);
|
||||||
|
|
||||||
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
return true;
|
if (line.Contains(SearchString))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || BASICLAUNCHER
|
#if URI || LAUNCHER || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.LogExceptions(ex);
|
Util.LogExceptions(ex);
|
||||||
#else
|
#else
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
#region Usings
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using Microsoft.CSharp;
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// based on https://stackoverflow.com/questions/137933/what-is-the-best-scripting-language-to-embed-in-a-c-sharp-desktop-application
|
||||||
|
namespace Novetus.Core
|
||||||
|
{
|
||||||
|
#region Script
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public static object LoadScriptFromContent(string scriptPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = File.OpenRead(scriptPath))
|
||||||
|
{
|
||||||
|
using (var reader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
string script = reader.ReadToEnd();
|
||||||
|
Assembly compiled = CompileScript(script, scriptPath);
|
||||||
|
object code = ExecuteScript(compiled, scriptPath);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ErrorHandler(scriptPath + ": " + ex.ToString(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static object ExecuteScript(Assembly assemblyScript, string filePath)
|
||||||
|
{
|
||||||
|
if (assemblyScript == null)
|
||||||
|
{
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Type type in assemblyScript.GetExportedTypes())
|
||||||
|
{
|
||||||
|
if (type.IsInterface || type.IsAbstract)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
|
||||||
|
|
||||||
|
if (constructor != null && constructor.IsPublic)
|
||||||
|
{
|
||||||
|
return constructor.Invoke(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorHandler(filePath + ": Constructor does not exist or it is not public.", true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
ErrorHandler(filePath + ": Failed to load script.", true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Assembly CompileScript(string code, string filePath)
|
||||||
|
{
|
||||||
|
CSharpCodeProvider provider = new CSharpCodeProvider();
|
||||||
|
|
||||||
|
CompilerParameters perams = new CompilerParameters();
|
||||||
|
perams.GenerateExecutable = false;
|
||||||
|
perams.GenerateInMemory = true;
|
||||||
|
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic).Select(a => a.Location);
|
||||||
|
perams.ReferencedAssemblies.AddRange(assemblies.ToArray());
|
||||||
|
|
||||||
|
CompilerResults result = provider.CompileAssemblyFromSource(perams, code);
|
||||||
|
|
||||||
|
foreach (CompilerError error in result.Errors)
|
||||||
|
{
|
||||||
|
ErrorHandler(error, filePath, error.IsWarning, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Errors.HasErrors)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.CompiledAssembly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ErrorHandler(string error, bool finalError = false)
|
||||||
|
{
|
||||||
|
ErrorHandler(error, false, finalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ErrorHandler(string error, bool warning, bool finalError)
|
||||||
|
{
|
||||||
|
Util.ConsolePrint(warning ? "[SCRIPT WARNING] - " : "[SCRIPT ERROR] - " + error, warning ? 5 : 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ErrorHandler(CompilerError error, string fileName, bool warning, bool finalError)
|
||||||
|
{
|
||||||
|
Util.ConsolePrint(warning ? "[SCRIPT WARNING] - " : "[SCRIPT ERROR] - " + fileName + " (" + error.Line + "," + error.Column + "): " + error.ErrorText, warning ? 5 : 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
@ -4,100 +4,103 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Text Line Remover and Friends
|
namespace Novetus.Core
|
||||||
// modified from https://stackoverflow.com/questions/668907/how-to-delete-a-line-from-a-text-file-in-c/668914#668914
|
|
||||||
|
|
||||||
public static class TextLineRemover
|
|
||||||
{
|
{
|
||||||
public static void RemoveTextLines(IList<string> linesToRemove, string filename, string tempFilename)
|
#region Text Line Remover and Friends
|
||||||
{
|
// modified from https://stackoverflow.com/questions/668907/how-to-delete-a-line-from-a-text-file-in-c/668914#668914
|
||||||
// Initial values
|
|
||||||
int lineNumber = 0;
|
|
||||||
int linesRemoved = 0;
|
|
||||||
DateTime startTime = DateTime.Now;
|
|
||||||
|
|
||||||
// Read file
|
public static class TextLineRemover
|
||||||
using (var sr = new StreamReader(filename))
|
{
|
||||||
|
public static void RemoveTextLines(IList<string> linesToRemove, string filename, string tempFilename)
|
||||||
{
|
{
|
||||||
// Write new file
|
// Initial values
|
||||||
using (var sw = new StreamWriter(tempFilename))
|
int lineNumber = 0;
|
||||||
|
int linesRemoved = 0;
|
||||||
|
DateTime startTime = DateTime.Now;
|
||||||
|
|
||||||
|
// Read file
|
||||||
|
using (var sr = new StreamReader(filename))
|
||||||
{
|
{
|
||||||
// Read lines
|
// Write new file
|
||||||
string line;
|
using (var sw = new StreamWriter(tempFilename))
|
||||||
while ((line = sr.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
lineNumber++;
|
// Read lines
|
||||||
// Look for text to remove
|
string line;
|
||||||
if (!ContainsString(line, linesToRemove))
|
while ((line = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
// Keep lines that does not match
|
lineNumber++;
|
||||||
sw.WriteLine(line);
|
// Look for text to remove
|
||||||
}
|
if (!ContainsString(line, linesToRemove))
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ignore lines that DO match
|
|
||||||
linesRemoved++;
|
|
||||||
InvokeOnRemovedLine(new RemovedLineArgs
|
|
||||||
{
|
{
|
||||||
RemovedLine = line,
|
// Keep lines that does not match
|
||||||
RemovedLineNumber = lineNumber
|
sw.WriteLine(line);
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ignore lines that DO match
|
||||||
|
linesRemoved++;
|
||||||
|
InvokeOnRemovedLine(new RemovedLineArgs
|
||||||
|
{
|
||||||
|
RemovedLine = line,
|
||||||
|
RemovedLineNumber = lineNumber
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FixedFileMove deletes the original file and moves the temp file in.
|
||||||
|
Util.FixedFileMove(tempFilename, filename, true);
|
||||||
|
|
||||||
|
// Final calculations
|
||||||
|
DateTime endTime = DateTime.Now;
|
||||||
|
InvokeOnFinished(new FinishedArgs
|
||||||
|
{
|
||||||
|
LinesRemoved = linesRemoved,
|
||||||
|
TotalLines = lineNumber,
|
||||||
|
TotalTime = endTime.Subtract(startTime)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//FixedFileMove deletes the original file and moves the temp file in.
|
private static bool ContainsString(string line, IEnumerable<string> linesToRemove)
|
||||||
Util.FixedFileMove(tempFilename, filename, true);
|
|
||||||
|
|
||||||
// Final calculations
|
|
||||||
DateTime endTime = DateTime.Now;
|
|
||||||
InvokeOnFinished(new FinishedArgs
|
|
||||||
{
|
{
|
||||||
LinesRemoved = linesRemoved,
|
foreach (var lineToRemove in linesToRemove)
|
||||||
TotalLines = lineNumber,
|
{
|
||||||
TotalTime = endTime.Subtract(startTime)
|
if (line.Contains(lineToRemove))
|
||||||
});
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
private static bool ContainsString(string line, IEnumerable<string> linesToRemove)
|
}
|
||||||
{
|
|
||||||
foreach (var lineToRemove in linesToRemove)
|
public static event RemovedLine OnRemovedLine;
|
||||||
{
|
public static event Finished OnFinished;
|
||||||
if (line.Contains(lineToRemove))
|
|
||||||
return true;
|
public static void InvokeOnFinished(FinishedArgs args)
|
||||||
|
{
|
||||||
|
OnFinished?.Invoke(null, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeOnRemovedLine(RemovedLineArgs args)
|
||||||
|
{
|
||||||
|
OnRemovedLine?.Invoke(null, args);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static event RemovedLine OnRemovedLine;
|
public delegate void Finished(object sender, FinishedArgs args);
|
||||||
public static event Finished OnFinished;
|
|
||||||
|
|
||||||
public static void InvokeOnFinished(FinishedArgs args)
|
public struct FinishedArgs
|
||||||
{
|
{
|
||||||
OnFinished?.Invoke(null, args);
|
public int TotalLines { get; set; }
|
||||||
|
public int LinesRemoved { get; set; }
|
||||||
|
public TimeSpan TotalTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InvokeOnRemovedLine(RemovedLineArgs args)
|
public delegate void RemovedLine(object sender, RemovedLineArgs args);
|
||||||
|
|
||||||
|
public struct RemovedLineArgs
|
||||||
{
|
{
|
||||||
OnRemovedLine?.Invoke(null, args);
|
public string RemovedLine { get; set; }
|
||||||
|
public int RemovedLineNumber { get; set; }
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void Finished(object sender, FinishedArgs args);
|
|
||||||
|
|
||||||
public struct FinishedArgs
|
|
||||||
{
|
|
||||||
public int TotalLines { get; set; }
|
|
||||||
public int LinesRemoved { get; set; }
|
|
||||||
public TimeSpan TotalTime { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void RemovedLine(object sender, RemovedLineArgs args);
|
|
||||||
|
|
||||||
public struct RemovedLineArgs
|
|
||||||
{
|
|
||||||
public string RemovedLine { get; set; }
|
|
||||||
public int RemovedLineNumber { get; set; }
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
//https://github.com/davcs86/csharp-uhwid
|
//https://github.com/davcs86/csharp-uhwid
|
||||||
//merged into one class
|
//merged into one class
|
||||||
namespace UHWID
|
namespace Novetus.Core
|
||||||
{
|
{
|
||||||
#region UHWIDEngine
|
#region UHWIDEngine
|
||||||
public static class UHWIDEngine
|
public static class UHWIDEngine
|
||||||
|
|
|
||||||
|
|
@ -12,162 +12,268 @@ using Titanium.Web.Proxy.EventArguments;
|
||||||
using Titanium.Web.Proxy.Http;
|
using Titanium.Web.Proxy.Http;
|
||||||
using Titanium.Web.Proxy.Models;
|
using Titanium.Web.Proxy.Models;
|
||||||
|
|
||||||
public class WebProxy
|
namespace Novetus.Core
|
||||||
{
|
{
|
||||||
private static ProxyServer Server = new ProxyServer();
|
public class IWebProxyExtension
|
||||||
private static ExplicitProxyEndPoint end;
|
|
||||||
|
|
||||||
public bool HasStarted()
|
|
||||||
{
|
{
|
||||||
return Server.ProxyRunning;
|
public virtual string Name { get; set; } = "Unnamed Web Proxy Extension";
|
||||||
|
public virtual void OnExtensionLoad() { }
|
||||||
|
public virtual void OnProxyStart() { }
|
||||||
|
public virtual void OnProxyStopped() { }
|
||||||
|
|
||||||
|
public virtual bool IsValidURL(string absolutePath, string host) { return false; }
|
||||||
|
|
||||||
|
public virtual Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e) { return Task.CompletedTask; }
|
||||||
|
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||||
|
public virtual async Task OnRequest(object sender, SessionEventArgs e) { }
|
||||||
|
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoSetup()
|
public class WebProxy
|
||||||
{
|
{
|
||||||
if (GlobalVars.UserConfiguration.WebProxyInitialSetupRequired)
|
private static List<IWebProxyExtension> ExtensionList = new List<IWebProxyExtension>();
|
||||||
|
private static ProxyServer Server = new ProxyServer();
|
||||||
|
private static ExplicitProxyEndPoint end;
|
||||||
|
|
||||||
|
public void LoadExtensions()
|
||||||
{
|
{
|
||||||
string text = "Would you like to enable the Novetus web proxy?\n\n" +
|
string nothingFoundError = "No extensions found. The Web Proxy will run with limited functionality.";
|
||||||
"A web proxy redirects web traffic to a different location and in some cases can act as a gateway to different sites. Novetus uses the web proxy for additional client features and asset redirection.\n\n" +
|
|
||||||
"When enabling the web proxy, Novetus will locally create a certificate upon startup that ensures the proxy's functionality. Novetus will not send any user data to anyone, as everything involving the web proxy is entirely local to this computer.\n" +
|
|
||||||
"If you have any issue connecting to other web sites, including Roblox, closing Novetus or typing 'proxy off' into Novetus' console will fix it in most instances.\n\n" +
|
|
||||||
"Upon pressing 'Yes', Windows will ask you for permission to install the certificate.\n\n" +
|
|
||||||
"You can change this option at any time by typing 'proxy disable' or 'proxy on' in the Novetus console. This message will appear only once.\n";
|
|
||||||
|
|
||||||
DialogResult result = MessageBox.Show(text, "Novetus - Web Proxy Opt-In", MessageBoxButtons.YesNo);
|
if (!Directory.Exists(GlobalPaths.NovetusExtsWebProxy))
|
||||||
|
|
||||||
switch (result)
|
|
||||||
{
|
{
|
||||||
case DialogResult.Yes:
|
Util.ConsolePrint(nothingFoundError, 5);
|
||||||
GlobalVars.UserConfiguration.WebProxyEnabled = true;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load up all .cs files.
|
||||||
|
string[] filePaths = Directory.GetFiles(GlobalPaths.NovetusExtsWebProxy, "*.cs", SearchOption.TopDirectoryOnly);
|
||||||
|
|
||||||
|
if (filePaths.Count() == 0)
|
||||||
|
{
|
||||||
|
Util.ConsolePrint(nothingFoundError, 5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string file in filePaths)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IWebProxyExtension newExt = (IWebProxyExtension)Script.LoadScriptFromContent(file);
|
||||||
|
ExtensionList.Add(newExt);
|
||||||
|
Util.ConsolePrint("Web Proxy: Loaded extension " + newExt.Name + " from " + Path.GetFileName(file), 3);
|
||||||
|
newExt.OnExtensionLoad();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Util.LogExceptions(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasStarted()
|
||||||
|
{
|
||||||
|
return Server.ProxyRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoSetup()
|
||||||
|
{
|
||||||
|
if (GlobalVars.UserConfiguration.WebProxyInitialSetupRequired)
|
||||||
|
{
|
||||||
|
string text = "Would you like to enable the Novetus web proxy?\n\n" +
|
||||||
|
"A web proxy redirects web traffic to a different location and in some cases can act as a gateway to different sites. Novetus uses the web proxy for additional client features and asset redirection.\n\n" +
|
||||||
|
"When enabling the web proxy, Novetus will locally create a certificate upon startup that ensures the proxy's functionality. Novetus will not send any user data to anyone, as everything involving the web proxy is entirely local to this computer.\n" +
|
||||||
|
"If you have any issue connecting to other web sites, including Roblox, closing Novetus or typing 'proxy off' into Novetus' console will fix it in most instances.\n\n" +
|
||||||
|
"Upon pressing 'Yes', Windows will ask you for permission to install the certificate.\n\n" +
|
||||||
|
"You can change this option at any time by typing 'proxy disable' or 'proxy on' in the Novetus console. This message will appear only once.\n";
|
||||||
|
|
||||||
|
DialogResult result = MessageBox.Show(text, "Novetus - Web Proxy Opt-In", MessageBoxButtons.YesNo);
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case DialogResult.Yes:
|
||||||
|
GlobalVars.UserConfiguration.WebProxyEnabled = true;
|
||||||
|
Start();
|
||||||
|
break;
|
||||||
|
case DialogResult.No:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalVars.UserConfiguration.WebProxyInitialSetupRequired = false;
|
||||||
|
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||||
|
{
|
||||||
Start();
|
Start();
|
||||||
break;
|
}
|
||||||
case DialogResult.No:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalVars.UserConfiguration.WebProxyInitialSetupRequired = false;
|
|
||||||
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
public void Start()
|
||||||
{
|
{
|
||||||
if (GlobalVars.UserConfiguration.WebProxyEnabled)
|
try
|
||||||
{
|
{
|
||||||
Start();
|
LoadExtensions();
|
||||||
|
Server.CertificateManager.RootCertificateIssuerName = "Novetus";
|
||||||
|
Server.CertificateManager.RootCertificateName = "Novetus Web Proxy";
|
||||||
|
Server.BeforeRequest += new AsyncEventHandler<SessionEventArgs>(OnRequest);
|
||||||
|
UpdateEndPoint(true);
|
||||||
|
Util.ConsolePrint("Web Proxy started on port " + GlobalVars.WebProxyPort, 3);
|
||||||
|
foreach (IWebProxyExtension extension in ExtensionList.ToArray())
|
||||||
|
{
|
||||||
|
extension.OnProxyStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
}
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//load ext
|
|
||||||
Server.CertificateManager.RootCertificateIssuerName = "Novetus";
|
|
||||||
Server.CertificateManager.RootCertificateName = "Novetus Web Proxy";
|
|
||||||
Server.BeforeRequest += new AsyncEventHandler<SessionEventArgs>(OnRequest);
|
|
||||||
UpdateEndPoint(true);
|
|
||||||
Util.ConsolePrint("Web Proxy started on port " + GlobalVars.WebProxyPort, 3);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Util.LogExceptions(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateEndPoint(bool shouldRunServer = false, bool decrypt = true)
|
|
||||||
{
|
|
||||||
if (Server.ProxyEndPoints.Count > 0)
|
|
||||||
{
|
|
||||||
Server.RemoveEndPoint(end);
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalVars.WebProxyPort = GlobalVars.UserConfiguration.RobloxPort + 1;
|
|
||||||
end = new ExplicitProxyEndPoint(IPAddress.Any, GlobalVars.WebProxyPort, decrypt);
|
|
||||||
end.BeforeTunnelConnectRequest += new AsyncEventHandler<TunnelConnectSessionEventArgs>(OnBeforeTunnelConnectRequest);
|
|
||||||
Server.AddEndPoint(end);
|
|
||||||
|
|
||||||
if (!Server.ProxyRunning && shouldRunServer)
|
|
||||||
{
|
|
||||||
Server.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Server.ProxyRunning)
|
|
||||||
{
|
|
||||||
foreach (ProxyEndPoint endPoint in Server.ProxyEndPoints)
|
|
||||||
{
|
{
|
||||||
Server.SetAsSystemHttpProxy(end);
|
Util.LogExceptions(e);
|
||||||
Server.SetAsSystemHttpsProxy(end);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.ConsolePrint("Web Proxy Endpoint updated with port " + GlobalVars.WebProxyPort, 3);
|
public void UpdateEndPoint(bool shouldRunServer = false, bool decrypt = true)
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsURIAllowed(HttpWebClient client)
|
|
||||||
{
|
|
||||||
string uri = client.Request.RequestUri.Host;
|
|
||||||
|
|
||||||
if ((!uri.StartsWith("www.") &&
|
|
||||||
!uri.StartsWith("web.") &&
|
|
||||||
!uri.StartsWith("assetgame.") &&
|
|
||||||
!uri.StartsWith("wiki.") &&
|
|
||||||
!uri.EndsWith("api.roblox.com") &&
|
|
||||||
!uri.StartsWith("roblox.com") || !uri.EndsWith("roblox.com")) &&
|
|
||||||
!uri.EndsWith("robloxlabs.com"))
|
|
||||||
{
|
{
|
||||||
return false;
|
if (Server.ProxyEndPoints.Count > 0)
|
||||||
|
{
|
||||||
|
Server.RemoveEndPoint(end);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalVars.WebProxyPort = GlobalVars.UserConfiguration.RobloxPort + 1;
|
||||||
|
end = new ExplicitProxyEndPoint(IPAddress.Any, GlobalVars.WebProxyPort, decrypt);
|
||||||
|
end.BeforeTunnelConnectRequest += new AsyncEventHandler<TunnelConnectSessionEventArgs>(OnBeforeTunnelConnectRequest);
|
||||||
|
Server.AddEndPoint(end);
|
||||||
|
|
||||||
|
if (!Server.ProxyRunning && shouldRunServer)
|
||||||
|
{
|
||||||
|
Server.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Server.ProxyRunning)
|
||||||
|
{
|
||||||
|
foreach (ProxyEndPoint endPoint in Server.ProxyEndPoints)
|
||||||
|
{
|
||||||
|
Server.SetAsSystemHttpProxy(end);
|
||||||
|
Server.SetAsSystemHttpsProxy(end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.ConsolePrint("Web Proxy Endpoint updated with port " + GlobalVars.WebProxyPort, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//we check the header
|
private bool IsValidURL(HttpWebClient client)
|
||||||
HeaderCollection headers = client.Request.Headers;
|
|
||||||
List<HttpHeader> userAgents = headers.GetHeaders("User-Agent");
|
|
||||||
|
|
||||||
if (userAgents == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(userAgents.FirstOrDefault().Value))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
string ua = userAgents.FirstOrDefault().Value.ToLowerInvariant();
|
|
||||||
|
|
||||||
//for some reason, this doesn't go through for the browser unless we look for mozilla/4.0.
|
|
||||||
//this shouldn't break modern mozilla browsers though.
|
|
||||||
return (ua.Contains("mozilla/4.0") || ua.Contains("roblox"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
|
|
||||||
{
|
|
||||||
if (!IsURIAllowed(e.HttpClient))
|
|
||||||
{
|
{
|
||||||
e.DecryptSsl = false;
|
string uri = client.Request.RequestUri.Host;
|
||||||
|
|
||||||
|
if ((!uri.StartsWith("www.") &&
|
||||||
|
!uri.StartsWith("web.") &&
|
||||||
|
!uri.StartsWith("assetgame.") &&
|
||||||
|
!uri.StartsWith("wiki.") &&
|
||||||
|
!uri.EndsWith("api.roblox.com") &&
|
||||||
|
!uri.StartsWith("roblox.com") || !uri.EndsWith("roblox.com")) &&
|
||||||
|
!uri.EndsWith("robloxlabs.com"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//we check the header
|
||||||
|
HeaderCollection headers = client.Request.Headers;
|
||||||
|
List<HttpHeader> userAgents = headers.GetHeaders("User-Agent");
|
||||||
|
|
||||||
|
if (userAgents == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(userAgents.FirstOrDefault().Value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string ua = userAgents.FirstOrDefault().Value.ToLowerInvariant();
|
||||||
|
|
||||||
|
//for some reason, this doesn't go through for the browser unless we look for mozilla/4.0.
|
||||||
|
//this shouldn't break modern mozilla browsers though.
|
||||||
|
return (ua.Contains("mozilla/4.0") || ua.Contains("roblox"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
private Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
|
||||||
}
|
{
|
||||||
|
if (!IsValidURL(e.HttpClient))
|
||||||
|
{
|
||||||
|
e.DecryptSsl = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri uri = e.HttpClient.Request.RequestUri;
|
||||||
|
|
||||||
|
foreach (IWebProxyExtension extension in ExtensionList.ToArray())
|
||||||
|
{
|
||||||
|
if (extension.IsValidURL(uri.AbsolutePath.ToLowerInvariant(), uri.Host))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
extension.OnBeforeTunnelConnectRequest(sender, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Util.LogExceptions(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.DecryptSsl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||||
private async Task OnRequest(object sender, SessionEventArgs e)
|
private async Task OnRequest(object sender, SessionEventArgs e)
|
||||||
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||||
{
|
|
||||||
if (!IsURIAllowed(e.HttpClient))
|
|
||||||
{
|
{
|
||||||
return;
|
if (!IsValidURL(e.HttpClient))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri uri = e.HttpClient.Request.RequestUri;
|
||||||
|
|
||||||
|
foreach (IWebProxyExtension extension in ExtensionList.ToArray())
|
||||||
|
{
|
||||||
|
if (extension.IsValidURL(uri.AbsolutePath.ToLowerInvariant(), uri.Host))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await extension.OnRequest(sender, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Util.LogExceptions(ex);
|
||||||
|
e.GenericResponse("", HttpStatusCode.InternalServerError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e.GenericResponse("", HttpStatusCode.NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
e.GenericResponse("", HttpStatusCode.NotFound);
|
public void Stop()
|
||||||
|
{
|
||||||
|
Util.ConsolePrint("Web Proxy stopping on port " + GlobalVars.WebProxyPort, 3);
|
||||||
|
Server.BeforeRequest -= new AsyncEventHandler<SessionEventArgs>(OnRequest);
|
||||||
|
Server.Stop();
|
||||||
|
|
||||||
|
foreach (IWebProxyExtension extension in ExtensionList.ToArray())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
extension.OnProxyStopped();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Util.LogExceptions(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
Util.ConsolePrint("Web Proxy stopping on port " + GlobalVars.WebProxyPort, 3);
|
|
||||||
Server.BeforeRequest -= new AsyncEventHandler<SessionEventArgs>(OnRequest);
|
|
||||||
Server.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IWebProxyExtention
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
<Import_RootNamespace>NovetusCore</Import_RootNamespace>
|
<Import_RootNamespace>NovetusCore</Import_RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Classes\Script.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\WebProxy.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Classes\WebProxy.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\ClientManagement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\ClientManagement.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\Downloader.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Classes\Downloader.cs" />
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -3,116 +3,121 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Global Paths
|
namespace Novetus.Core
|
||||||
|
|
||||||
public class GlobalPaths
|
|
||||||
{
|
{
|
||||||
#region Base Game Paths
|
#region Global Paths
|
||||||
public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
|
||||||
public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\");
|
|
||||||
public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString();
|
|
||||||
public static readonly string BasePath = RootPath.Replace(@"\", @"\\");
|
|
||||||
public static readonly string DataPath = BasePath + @"\\shareddata";
|
|
||||||
public static readonly string BinDir = BasePath + @"\\bin";
|
|
||||||
public static readonly string ConfigDir = BasePath + @"\\config";
|
|
||||||
public static readonly string LogDir = BasePath + @"\\logs";
|
|
||||||
public static readonly string ConfigDirClients = ConfigDir + @"\\clients";
|
|
||||||
public static readonly string ConfigDirTemplates = ConfigDir + @"\\itemtemplates";
|
|
||||||
public static readonly string DataDir = BinDir + @"\\data";
|
|
||||||
public static readonly string ClientDir = BasePath + @"\\clients";
|
|
||||||
public static readonly string MapsDir = BasePath + @"\\maps";
|
|
||||||
public static readonly string AddonDir = BasePath + @"\\addons";
|
|
||||||
public static readonly string AddonCoreDir = AddonDir + @"\\core";
|
|
||||||
public static readonly string MapsDirCustom = MapsDir + @"\\Custom";
|
|
||||||
public static readonly string MapsDirBase = "maps";
|
|
||||||
public static readonly string BaseGameDir = "rbxasset://../../../";
|
|
||||||
public static readonly string AltBaseGameDir = "rbxasset://";
|
|
||||||
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Customization Paths
|
public class GlobalPaths
|
||||||
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
|
{
|
||||||
public static readonly string hatdir = CustomPlayerDir + "\\hats";
|
#region Base Game Paths
|
||||||
public static readonly string facedir = CustomPlayerDir + "\\faces";
|
public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||||
public static readonly string headdir = CustomPlayerDir + "\\heads";
|
public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\");
|
||||||
public static readonly string tshirtdir = CustomPlayerDir + "\\tshirts";
|
public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString();
|
||||||
public static readonly string shirtdir = CustomPlayerDir + "\\shirts";
|
public static readonly string BasePath = RootPath.Replace(@"\", @"\\");
|
||||||
public static readonly string pantsdir = CustomPlayerDir + "\\pants";
|
public static readonly string DataPath = BasePath + @"\\shareddata";
|
||||||
public static readonly string extradir = CustomPlayerDir + "\\custom";
|
public static readonly string BinDir = BasePath + @"\\bin";
|
||||||
public static readonly string extradirIcons = extradir + "\\icons";
|
public static readonly string ConfigDir = BasePath + @"\\config";
|
||||||
|
public static readonly string LogDir = BasePath + @"\\logs";
|
||||||
|
public static readonly string ConfigDirClients = ConfigDir + @"\\clients";
|
||||||
|
public static readonly string ConfigDirTemplates = ConfigDir + @"\\itemtemplates";
|
||||||
|
public static readonly string DataDir = BinDir + @"\\data";
|
||||||
|
public static readonly string ClientDir = BasePath + @"\\clients";
|
||||||
|
public static readonly string MapsDir = BasePath + @"\\maps";
|
||||||
|
public static readonly string AddonDir = BasePath + @"\\addons";
|
||||||
|
public static readonly string AddonCoreDir = AddonDir + @"\\core";
|
||||||
|
public static readonly string AddonNovetusExts = AddonDir + @"\\novetusexts";
|
||||||
|
public static readonly string NovetusExtsWebProxy = AddonNovetusExts + @"\\webproxy";
|
||||||
|
public static readonly string MapsDirCustom = MapsDir + @"\\Custom";
|
||||||
|
public static readonly string MapsDirBase = "maps";
|
||||||
|
public static readonly string BaseGameDir = "rbxasset://../../../";
|
||||||
|
public static readonly string AltBaseGameDir = "rbxasset://";
|
||||||
|
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/";
|
#region Customization Paths
|
||||||
public static readonly string hatGameDir = CharCustomGameDir + "hats/";
|
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
|
||||||
public static readonly string faceGameDir = CharCustomGameDir + "faces/";
|
public static readonly string hatdir = CustomPlayerDir + "\\hats";
|
||||||
public static readonly string headGameDir = CharCustomGameDir + "heads/";
|
public static readonly string facedir = CustomPlayerDir + "\\faces";
|
||||||
public static readonly string tshirtGameDir = CharCustomGameDir + "tshirts/";
|
public static readonly string headdir = CustomPlayerDir + "\\heads";
|
||||||
public static readonly string shirtGameDir = CharCustomGameDir + "shirts/";
|
public static readonly string tshirtdir = CustomPlayerDir + "\\tshirts";
|
||||||
public static readonly string pantsGameDir = CharCustomGameDir + "pants/";
|
public static readonly string shirtdir = CustomPlayerDir + "\\shirts";
|
||||||
public static readonly string extraGameDir = CharCustomGameDir + "custom/";
|
public static readonly string pantsdir = CustomPlayerDir + "\\pants";
|
||||||
#endregion
|
public static readonly string extradir = CustomPlayerDir + "\\custom";
|
||||||
|
public static readonly string extradirIcons = extradir + "\\icons";
|
||||||
|
|
||||||
#region Asset Cache Paths
|
public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/";
|
||||||
|
public static readonly string hatGameDir = CharCustomGameDir + "hats/";
|
||||||
|
public static readonly string faceGameDir = CharCustomGameDir + "faces/";
|
||||||
|
public static readonly string headGameDir = CharCustomGameDir + "heads/";
|
||||||
|
public static readonly string tshirtGameDir = CharCustomGameDir + "tshirts/";
|
||||||
|
public static readonly string shirtGameDir = CharCustomGameDir + "shirts/";
|
||||||
|
public static readonly string pantsGameDir = CharCustomGameDir + "pants/";
|
||||||
|
public static readonly string extraGameDir = CharCustomGameDir + "custom/";
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Base Paths
|
#region Asset Cache Paths
|
||||||
public static readonly string DirFonts = "\\fonts";
|
|
||||||
public static readonly string DirSounds = "\\sounds";
|
|
||||||
public static readonly string DirTextures = "\\textures";
|
|
||||||
public static readonly string DirScripts = "\\scripts";
|
|
||||||
public static readonly string FontsGameDir = "fonts/";
|
|
||||||
public static readonly string SoundsGameDir = "sounds/";
|
|
||||||
public static readonly string TexturesGameDir = "textures/";
|
|
||||||
public static readonly string ScriptsGameDir = "scripts/";
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Asset Dirs
|
#region Base Paths
|
||||||
public static string AssetCacheDir = DataPath + "\\assetcache";
|
public static readonly string DirFonts = "\\fonts";
|
||||||
public static string AssetCacheDirAssets = AssetCacheDir + "\\assets";
|
public static readonly string DirSounds = "\\sounds";
|
||||||
|
public static readonly string DirTextures = "\\textures";
|
||||||
|
public static readonly string DirScripts = "\\scripts";
|
||||||
|
public static readonly string FontsGameDir = "fonts/";
|
||||||
|
public static readonly string SoundsGameDir = "sounds/";
|
||||||
|
public static readonly string TexturesGameDir = "textures/";
|
||||||
|
public static readonly string ScriptsGameDir = "scripts/";
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
|
#region Asset Dirs
|
||||||
public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/";
|
public static string AssetCacheDir = DataPath + "\\assetcache";
|
||||||
#endregion
|
public static string AssetCacheDirAssets = AssetCacheDir + "\\assets";
|
||||||
|
|
||||||
#region Item Dirs
|
public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
|
||||||
public static readonly string hatdirFonts = hatdir + DirFonts;
|
public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/";
|
||||||
public static readonly string hatdirTextures = hatdir + DirTextures;
|
#endregion
|
||||||
public static readonly string hatdirSounds = hatdir + DirSounds;
|
|
||||||
public static readonly string hatdirScripts = hatdir + DirScripts;
|
|
||||||
public static readonly string facedirTextures = facedir; //+ DirTextures;
|
|
||||||
public static readonly string headdirFonts = headdir + DirFonts;
|
|
||||||
public static readonly string headdirTextures = headdir + DirTextures;
|
|
||||||
public static readonly string tshirtdirTextures = tshirtdir; //+ DirTextures;
|
|
||||||
public static readonly string shirtdirTextures = shirtdir + DirTextures;
|
|
||||||
public static readonly string pantsdirTextures = pantsdir + DirTextures;
|
|
||||||
|
|
||||||
public static readonly string hatGameDirFonts = hatGameDir + FontsGameDir;
|
#region Item Dirs
|
||||||
public static readonly string hatGameDirTextures = hatGameDir + TexturesGameDir;
|
public static readonly string hatdirFonts = hatdir + DirFonts;
|
||||||
public static readonly string hatGameDirSounds = hatGameDir + SoundsGameDir;
|
public static readonly string hatdirTextures = hatdir + DirTextures;
|
||||||
public static readonly string hatGameDirScripts = hatGameDir + ScriptsGameDir;
|
public static readonly string hatdirSounds = hatdir + DirSounds;
|
||||||
public static readonly string faceGameDirTextures = faceGameDir; //+ TexturesGameDir;
|
public static readonly string hatdirScripts = hatdir + DirScripts;
|
||||||
public static readonly string headGameDirFonts = headGameDir + FontsGameDir;
|
public static readonly string facedirTextures = facedir; //+ DirTextures;
|
||||||
public static readonly string headGameDirTextures = headGameDir + TexturesGameDir;
|
public static readonly string headdirFonts = headdir + DirFonts;
|
||||||
public static readonly string tshirtGameDirTextures = tshirtGameDir; //+ TexturesGameDir;
|
public static readonly string headdirTextures = headdir + DirTextures;
|
||||||
public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir;
|
public static readonly string tshirtdirTextures = tshirtdir; //+ DirTextures;
|
||||||
public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir;
|
public static readonly string shirtdirTextures = shirtdir + DirTextures;
|
||||||
#endregion
|
public static readonly string pantsdirTextures = pantsdir + DirTextures;
|
||||||
|
|
||||||
#endregion
|
public static readonly string hatGameDirFonts = hatGameDir + FontsGameDir;
|
||||||
|
public static readonly string hatGameDirTextures = hatGameDir + TexturesGameDir;
|
||||||
|
public static readonly string hatGameDirSounds = hatGameDir + SoundsGameDir;
|
||||||
|
public static readonly string hatGameDirScripts = hatGameDir + ScriptsGameDir;
|
||||||
|
public static readonly string faceGameDirTextures = faceGameDir; //+ TexturesGameDir;
|
||||||
|
public static readonly string headGameDirFonts = headGameDir + FontsGameDir;
|
||||||
|
public static readonly string headGameDirTextures = headGameDir + TexturesGameDir;
|
||||||
|
public static readonly string tshirtGameDirTextures = tshirtGameDir; //+ TexturesGameDir;
|
||||||
|
public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir;
|
||||||
|
public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir;
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Names
|
#endregion
|
||||||
public static readonly string ConfigName = "config.ini";
|
|
||||||
public static string ConfigNameCustomization = "config_customization.ini";
|
#region File Names
|
||||||
public static readonly string InfoName = "info.ini";
|
public static readonly string ConfigName = "config.ini";
|
||||||
public static readonly string ScriptName = "CSMPFunctions";
|
public static string ConfigNameCustomization = "config_customization.ini";
|
||||||
public static readonly string ScriptGenName = "CSMPBoot";
|
public static readonly string InfoName = "info.ini";
|
||||||
public static readonly string ContentProviderXMLName = "ContentProviders.xml";
|
public static readonly string ScriptName = "CSMPFunctions";
|
||||||
public static readonly string PartColorXMLName = "PartColors.xml";
|
public static readonly string ScriptGenName = "CSMPBoot";
|
||||||
public static readonly string FileDeleteFilterName = "FileDeleteFilter.txt";
|
public static readonly string ContentProviderXMLName = "ContentProviders.xml";
|
||||||
public static readonly string InitialFileListIgnoreFilterName = "InitialFileListIgnoreFilter.txt";
|
public static readonly string PartColorXMLName = "PartColors.xml";
|
||||||
public static readonly string ServerInfoFileName = "serverinfo.txt";
|
public static readonly string FileDeleteFilterName = "FileDeleteFilter.txt";
|
||||||
public static readonly string ConsoleHelpFileName = "consolehelp.txt";
|
public static readonly string InitialFileListIgnoreFilterName = "InitialFileListIgnoreFilter.txt";
|
||||||
public static readonly string ClientScriptDocumentationFileName = "documentation.txt";
|
public static readonly string ServerInfoFileName = "serverinfo.txt";
|
||||||
public static readonly string AddonLoaderFileName = "AddonLoader.lua";
|
public static readonly string ConsoleHelpFileName = "consolehelp.txt";
|
||||||
public static readonly string AssetFixerPatternFileName = "assetfixer_pattern.txt";
|
public static readonly string ClientScriptDocumentationFileName = "documentation.txt";
|
||||||
|
public static readonly string AddonLoaderFileName = "AddonLoader.lua";
|
||||||
|
public static readonly string AssetFixerPatternFileName = "assetfixer_pattern.txt";
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -14,140 +14,143 @@ using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Script Type
|
namespace Novetus.Core
|
||||||
public enum ScriptType
|
|
||||||
{
|
{
|
||||||
Client = 0,
|
#region Script Type
|
||||||
Server = 1,
|
public enum ScriptType
|
||||||
Solo = 2,
|
|
||||||
Studio = 3,
|
|
||||||
EasterEgg = 4,
|
|
||||||
None = 5
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Game Server Definition
|
|
||||||
public class GameServer
|
|
||||||
{
|
|
||||||
public GameServer(string ip, int port)
|
|
||||||
{
|
{
|
||||||
ServerIP = ip;
|
Client = 0,
|
||||||
ServerPort = port;
|
Server = 1,
|
||||||
|
Solo = 2,
|
||||||
|
Studio = 3,
|
||||||
|
EasterEgg = 4,
|
||||||
|
None = 5
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public override string ToString()
|
#region Game Server Definition
|
||||||
|
public class GameServer
|
||||||
{
|
{
|
||||||
return ServerIP + ":" + ServerPort.ToString();
|
public GameServer(string ip, int port)
|
||||||
}
|
|
||||||
|
|
||||||
public void SetValues(string input)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
string[] vals = input.Split(':');
|
|
||||||
string ip = vals[0];
|
|
||||||
int port = Convert.ToInt32(vals[1]);
|
|
||||||
|
|
||||||
ServerIP = ip;
|
ServerIP = ip;
|
||||||
ServerPort = port;
|
ServerPort = port;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
|
||||||
|
public override string ToString()
|
||||||
{
|
{
|
||||||
ServerIP = input;
|
return ServerIP + ":" + ServerPort.ToString();
|
||||||
ServerPort = GlobalVars.DefaultRobloxPort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetValues(string input)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string[] vals = input.Split(':');
|
||||||
|
string ip = vals[0];
|
||||||
|
int port = Convert.ToInt32(vals[1]);
|
||||||
|
|
||||||
|
ServerIP = ip;
|
||||||
|
ServerPort = port;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ServerIP = input;
|
||||||
|
ServerPort = GlobalVars.DefaultRobloxPort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ServerIP { get; set; }
|
||||||
|
public int ServerPort { get; set; }
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public string ServerIP { get; set; }
|
#region Global Variables
|
||||||
public int ServerPort { get; set; }
|
public static class GlobalVars
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Global Variables
|
|
||||||
public static class GlobalVars
|
|
||||||
{
|
|
||||||
#region Discord
|
|
||||||
public enum LauncherState
|
|
||||||
{
|
{
|
||||||
InLauncher = 0,
|
#region Discord
|
||||||
InMPGame = 1,
|
public enum LauncherState
|
||||||
InSoloGame = 2,
|
{
|
||||||
InStudio = 3,
|
InLauncher = 0,
|
||||||
InCustomization = 4,
|
InMPGame = 1,
|
||||||
InEasterEggGame = 5,
|
InSoloGame = 2,
|
||||||
LoadingURI = 6
|
InStudio = 3,
|
||||||
}
|
InCustomization = 4,
|
||||||
|
InEasterEggGame = 5,
|
||||||
|
LoadingURI = 6
|
||||||
|
}
|
||||||
|
|
||||||
public static DiscordRPC.EventHandlers handlers;
|
public static DiscordRPC.EventHandlers handlers;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Class definitions
|
#region Class definitions
|
||||||
public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo();
|
public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo();
|
||||||
public static FileFormat.Config UserConfiguration = new FileFormat.Config();
|
public static FileFormat.Config UserConfiguration = new FileFormat.Config();
|
||||||
public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo();
|
public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo();
|
||||||
public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig();
|
public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig();
|
||||||
public static PartColor[] PartColorList;
|
public static PartColor[] PartColorList;
|
||||||
public static List<PartColor> PartColorListConv;
|
public static List<PartColor> PartColorListConv;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Joining/Hosting
|
#region Joining/Hosting
|
||||||
public static string DefaultIP = "localhost";
|
public static string DefaultIP = "localhost";
|
||||||
public static int DefaultRobloxPort = 53640;
|
public static int DefaultRobloxPort = 53640;
|
||||||
public static GameServer CurrentServer = new GameServer(DefaultIP, DefaultRobloxPort);
|
public static GameServer CurrentServer = new GameServer(DefaultIP, DefaultRobloxPort);
|
||||||
public static string ExternalIP = SecurityFuncs.GetExternalIPAddress();
|
public static string ExternalIP = SecurityFuncs.GetExternalIPAddress();
|
||||||
public static ScriptType GameOpened = ScriptType.None;
|
public static ScriptType GameOpened = ScriptType.None;
|
||||||
public static string PlayerTripcode = "";
|
public static string PlayerTripcode = "";
|
||||||
#if LAUNCHER || URI
|
#if LAUNCHER || URI
|
||||||
public static int WebProxyPort = 0;
|
public static int WebProxyPort = 0;
|
||||||
public static WebProxy Proxy = new WebProxy();
|
public static WebProxy Proxy = new WebProxy();
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if LAUNCHER
|
#if LAUNCHER
|
||||||
#region Novetus Launcher
|
#region Novetus Launcher
|
||||||
public static NovetusLauncher.NovetusConsole consoleForm = null;
|
public static NovetusLauncher.NovetusConsole consoleForm = null;
|
||||||
#endregion
|
#endregion
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#region Customization
|
#region Customization
|
||||||
public static string Loadout = "";
|
public static string Loadout = "";
|
||||||
public static string soloLoadout = "";
|
public static string soloLoadout = "";
|
||||||
public static string TShirtTextureID = "";
|
public static string TShirtTextureID = "";
|
||||||
public static string ShirtTextureID = "";
|
public static string ShirtTextureID = "";
|
||||||
public static string PantsTextureID = "";
|
public static string PantsTextureID = "";
|
||||||
public static string FaceTextureID = "";
|
public static string FaceTextureID = "";
|
||||||
public static string TShirtTextureLocal = "";
|
public static string TShirtTextureLocal = "";
|
||||||
public static string ShirtTextureLocal = "";
|
public static string ShirtTextureLocal = "";
|
||||||
public static string PantsTextureLocal = "";
|
public static string PantsTextureLocal = "";
|
||||||
public static string FaceTextureLocal = "";
|
public static string FaceTextureLocal = "";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Discord Variables
|
#region Discord Variables
|
||||||
//discord
|
//discord
|
||||||
public static DiscordRPC.RichPresence presence;
|
public static DiscordRPC.RichPresence presence;
|
||||||
public static string appid = "505955125727330324";
|
public static string appid = "505955125727330324";
|
||||||
public static string imagekey_large = "novetus_large";
|
public static string imagekey_large = "novetus_large";
|
||||||
public static string image_ingame = "ingame_small";
|
public static string image_ingame = "ingame_small";
|
||||||
public static string image_inlauncher = "inlauncher_small";
|
public static string image_inlauncher = "inlauncher_small";
|
||||||
public static string image_instudio = "instudio_small";
|
public static string image_instudio = "instudio_small";
|
||||||
public static string image_incustomization = "incustomization_small";
|
public static string image_incustomization = "incustomization_small";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Other
|
#region Other
|
||||||
public static bool ExtendedVersionNumber = false;
|
public static bool ExtendedVersionNumber = false;
|
||||||
public static bool LocalPlayMode = false;
|
public static bool LocalPlayMode = false;
|
||||||
public static bool AdminMode = false;
|
public static bool AdminMode = false;
|
||||||
public static bool ColorsLoaded = false;
|
public static bool ColorsLoaded = false;
|
||||||
public static int ValidatedExtraFiles = 0;
|
public static int ValidatedExtraFiles = 0;
|
||||||
public static bool NoFileList = false;
|
public static bool NoFileList = false;
|
||||||
public static string ServerID = "N/A";
|
public static string ServerID = "N/A";
|
||||||
public static string PingURL = "";
|
public static string PingURL = "";
|
||||||
public static string Important = "";
|
public static string Important = "";
|
||||||
public static string Important2 = "";
|
public static string Important2 = "";
|
||||||
public static string NextCommand = "";
|
public static string NextCommand = "";
|
||||||
public static bool AppClosed = false;
|
public static bool AppClosed = false;
|
||||||
public static bool isConsoleOnly = false;
|
public static bool isConsoleOnly = false;
|
||||||
public static bool isMapCompressed = false;
|
public static bool isMapCompressed = false;
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -4,50 +4,53 @@ using Mono.Nat;
|
||||||
using System;
|
using System;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region NetFuncs
|
namespace Novetus.Core
|
||||||
|
|
||||||
public static class NetFuncs
|
|
||||||
{
|
{
|
||||||
public static void InitUPnP(EventHandler<DeviceEventArgs> DeviceFound, EventHandler<DeviceEventArgs> DeviceLost)
|
#region NetFuncs
|
||||||
{
|
|
||||||
if (GlobalVars.UserConfiguration.UPnP)
|
|
||||||
{
|
|
||||||
NatUtility.DeviceFound += DeviceFound;
|
|
||||||
NatUtility.StartDiscovery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void StartUPnP(INatDevice device, Protocol protocol, int port)
|
public static class NetFuncs
|
||||||
{
|
{
|
||||||
if (GlobalVars.UserConfiguration.UPnP)
|
public static void InitUPnP(EventHandler<DeviceEventArgs> DeviceFound, EventHandler<DeviceEventArgs> DeviceLost)
|
||||||
{
|
{
|
||||||
Mapping checker = device.GetSpecificMapping(protocol, port);
|
if (GlobalVars.UserConfiguration.UPnP)
|
||||||
int mapPublic = checker.PublicPort;
|
|
||||||
int mapPrivate = checker.PrivatePort;
|
|
||||||
|
|
||||||
if (mapPublic == -1 && mapPrivate == -1)
|
|
||||||
{
|
{
|
||||||
Mapping portmap = new Mapping(protocol, port, port);
|
NatUtility.DeviceFound += DeviceFound;
|
||||||
device.CreatePortMap(portmap);
|
NatUtility.StartDiscovery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static void StartUPnP(INatDevice device, Protocol protocol, int port)
|
||||||
public static void StopUPnP(INatDevice device, Protocol protocol, int port)
|
{
|
||||||
{
|
if (GlobalVars.UserConfiguration.UPnP)
|
||||||
if (GlobalVars.UserConfiguration.UPnP)
|
{
|
||||||
{
|
Mapping checker = device.GetSpecificMapping(protocol, port);
|
||||||
Mapping checker = device.GetSpecificMapping(protocol, port);
|
int mapPublic = checker.PublicPort;
|
||||||
int mapPublic = checker.PublicPort;
|
int mapPrivate = checker.PrivatePort;
|
||||||
int mapPrivate = checker.PrivatePort;
|
|
||||||
|
if (mapPublic == -1 && mapPrivate == -1)
|
||||||
if (mapPublic != -1 && mapPrivate != -1)
|
{
|
||||||
{
|
Mapping portmap = new Mapping(protocol, port, port);
|
||||||
Mapping portmap = new Mapping(protocol, port, port);
|
device.CreatePortMap(portmap);
|
||||||
device.DeletePortMap(portmap);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StopUPnP(INatDevice device, Protocol protocol, int port)
|
||||||
|
{
|
||||||
|
if (GlobalVars.UserConfiguration.UPnP)
|
||||||
|
{
|
||||||
|
Mapping checker = device.GetSpecificMapping(protocol, port);
|
||||||
|
int mapPublic = checker.PublicPort;
|
||||||
|
int mapPrivate = checker.PrivatePort;
|
||||||
|
|
||||||
|
if (mapPublic != -1 && mapPrivate != -1)
|
||||||
|
{
|
||||||
|
Mapping portmap = new Mapping(protocol, port, port);
|
||||||
|
device.DeletePortMap(portmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -14,369 +14,376 @@ using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Security Functions
|
namespace Novetus.Core
|
||||||
public class SecurityFuncs
|
|
||||||
{
|
{
|
||||||
[DllImport("user32.dll")]
|
#region Security Functions
|
||||||
static extern int SetWindowText(IntPtr hWnd, string text);
|
public class SecurityFuncs
|
||||||
|
|
||||||
public static string RandomString(int length)
|
|
||||||
{
|
{
|
||||||
CryptoRandom random = new CryptoRandom();
|
[DllImport("user32.dll")]
|
||||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
|
static extern int SetWindowText(IntPtr hWnd, string text);
|
||||||
return new string(Enumerable.Repeat(chars, length)
|
|
||||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int GenerateRandomNumber()
|
public static string RandomString(int length)
|
||||||
{
|
|
||||||
CryptoRandom random = new CryptoRandom();
|
|
||||||
int randomID = 0;
|
|
||||||
int randIDmode = random.Next(0, 8);
|
|
||||||
int idlimit = 0;
|
|
||||||
|
|
||||||
switch (randIDmode)
|
|
||||||
{
|
{
|
||||||
case 0:
|
CryptoRandom random = new CryptoRandom();
|
||||||
idlimit = 9;
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
break;
|
return new string(Enumerable.Repeat(chars, length)
|
||||||
case 1:
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||||
idlimit = 99;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
idlimit = 999;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
idlimit = 9999;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
idlimit = 99999;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
idlimit = 999999;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
idlimit = 9999999;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
idlimit = 99999999;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idlimit > 0)
|
public static int GenerateRandomNumber()
|
||||||
{
|
{
|
||||||
randomID = random.Next(0, idlimit);
|
CryptoRandom random = new CryptoRandom();
|
||||||
}
|
int randomID = 0;
|
||||||
else
|
int randIDmode = random.Next(0, 8);
|
||||||
{
|
int idlimit = 0;
|
||||||
randomID = random.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//2147483647 is max id.
|
switch (randIDmode)
|
||||||
return randomID;
|
|
||||||
}
|
|
||||||
|
|
||||||
//these 2 methods are for the clientinfo creator.
|
|
||||||
public static string Base64DecodeNew(string base64EncodedData)
|
|
||||||
{
|
|
||||||
return base64EncodedData.Decrypt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Base64DecodeOld(string base64EncodedData)
|
|
||||||
{
|
|
||||||
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
|
|
||||||
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is for everything else
|
|
||||||
public static string Base64Decode(string base64EncodedData)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string decode = base64EncodedData.Decrypt();
|
|
||||||
return decode;
|
|
||||||
}
|
|
||||||
catch(Exception)
|
|
||||||
{
|
|
||||||
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
|
|
||||||
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Base64Encode(string plainText, bool oldVer = false)
|
|
||||||
{
|
|
||||||
if (oldVer)
|
|
||||||
{
|
|
||||||
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
|
|
||||||
return System.Convert.ToBase64String(plainTextBytes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return plainText.Crypt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsBase64String(string s)
|
|
||||||
{
|
|
||||||
s = s.Trim();
|
|
||||||
return (s.Length % 4 == 0) && Regex.IsMatch(s, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long UnixTimeNow()
|
|
||||||
{
|
|
||||||
var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
|
|
||||||
return (long)timeSpan.TotalSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool checkClientMD5(string client)
|
|
||||||
{
|
|
||||||
if (!GlobalVars.AdminMode)
|
|
||||||
{
|
|
||||||
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
|
||||||
{
|
{
|
||||||
string rbxexe = "";
|
case 0:
|
||||||
string BasePath = GlobalPaths.BasePath + "\\clients\\" + client;
|
idlimit = 9;
|
||||||
if (GlobalVars.SelectedClientInfo.LegacyMode)
|
break;
|
||||||
|
case 1:
|
||||||
|
idlimit = 99;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
idlimit = 999;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
idlimit = 9999;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
idlimit = 99999;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
idlimit = 999999;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
idlimit = 9999999;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
idlimit = 99999999;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idlimit > 0)
|
||||||
|
{
|
||||||
|
randomID = random.Next(0, idlimit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
randomID = random.Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
//2147483647 is max id.
|
||||||
|
return randomID;
|
||||||
|
}
|
||||||
|
|
||||||
|
//these 2 methods are for the clientinfo creator.
|
||||||
|
public static string Base64DecodeNew(string base64EncodedData)
|
||||||
|
{
|
||||||
|
return base64EncodedData.Decrypt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Base64DecodeOld(string base64EncodedData)
|
||||||
|
{
|
||||||
|
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
|
||||||
|
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
//this is for everything else
|
||||||
|
public static string Base64Decode(string base64EncodedData)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string decode = base64EncodedData.Decrypt();
|
||||||
|
return decode;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
|
||||||
|
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Base64Encode(string plainText, bool oldVer = false)
|
||||||
|
{
|
||||||
|
if (oldVer)
|
||||||
|
{
|
||||||
|
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
|
||||||
|
return System.Convert.ToBase64String(plainTextBytes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return plainText.Crypt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsBase64String(string s)
|
||||||
|
{
|
||||||
|
s = s.Trim();
|
||||||
|
return (s.Length % 4 == 0) && Regex.IsMatch(s, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long UnixTimeNow()
|
||||||
|
{
|
||||||
|
var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
|
||||||
|
return (long)timeSpan.TotalSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool checkClientMD5(string client)
|
||||||
|
{
|
||||||
|
if (!GlobalVars.AdminMode)
|
||||||
|
{
|
||||||
|
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
||||||
{
|
{
|
||||||
rbxexe = BasePath + "\\RobloxApp.exe";
|
string rbxexe = "";
|
||||||
}
|
string BasePath = GlobalPaths.BasePath + "\\clients\\" + client;
|
||||||
else if (GlobalVars.SelectedClientInfo.SeperateFolders)
|
if (GlobalVars.SelectedClientInfo.LegacyMode)
|
||||||
{
|
{
|
||||||
rbxexe = BasePath + "\\client\\RobloxApp_client.exe";
|
rbxexe = BasePath + "\\RobloxApp.exe";
|
||||||
}
|
}
|
||||||
else if (GlobalVars.SelectedClientInfo.UsesCustomClientEXEName)
|
else if (GlobalVars.SelectedClientInfo.SeperateFolders)
|
||||||
{
|
{
|
||||||
rbxexe = BasePath + @"\\" + GlobalVars.SelectedClientInfo.CustomClientEXEName;
|
rbxexe = BasePath + "\\client\\RobloxApp_client.exe";
|
||||||
|
}
|
||||||
|
else if (GlobalVars.SelectedClientInfo.UsesCustomClientEXEName)
|
||||||
|
{
|
||||||
|
rbxexe = BasePath + @"\\" + GlobalVars.SelectedClientInfo.CustomClientEXEName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rbxexe = BasePath + "\\RobloxApp_client.exe";
|
||||||
|
}
|
||||||
|
return CheckMD5(GlobalVars.SelectedClientInfo.ClientMD5, rbxexe);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rbxexe = BasePath + "\\RobloxApp_client.exe";
|
return true;
|
||||||
}
|
}
|
||||||
return CheckMD5(GlobalVars.SelectedClientInfo.ClientMD5, rbxexe);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool checkScriptMD5(string client)
|
public static bool checkScriptMD5(string client)
|
||||||
{
|
|
||||||
if (!GlobalVars.AdminMode)
|
|
||||||
{
|
{
|
||||||
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
if (!GlobalVars.AdminMode)
|
||||||
{
|
{
|
||||||
string rbxscript = GlobalPaths.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua";
|
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
||||||
return CheckMD5(GlobalVars.SelectedClientInfo.ScriptMD5, rbxscript);
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CheckMD5(string MD5Hash, string path)
|
|
||||||
{
|
|
||||||
if (!File.Exists(path))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
using (var md5 = MD5.Create())
|
|
||||||
{
|
|
||||||
using (var stream = File.OpenRead(path))
|
|
||||||
{
|
|
||||||
byte[] hash = md5.ComputeHash(stream);
|
|
||||||
string clientMD5 = BitConverter.ToString(hash).Replace("-", "");
|
|
||||||
if (clientMD5.Equals(MD5Hash))
|
|
||||||
{
|
{
|
||||||
return true;
|
string rbxscript = GlobalPaths.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua";
|
||||||
|
return CheckMD5(GlobalVars.SelectedClientInfo.ScriptMD5, rbxscript);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
|
||||||
|
|
||||||
public static string GenerateMD5(string filename)
|
|
||||||
{
|
|
||||||
using (var md5 = MD5.Create())
|
|
||||||
{
|
|
||||||
using (var stream = new BufferedStream(File.OpenRead(filename), 1200000))
|
|
||||||
{
|
{
|
||||||
return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "");
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsElevated
|
public static bool CheckMD5(string MD5Hash, string path)
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
{
|
||||||
return WindowsIdentity.GetCurrent().Owner.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid);
|
if (!File.Exists(path))
|
||||||
}
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
public static string RandomStringTitle()
|
using (var md5 = MD5.Create())
|
||||||
{
|
|
||||||
CryptoRandom random = new CryptoRandom();
|
|
||||||
return new String(' ', random.Next(20));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RenameWindow(Process exe, ScriptType type, string clientname, string mapname)
|
|
||||||
{
|
|
||||||
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
|
||||||
{
|
|
||||||
int time = 500;
|
|
||||||
BackgroundWorker worker = new BackgroundWorker();
|
|
||||||
worker.WorkerSupportsCancellation = true;
|
|
||||||
worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
|
|
||||||
worker.RunWorkerAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WorkerKill(Process exe, ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname)
|
|
||||||
{
|
|
||||||
worker.DoWork -= (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
|
|
||||||
worker.CancelAsync();
|
|
||||||
worker.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WorkerDoWork(Process exe, ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname)
|
|
||||||
{
|
|
||||||
DateTime StartTimeAfterMinute = exe.StartTime.AddMinutes(1);
|
|
||||||
|
|
||||||
if (exe.IsRunning())
|
|
||||||
{
|
|
||||||
while (exe.IsRunning())
|
|
||||||
{
|
{
|
||||||
if (exe.MainWindowHandle == null && DateTime.Now > StartTimeAfterMinute)
|
using (var stream = File.OpenRead(path))
|
||||||
{
|
|
||||||
exe.Kill();
|
|
||||||
WorkerKill(exe, type, time, worker, clientname, mapname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
{
|
||||||
case ScriptType.Client:
|
byte[] hash = md5.ComputeHash(stream);
|
||||||
SetWindowText(exe.MainWindowHandle, "Novetus "
|
string clientMD5 = BitConverter.ToString(hash).Replace("-", "");
|
||||||
+ GlobalVars.ProgramInformation.Version + " - "
|
if (clientMD5.Equals(MD5Hash))
|
||||||
+ clientname + " "
|
{
|
||||||
+ ScriptFuncs.Generator.GetNameForType(type)
|
return true;
|
||||||
+ " [" + GlobalVars.CurrentServer.ToString() + "]"
|
}
|
||||||
+ RandomStringTitle());
|
else
|
||||||
break;
|
{
|
||||||
case ScriptType.Server:
|
return false;
|
||||||
case ScriptType.Solo:
|
}
|
||||||
SetWindowText(exe.MainWindowHandle, "Novetus "
|
|
||||||
+ GlobalVars.ProgramInformation.Version + " - "
|
|
||||||
+ clientname + " "
|
|
||||||
+ ScriptFuncs.Generator.GetNameForType(type)
|
|
||||||
+ (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]")
|
|
||||||
+ RandomStringTitle());
|
|
||||||
break;
|
|
||||||
case ScriptType.Studio:
|
|
||||||
SetWindowText(exe.MainWindowHandle, "Novetus Studio "
|
|
||||||
+ GlobalVars.ProgramInformation.Version + " - "
|
|
||||||
+ clientname
|
|
||||||
+ (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]")
|
|
||||||
+ RandomStringTitle());
|
|
||||||
break;
|
|
||||||
case ScriptType.EasterEgg:
|
|
||||||
default:
|
|
||||||
SetWindowText(exe.MainWindowHandle, ScriptFuncs.Generator.GetNameForType(type)
|
|
||||||
+ RandomStringTitle());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
public static string GenerateMD5(string filename)
|
||||||
{
|
{
|
||||||
Thread.Sleep(time);
|
using (var md5 = MD5.Create())
|
||||||
RenameWindow(exe, type, clientname, mapname);
|
{
|
||||||
|
using (var stream = new BufferedStream(File.OpenRead(filename), 1200000))
|
||||||
|
{
|
||||||
|
return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetExternalIPAddress()
|
public static bool IsElevated
|
||||||
{
|
{
|
||||||
string ipAddress;
|
get
|
||||||
|
{
|
||||||
try
|
return WindowsIdentity.GetCurrent().Owner.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid);
|
||||||
{
|
}
|
||||||
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string RandomStringTitle()
|
||||||
|
{
|
||||||
|
CryptoRandom random = new CryptoRandom();
|
||||||
|
return new String(' ', random.Next(20));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RenameWindow(Process exe, ScriptType type, string clientname, string mapname)
|
||||||
|
{
|
||||||
|
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
|
||||||
|
{
|
||||||
|
int time = 500;
|
||||||
|
BackgroundWorker worker = new BackgroundWorker();
|
||||||
|
worker.WorkerSupportsCancellation = true;
|
||||||
|
worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
|
||||||
|
worker.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WorkerKill(Process exe, ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname)
|
||||||
|
{
|
||||||
|
worker.DoWork -= (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
|
||||||
|
worker.CancelAsync();
|
||||||
|
worker.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WorkerDoWork(Process exe, ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname)
|
||||||
|
{
|
||||||
|
DateTime StartTimeAfterMinute = exe.StartTime.AddMinutes(1);
|
||||||
|
|
||||||
|
if (exe.IsRunning())
|
||||||
|
{
|
||||||
|
while (exe.IsRunning())
|
||||||
|
{
|
||||||
|
if (exe.MainWindowHandle == null && DateTime.Now > StartTimeAfterMinute)
|
||||||
|
{
|
||||||
|
exe.Kill();
|
||||||
|
WorkerKill(exe, type, time, worker, clientname, mapname);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case ScriptType.Client:
|
||||||
|
SetWindowText(exe.MainWindowHandle, "Novetus "
|
||||||
|
+ GlobalVars.ProgramInformation.Version + " - "
|
||||||
|
+ clientname + " "
|
||||||
|
+ ScriptFuncs.Generator.GetNameForType(type)
|
||||||
|
+ " [" + GlobalVars.CurrentServer.ToString() + "]"
|
||||||
|
+ RandomStringTitle());
|
||||||
|
break;
|
||||||
|
case ScriptType.Server:
|
||||||
|
case ScriptType.Solo:
|
||||||
|
SetWindowText(exe.MainWindowHandle, "Novetus "
|
||||||
|
+ GlobalVars.ProgramInformation.Version + " - "
|
||||||
|
+ clientname + " "
|
||||||
|
+ ScriptFuncs.Generator.GetNameForType(type)
|
||||||
|
+ (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]")
|
||||||
|
+ RandomStringTitle());
|
||||||
|
break;
|
||||||
|
case ScriptType.Studio:
|
||||||
|
SetWindowText(exe.MainWindowHandle, "Novetus Studio "
|
||||||
|
+ GlobalVars.ProgramInformation.Version + " - "
|
||||||
|
+ clientname
|
||||||
|
+ (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]")
|
||||||
|
+ RandomStringTitle());
|
||||||
|
break;
|
||||||
|
case ScriptType.EasterEgg:
|
||||||
|
default:
|
||||||
|
SetWindowText(exe.MainWindowHandle, ScriptFuncs.Generator.GetNameForType(type)
|
||||||
|
+ RandomStringTitle());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Thread.Sleep(time);
|
||||||
|
RenameWindow(exe, type, clientname, mapname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetExternalIPAddress()
|
||||||
|
{
|
||||||
|
string ipAddress;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
|
||||||
|
}
|
||||||
#if URI || LAUNCHER || BASICLAUNCHER
|
#if URI || LAUNCHER || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.LogExceptions(ex);
|
Util.LogExceptions(ex);
|
||||||
#else
|
#else
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
ipAddress = "localhost";
|
ipAddress = "localhost";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ipAddress;
|
return ipAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
//modified from https://stackoverflow.com/questions/14687658/random-name-generator-in-c-sharp
|
//modified from https://stackoverflow.com/questions/14687658/random-name-generator-in-c-sharp
|
||||||
public static string GenerateName(int len)
|
public static string GenerateName(int len)
|
||||||
{
|
|
||||||
CryptoRandom r = new CryptoRandom();
|
|
||||||
string[] consonants = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "l", "n", "p", "q", "r", "s", "sh", "zh", "t", "v", "w", "x" };
|
|
||||||
string[] vowels = { "a", "e", "i", "o", "u", "ae", "y" };
|
|
||||||
string Name = "";
|
|
||||||
Name += consonants[r.Next(consonants.Length)].ToUpper();
|
|
||||||
Name += vowels[r.Next(vowels.Length)];
|
|
||||||
int b = 2; //b tells how many times a new letter has been added. It's 2 right now because the first two letters are already in the name.
|
|
||||||
while (b < len)
|
|
||||||
{
|
{
|
||||||
Name += consonants[r.Next(consonants.Length)];
|
CryptoRandom r = new CryptoRandom();
|
||||||
b++;
|
string[] consonants = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "l", "n", "p", "q", "r", "s", "sh", "zh", "t", "v", "w", "x" };
|
||||||
|
string[] vowels = { "a", "e", "i", "o", "u", "ae", "y" };
|
||||||
|
string Name = "";
|
||||||
|
Name += consonants[r.Next(consonants.Length)].ToUpper();
|
||||||
Name += vowels[r.Next(vowels.Length)];
|
Name += vowels[r.Next(vowels.Length)];
|
||||||
b++;
|
int b = 2; //b tells how many times a new letter has been added. It's 2 right now because the first two letters are already in the name.
|
||||||
|
while (b < len)
|
||||||
|
{
|
||||||
|
Name += consonants[r.Next(consonants.Length)];
|
||||||
|
b++;
|
||||||
|
Name += vowels[r.Next(vowels.Length)];
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Name;
|
//https://www.c-sharpcorner.com/article/caesar-cipher-in-c-sharp/
|
||||||
}
|
public static char cipher(char ch, int key)
|
||||||
|
|
||||||
//https://www.c-sharpcorner.com/article/caesar-cipher-in-c-sharp/
|
|
||||||
public static char cipher(char ch, int key)
|
|
||||||
{
|
|
||||||
if (!char.IsLetter(ch))
|
|
||||||
{
|
{
|
||||||
return ch;
|
if (!char.IsLetter(ch))
|
||||||
|
{
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
char d = char.IsUpper(ch) ? 'A' : 'a';
|
||||||
|
return (char)((((ch + key) - d) % 26) + d);
|
||||||
}
|
}
|
||||||
|
|
||||||
char d = char.IsUpper(ch) ? 'A' : 'a';
|
public static string Encipher(string input, int key)
|
||||||
return (char)((((ch + key) - d) % 26) + d);
|
{
|
||||||
}
|
string output = string.Empty;
|
||||||
|
|
||||||
public static string Encipher(string input, int key)
|
foreach (char ch in input)
|
||||||
{
|
output += cipher(ch, key);
|
||||||
string output = string.Empty;
|
|
||||||
|
return output;
|
||||||
foreach (char ch in input)
|
}
|
||||||
output += cipher(ch, key);
|
|
||||||
|
public static string Decipher(string input, int key)
|
||||||
return output;
|
{
|
||||||
}
|
return Encipher(input, 26 - key);
|
||||||
|
}
|
||||||
public static string Decipher(string input, int key)
|
|
||||||
{
|
|
||||||
return Encipher(input, 26 - key);
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using Ionic.Zip;
|
using Ionic.Zip;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Windows.Forms;
|
using Novetus.Core;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace NovetusLauncher
|
namespace NovetusLauncher
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
*
|
*
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||||
*/
|
*/
|
||||||
|
using Novetus.Core;
|
||||||
|
|
||||||
namespace NovetusLauncher
|
namespace NovetusLauncher
|
||||||
{
|
{
|
||||||
partial class LauncherFormCompact
|
partial class LauncherFormCompact
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using Mono.Nat;
|
using Mono.Nat;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
*
|
*
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||||
*/
|
*/
|
||||||
|
using Novetus.Core;
|
||||||
|
|
||||||
namespace NovetusLauncher
|
namespace NovetusLauncher
|
||||||
{
|
{
|
||||||
partial class LauncherFormExtended
|
partial class LauncherFormExtended
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Reflection;
|
||||||
using Mono.Nat;
|
using Mono.Nat;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Novetus.Core;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace NovetusLauncher
|
namespace NovetusLauncher
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using Mono.Nat;
|
using Mono.Nat;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
|
|
||||||
namespace NovetusLauncher
|
namespace NovetusLauncher
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Novetus.Core;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ClientScriptDocumentation
|
#region ClientScriptDocumentation
|
||||||
public partial class ClientScriptDocumentation : Form
|
public partial class ClientScriptDocumentation : Form
|
||||||
{
|
{
|
||||||
#region Constructor
|
#region Constructor
|
||||||
public ClientScriptDocumentation()
|
public ClientScriptDocumentation()
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Novetus.Core;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Client SDK
|
#region Client SDK
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Novetus.Core;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace NovetusURI
|
namespace NovetusURI
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using Novetus.Core;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace NovetusURI
|
namespace NovetusURI
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Novetus.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue