Ignore API assemblies
This commit is contained in:
@ -23,7 +23,6 @@ namespace RageCoop.Client
|
|||||||
if (Client!=null)
|
if (Client!=null)
|
||||||
{
|
{
|
||||||
ProcessMessage(Client.WaitMessage(200));
|
ProcessMessage(Client.WaitMessage(200));
|
||||||
Client.FlushSendQueue();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -46,7 +45,7 @@ namespace RageCoop.Client
|
|||||||
// 623c92c287cc392406e7aaaac1c0f3b0 = RAGECOOP
|
// 623c92c287cc392406e7aaaac1c0f3b0 = RAGECOOP
|
||||||
NetPeerConfiguration config = new NetPeerConfiguration("623c92c287cc392406e7aaaac1c0f3b0")
|
NetPeerConfiguration config = new NetPeerConfiguration("623c92c287cc392406e7aaaac1c0f3b0")
|
||||||
{
|
{
|
||||||
AutoFlushSendQueue = true
|
AutoFlushSendQueue = false
|
||||||
};
|
};
|
||||||
|
|
||||||
config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated);
|
config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated);
|
||||||
|
@ -142,6 +142,8 @@ namespace RageCoop.Client.Scripting
|
|||||||
rFile.GetStream=() => { return file.GetInputStream(entry); };
|
rFile.GetStream=() => { return file.GetInputStream(entry); };
|
||||||
if (entry.Name.EndsWith(".dll") && !entry.Name.Contains("/"))
|
if (entry.Name.EndsWith(".dll") && !entry.Name.Contains("/"))
|
||||||
{
|
{
|
||||||
|
// Don't load API assembly
|
||||||
|
if (Path.GetFileName(entry.Name).CanBeIgnored()) { continue; }
|
||||||
var tmp = Path.GetTempFileName();
|
var tmp = Path.GetTempFileName();
|
||||||
var f = File.OpenWrite(tmp);
|
var f = File.OpenWrite(tmp);
|
||||||
rFile.GetStream().CopyTo(f);
|
rFile.GetStream().CopyTo(f);
|
||||||
|
@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
{
|
{
|
||||||
@ -560,6 +561,7 @@ namespace RageCoop.Client
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThreadPool.QueueUserWorkItem((o) => { Networking.Client.FlushSendQueue(); });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,20 @@ using System.Runtime.CompilerServices;
|
|||||||
[assembly: InternalsVisibleTo("RageCoop.Client")]
|
[assembly: InternalsVisibleTo("RageCoop.Client")]
|
||||||
namespace RageCoop.Core
|
namespace RageCoop.Core
|
||||||
{
|
{
|
||||||
internal class CoreUtils
|
internal static class CoreUtils
|
||||||
{
|
{
|
||||||
|
private static readonly HashSet<string> ToIgnore = new HashSet<string>()
|
||||||
|
{
|
||||||
|
"RageCoop.Client.dll",
|
||||||
|
"RageCoop.Core.dll",
|
||||||
|
"RageCoop.Server.dll",
|
||||||
|
"ScriptHookVDotNet3.dll",
|
||||||
|
"ScriptHookVDotNet.dll"
|
||||||
|
};
|
||||||
|
public static bool CanBeIgnored(this string name)
|
||||||
|
{
|
||||||
|
return ToIgnore.Contains(name);
|
||||||
|
}
|
||||||
public static (byte, byte[]) GetBytesFromObject(object obj)
|
public static (byte, byte[]) GetBytesFromObject(object obj)
|
||||||
{
|
{
|
||||||
switch (obj)
|
switch (obj)
|
||||||
|
@ -15,14 +15,7 @@ namespace RageCoop.Server.Scripting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ServerResource : PluginLoader
|
public class ServerResource : PluginLoader
|
||||||
{
|
{
|
||||||
private static readonly HashSet<string> ToIgnore = new()
|
|
||||||
{
|
|
||||||
"RageCoop.Client.dll",
|
|
||||||
"RageCoop.Core.dll",
|
|
||||||
"RageCoop.Server.dll",
|
|
||||||
"ScriptHookVDotNet3.dll",
|
|
||||||
"ScriptHookVDotNet.dll"
|
|
||||||
};
|
|
||||||
internal ServerResource(PluginConfig config) : base(config) { }
|
internal ServerResource(PluginConfig config) : base(config) { }
|
||||||
internal static ServerResource LoadFrom(string resDir, string dataFolder, Logger logger = null, bool isTemp = false)
|
internal static ServerResource LoadFrom(string resDir, string dataFolder, Logger logger = null, bool isTemp = false)
|
||||||
{
|
{
|
||||||
@ -57,7 +50,7 @@ namespace RageCoop.Server.Scripting
|
|||||||
var assemblies=new Dictionary<ResourceFile,Assembly>();
|
var assemblies=new Dictionary<ResourceFile,Assembly>();
|
||||||
foreach (var file in Directory.GetFiles(resDir, "*", SearchOption.AllDirectories))
|
foreach (var file in Directory.GetFiles(resDir, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
if (ToIgnore.Contains(Path.GetFileName(file))) { try { File.Delete(file); } catch { } continue; }
|
if (Path.GetFileName(file).CanBeIgnored()) { try { File.Delete(file); } catch { } continue; }
|
||||||
var relativeName = file.Substring(resDir.Length+1).Replace('\\', '/');
|
var relativeName = file.Substring(resDir.Length+1).Replace('\\', '/');
|
||||||
var rfile = new ResourceFile()
|
var rfile = new ResourceFile()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user