Change package format to iso9660
This commit is contained in:
@ -1,14 +1,11 @@
|
|||||||
using System;
|
using SHVDN;
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Console = GTA.Console;
|
|
||||||
using SHVDN;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Console = GTA.Console;
|
||||||
|
|
||||||
namespace RageCoop.Client.Loader
|
namespace RageCoop.Client.Loader
|
||||||
{
|
{
|
||||||
@ -17,7 +14,8 @@ namespace RageCoop.Client.Loader
|
|||||||
{
|
{
|
||||||
#region PRIMARY-LOADING-LOGIC
|
#region PRIMARY-LOADING-LOGIC
|
||||||
public static ConcurrentDictionary<string, LoaderContext> LoadedDomains => new ConcurrentDictionary<string, LoaderContext>(_loadedDomains);
|
public static ConcurrentDictionary<string, LoaderContext> LoadedDomains => new ConcurrentDictionary<string, LoaderContext>(_loadedDomains);
|
||||||
static readonly ConcurrentDictionary<string, LoaderContext> _loadedDomains = new ConcurrentDictionary<string, LoaderContext>();
|
|
||||||
|
private static readonly ConcurrentDictionary<string, LoaderContext> _loadedDomains = new ConcurrentDictionary<string, LoaderContext>();
|
||||||
|
|
||||||
public bool UnloadRequested;
|
public bool UnloadRequested;
|
||||||
public string BaseDirectory => AppDomain.CurrentDomain.BaseDirectory;
|
public string BaseDirectory => AppDomain.CurrentDomain.BaseDirectory;
|
||||||
@ -129,7 +127,8 @@ namespace RageCoop.Client.Loader
|
|||||||
domain.Dispose();
|
domain.Dispose();
|
||||||
ScriptDomain.Unload(domain.CurrentDomain);
|
ScriptDomain.Unload(domain.CurrentDomain);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
|
{
|
||||||
ex = e;
|
ex = e;
|
||||||
GTA.UI.Notification.Show(ex.ToString());
|
GTA.UI.Notification.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
using System;
|
using GTA;
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
|
||||||
using GTA;
|
|
||||||
using SHVDN;
|
|
||||||
using Console = GTA.Console;
|
using Console = GTA.Console;
|
||||||
namespace RageCoop.Client.Loader
|
namespace RageCoop.Client.Loader
|
||||||
{
|
{
|
||||||
public class Main : GTA.Script
|
public class Main : GTA.Script
|
||||||
{
|
{
|
||||||
static readonly string GameDir = Directory.GetParent(typeof(SHVDN.ScriptDomain).Assembly.Location).FullName;
|
private static readonly string GameDir = Directory.GetParent(typeof(SHVDN.ScriptDomain).Assembly.Location).FullName;
|
||||||
|
private static readonly string ScriptsLocation = Path.Combine(GameDir, "RageCoop", "Scripts");
|
||||||
static readonly string ScriptsLocation = Path.Combine(GameDir, "RageCoop", "Scripts");
|
|
||||||
private static readonly ConcurrentQueue<Action> TaskQueue = new ConcurrentQueue<Action>();
|
private static readonly ConcurrentQueue<Action> TaskQueue = new ConcurrentQueue<Action>();
|
||||||
static int MainThreadID;
|
private static int MainThreadID;
|
||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
if (LoaderContext.PrimaryDomain != null) { throw new InvalidOperationException("Improperly placed loader assembly, please re-install to fix this issue"); }
|
if (LoaderContext.PrimaryDomain != null) { throw new InvalidOperationException("Improperly placed loader assembly, please re-install to fix this issue"); }
|
||||||
@ -55,7 +52,7 @@ namespace RageCoop.Client.Loader
|
|||||||
|
|
||||||
private static void DomainTick(object sender, EventArgs e)
|
private static void DomainTick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (MainThreadID == default) { MainThreadID=Thread.CurrentThread.ManagedThreadId;}
|
if (MainThreadID == default) { MainThreadID = Thread.CurrentThread.ManagedThreadId; }
|
||||||
while (TaskQueue.TryDequeue(out var task))
|
while (TaskQueue.TryDequeue(out var task))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using GTA;
|
using GTA;
|
||||||
using GTA.Math;
|
using GTA.Math;
|
||||||
using RageCoop.Client.Scripting;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -5,17 +5,15 @@ using RageCoop.Client.Menus;
|
|||||||
using RageCoop.Client.Scripting;
|
using RageCoop.Client.Scripting;
|
||||||
using RageCoop.Core;
|
using RageCoop.Core;
|
||||||
using SHVDN;
|
using SHVDN;
|
||||||
using Script = GTA.Script;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Console = GTA.Console;
|
using Console = GTA.Console;
|
||||||
|
using Script = GTA.Script;
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
{
|
{
|
||||||
@ -33,7 +31,6 @@ namespace RageCoop.Client
|
|||||||
internal static RelationshipGroup SyncedPedsGroup;
|
internal static RelationshipGroup SyncedPedsGroup;
|
||||||
|
|
||||||
internal static new Settings Settings = null;
|
internal static new Settings Settings = null;
|
||||||
internal static BaseScript BaseScript = new BaseScript();
|
|
||||||
|
|
||||||
#if !NON_INTERACTIVE
|
#if !NON_INTERACTIVE
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using GTA;
|
using GTA;
|
||||||
using LemonUI.Menus;
|
using LemonUI.Menus;
|
||||||
using RageCoop.Client.Scripting;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
{
|
{
|
||||||
@ -19,7 +17,7 @@ namespace RageCoop.Client
|
|||||||
UseMouse = false,
|
UseMouse = false,
|
||||||
Alignment = Main.Settings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
Alignment = Main.Settings.FlipMenu ? GTA.UI.Alignment.Right : GTA.UI.Alignment.Left
|
||||||
};
|
};
|
||||||
public static NativeItem ReloadItem = new NativeItem("Reload","Reload RAGECOOP and associated scripts");
|
public static NativeItem ReloadItem = new NativeItem("Reload", "Reload RAGECOOP and associated scripts");
|
||||||
public static NativeItem SimulatedLatencyItem = new NativeItem("Simulated network latency", "Simulated network latency in ms (one way)", "0");
|
public static NativeItem SimulatedLatencyItem = new NativeItem("Simulated network latency", "Simulated network latency in ms (one way)", "0");
|
||||||
public static NativeCheckboxItem ShowOwnerItem = new NativeCheckboxItem("Show entity owner", "Show the owner name of the entity you're aiming at", false);
|
public static NativeCheckboxItem ShowOwnerItem = new NativeCheckboxItem("Show entity owner", "Show the owner name of the entity you're aiming at", false);
|
||||||
private static readonly NativeCheckboxItem ShowNetworkInfoItem = new NativeCheckboxItem("Show Network Info", Networking.ShowNetworkInfo);
|
private static readonly NativeCheckboxItem ShowNetworkInfoItem = new NativeCheckboxItem("Show Network Info", Networking.ShowNetworkInfo);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
using GTA.Math;
|
using GTA.Math;
|
||||||
using GTA.Native;
|
using GTA.Native;
|
||||||
using Lidgren.Network;
|
using Lidgren.Network;
|
||||||
using RageCoop.Core;
|
|
||||||
using RageCoop.Client.Scripting;
|
using RageCoop.Client.Scripting;
|
||||||
|
using RageCoop.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ using System.Resources;
|
|||||||
|
|
||||||
|
|
||||||
// Version informationr(
|
// Version informationr(
|
||||||
[assembly: AssemblyVersion("1.5.4.334")]
|
[assembly: AssemblyVersion("1.5.4.341")]
|
||||||
[assembly: AssemblyFileVersion("1.5.4.334")]
|
[assembly: AssemblyFileVersion("1.5.4.341")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ using RageCoop.Core.Scripting;
|
|||||||
using SHVDN;
|
using SHVDN;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
@ -9,11 +9,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace RageCoop.Client.Scripting
|
namespace RageCoop.Client.Scripting
|
||||||
{
|
{
|
||||||
[ScriptAttributes(Author = "RageCoop", NoDefaultInstance = true, SupportURL = "https://github.com/RAGECOOP/RAGECOOP-V")]
|
internal static class BaseScript
|
||||||
internal class BaseScript : ClientScript
|
|
||||||
{
|
{
|
||||||
private bool _isHost = false;
|
private static bool _isHost = false;
|
||||||
public override void OnStart()
|
public static void OnStart()
|
||||||
{
|
{
|
||||||
API.Events.OnPedDeleted += (s, p) => { API.SendCustomEvent(CustomEvents.OnPedDeleted, p.ID); };
|
API.Events.OnPedDeleted += (s, p) => { API.SendCustomEvent(CustomEvents.OnPedDeleted, p.ID); };
|
||||||
API.Events.OnVehicleDeleted += (s, p) => { API.SendCustomEvent(CustomEvents.OnVehicleDeleted, p.ID); };
|
API.Events.OnVehicleDeleted += (s, p) => { API.SendCustomEvent(CustomEvents.OnVehicleDeleted, p.ID); };
|
||||||
@ -58,19 +57,19 @@ namespace RageCoop.Client.Scripting
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WeatherTimeSync(CustomEventReceivedArgs e)
|
private static void WeatherTimeSync(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
World.CurrentTimeOfDay = new TimeSpan((int)e.Args[0], (int)e.Args[1], (int)e.Args[2]);
|
World.CurrentTimeOfDay = new TimeSpan((int)e.Args[0], (int)e.Args[1], (int)e.Args[2]);
|
||||||
Function.Call(Hash._SET_WEATHER_TYPE_TRANSITION, (int)e.Args[3], (int)e.Args[4], (float)e.Args[5]);
|
Function.Call(Hash._SET_WEATHER_TYPE_TRANSITION, (int)e.Args[3], (int)e.Args[4], (float)e.Args[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDisplayNameTag(CustomEventReceivedArgs e)
|
private static void SetDisplayNameTag(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
var p = PlayerList.GetPlayer((int)e.Args[0]);
|
var p = PlayerList.GetPlayer((int)e.Args[0]);
|
||||||
if (p != null) { p.DisplayNameTag = (bool)e.Args[1]; }
|
if (p != null) { p.DisplayNameTag = (bool)e.Args[1]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePedBlip(CustomEventReceivedArgs e)
|
private static void UpdatePedBlip(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
var p = Entity.FromHandle((int)e.Args[0]);
|
var p = Entity.FromHandle((int)e.Args[0]);
|
||||||
if (p == null) { return; }
|
if (p == null) { return; }
|
||||||
@ -90,7 +89,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateVehicle(CustomEventReceivedArgs e)
|
private static void CreateVehicle(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
var vehicleModel = (Model)e.Args[1];
|
var vehicleModel = (Model)e.Args[1];
|
||||||
vehicleModel.Request(1000);
|
vehicleModel.Request(1000);
|
||||||
@ -109,7 +108,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
EntityPool.Add(v);
|
EntityPool.Add(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteServerBlip(CustomEventReceivedArgs e)
|
private static void DeleteServerBlip(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
if (EntityPool.ServerBlips.TryGetValue((int)e.Args[0], out var blip))
|
if (EntityPool.ServerBlips.TryGetValue((int)e.Args[0], out var blip))
|
||||||
{
|
{
|
||||||
@ -118,7 +117,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ServerBlipSync(CustomEventReceivedArgs obj)
|
private static void ServerBlipSync(CustomEventReceivedArgs obj)
|
||||||
{
|
{
|
||||||
int id = (int)obj.Args[0];
|
int id = (int)obj.Args[0];
|
||||||
var sprite = (BlipSprite)(ushort)obj.Args[1];
|
var sprite = (BlipSprite)(ushort)obj.Args[1];
|
||||||
@ -140,15 +139,12 @@ namespace RageCoop.Client.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DeleteEntity(CustomEventReceivedArgs e)
|
private static void DeleteEntity(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
Entity.FromHandle((int)e.Args[0])?.Delete();
|
Entity.FromHandle((int)e.Args[0])?.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnStop()
|
private static void SetNameTag(CustomEventReceivedArgs e)
|
||||||
{
|
|
||||||
}
|
|
||||||
private void SetNameTag(CustomEventReceivedArgs e)
|
|
||||||
{
|
{
|
||||||
var p = PlayerList.GetPlayer((int)e.Args[0]);
|
var p = PlayerList.GetPlayer((int)e.Args[0]);
|
||||||
if (p != null)
|
if (p != null)
|
||||||
@ -156,11 +152,11 @@ namespace RageCoop.Client.Scripting
|
|||||||
p.DisplayNameTag = (bool)e.Args[1];
|
p.DisplayNameTag = (bool)e.Args[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void SetAutoRespawn(CustomEventReceivedArgs args)
|
private static void SetAutoRespawn(CustomEventReceivedArgs args)
|
||||||
{
|
{
|
||||||
API.Config.EnableAutoRespawn = (bool)args.Args[0];
|
API.Config.EnableAutoRespawn = (bool)args.Args[0];
|
||||||
}
|
}
|
||||||
private void DeleteServerProp(CustomEventReceivedArgs e)
|
private static void DeleteServerProp(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
var id = (int)e.Args[0];
|
var id = (int)e.Args[0];
|
||||||
if (EntityPool.ServerProps.TryGetValue(id, out var prop))
|
if (EntityPool.ServerProps.TryGetValue(id, out var prop))
|
||||||
@ -170,7 +166,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ServerObjectSync(CustomEventReceivedArgs e)
|
private static void ServerObjectSync(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
SyncedProp prop;
|
SyncedProp prop;
|
||||||
var id = (int)e.Args[0];
|
var id = (int)e.Args[0];
|
||||||
@ -188,7 +184,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
prop.Model.Request(1000);
|
prop.Model.Request(1000);
|
||||||
prop.Update();
|
prop.Update();
|
||||||
}
|
}
|
||||||
private void NativeCall(CustomEventReceivedArgs e)
|
private static void NativeCall(CustomEventReceivedArgs e)
|
||||||
{
|
{
|
||||||
List<InputArgument> arguments = new List<InputArgument>();
|
List<InputArgument> arguments = new List<InputArgument>();
|
||||||
int i;
|
int i;
|
||||||
@ -272,7 +268,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private InputArgument GetInputArgument(object obj)
|
private static InputArgument GetInputArgument(object obj)
|
||||||
{
|
{
|
||||||
// Implicit conversion
|
// Implicit conversion
|
||||||
switch (obj)
|
switch (obj)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using RageCoop.Core.Scripting;
|
using RageCoop.Core.Scripting;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace RageCoop.Client.Scripting
|
namespace RageCoop.Client.Scripting
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace RageCoop.Client.Scripting
|
namespace RageCoop.Client.Scripting
|
||||||
{
|
{
|
||||||
@ -135,7 +134,7 @@ namespace RageCoop.Client.Scripting
|
|||||||
LoadedResources.TryAdd(r.Name, r);
|
LoadedResources.TryAdd(r.Name, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupScripts()
|
private void SetupScripts()
|
||||||
{
|
{
|
||||||
foreach (var s in GetClientScripts())
|
foreach (var s in GetClientScripts())
|
||||||
{
|
{
|
||||||
@ -165,7 +164,8 @@ namespace RageCoop.Client.Scripting
|
|||||||
API.Logger.Debug("Started script: " + s.GetType().FullName);
|
API.Logger.Debug("Started script: " + s.GetType().FullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void StopScripts()
|
|
||||||
|
private void StopScripts()
|
||||||
{
|
{
|
||||||
foreach (var s in GetClientScripts())
|
foreach (var s in GetClientScripts())
|
||||||
{
|
{
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
using GTA;
|
using GTA;
|
||||||
using Console = GTA.Console;
|
|
||||||
using GTA.Math;
|
using GTA.Math;
|
||||||
using GTA.Native;
|
using GTA.Native;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using RageCoop.Core;
|
using RageCoop.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SHVDN;
|
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("RageCoop.Client.Installer")]
|
[assembly: InternalsVisibleTo("RageCoop.Client.Installer")]
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using GTA;
|
using GTA;
|
||||||
using GTA.Native;
|
using GTA.Native;
|
||||||
using RageCoop.Client.Scripting;
|
|
||||||
using RageCoop.Core;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace RageCoop.Core
|
|||||||
public static Version GetLatestVersion(string branch = "dev-nightly")
|
public static Version GetLatestVersion(string branch = "dev-nightly")
|
||||||
{
|
{
|
||||||
var url = $"https://raw.githubusercontent.com/RAGECOOP/RAGECOOP-V/{branch}/RageCoop.Server/Properties/AssemblyInfo.cs";
|
var url = $"https://raw.githubusercontent.com/RAGECOOP/RAGECOOP-V/{branch}/RageCoop.Server/Properties/AssemblyInfo.cs";
|
||||||
var versionLine = HttpHelper.DownloadString(url).Split(new char[] {'\n'}, StringSplitOptions.RemoveEmptyEntries).Where(x => x.Contains("[assembly: AssemblyVersion(")).First();
|
var versionLine = HttpHelper.DownloadString(url).Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(x => x.Contains("[assembly: AssemblyVersion(")).First();
|
||||||
var start = versionLine.IndexOf('\"') + 1;
|
var start = versionLine.IndexOf('\"') + 1;
|
||||||
var end = versionLine.LastIndexOf('\"');
|
var end = versionLine.LastIndexOf('\"');
|
||||||
return Version.Parse(versionLine.Substring(start, end - start));
|
return Version.Parse(versionLine.Substring(start, end - start));
|
||||||
@ -427,7 +427,7 @@ namespace RageCoop.Core
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsScript(this Type type,Type scriptType)
|
public static bool IsScript(this Type type, Type scriptType)
|
||||||
{
|
{
|
||||||
return !type.IsAbstract && type.IsSubclassOf(scriptType);
|
return !type.IsAbstract && type.IsSubclassOf(scriptType);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using GTA.NaturalMotion;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace RageCoop.Core
|
namespace RageCoop.Core
|
||||||
@ -142,7 +140,8 @@ namespace RageCoop.Core
|
|||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string Format(LogLine line)
|
|
||||||
|
private string Format(LogLine line)
|
||||||
{
|
{
|
||||||
return string.Format("[{0}][{2}] [{3}] {1}", line.TimeStamp.ToString(DateTimeFormat), line.Message, Name, line.LogLevel.ToString());
|
return string.Format("[{0}][{2}] [{3}] {1}", line.TimeStamp.ToString(DateTimeFormat), line.Message, Name, line.LogLevel.ToString());
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ using System.Resources;
|
|||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
[assembly: AssemblyVersion("1.5.4.106")]
|
[assembly: AssemblyVersion("1.5.4.118")]
|
||||||
[assembly: AssemblyFileVersion("1.5.4.106")]
|
[assembly: AssemblyFileVersion("1.5.4.118")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="DiscUtils.Iso9660" Version="0.16.13" />
|
||||||
<PackageReference Include="Fody" Version="6.6.3">
|
<PackageReference Include="Fody" Version="6.6.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using ICSharpCode.SharpZipLib.Zip;
|
using DiscUtils.Iso9660;
|
||||||
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
using RageCoop.Core;
|
using RageCoop.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace RageCoop.Server.Scripting
|
namespace RageCoop.Server.Scripting
|
||||||
{
|
{
|
||||||
internal class Resources
|
internal class Resources
|
||||||
@ -16,6 +18,7 @@ namespace RageCoop.Server.Scripting
|
|||||||
Server = server;
|
Server = server;
|
||||||
Logger = server.Logger;
|
Logger = server.Logger;
|
||||||
}
|
}
|
||||||
|
private readonly Dictionary<CDReader, Stream> Packages = new();
|
||||||
private readonly Dictionary<string, Stream> ClientResources = new();
|
private readonly Dictionary<string, Stream> ClientResources = new();
|
||||||
private readonly Dictionary<string, Stream> ResourceStreams = new();
|
private readonly Dictionary<string, Stream> ResourceStreams = new();
|
||||||
public void LoadAll()
|
public void LoadAll()
|
||||||
@ -26,25 +29,37 @@ namespace RageCoop.Server.Scripting
|
|||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
foreach (var pkg in Directory.GetFiles(path, "*.respkg", SearchOption.AllDirectories))
|
foreach (var pkg in Directory.GetFiles(path, "*.respkg", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
Logger?.Debug($"Adding resources from package \"{Path.GetFileNameWithoutExtension(pkg)}\"");
|
try
|
||||||
var pkgZip = new ZipFile(pkg);
|
|
||||||
foreach (ZipEntry e in pkgZip)
|
|
||||||
{
|
{
|
||||||
if (!e.IsFile) { continue; }
|
Logger?.Debug($"Adding resources from package \"{Path.GetFileNameWithoutExtension(pkg)}\"");
|
||||||
if (e.Name.StartsWith("Client") && e.Name.EndsWith(".res"))
|
var pkgStream = File.Open(pkg, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||||
|
var reader = new CDReader(pkgStream, true);
|
||||||
|
foreach (var e in reader.Root.GetDirectories("Client")[0].GetFiles())
|
||||||
{
|
{
|
||||||
var stream = pkgZip.GetInputStream(e).ToMemStream();
|
var name = Path.GetFileNameWithoutExtension(e.Name);
|
||||||
ClientResources.Add(Path.GetFileNameWithoutExtension(e.Name), stream);
|
if (!ClientResources.TryAdd(name, e.Open(FileMode.Open)))
|
||||||
Logger?.Debug("Resource added: " + Path.GetFileNameWithoutExtension(e.Name));
|
{
|
||||||
|
Logger?.Warning($"Resource \"{name}\" already added, ignoring");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Logger?.Debug("Resource added: " + name);
|
||||||
}
|
}
|
||||||
else if (e.Name.StartsWith("Server") && e.Name.EndsWith(".res"))
|
foreach (var e in reader.Root.GetDirectories("Server")[0].GetFiles())
|
||||||
{
|
{
|
||||||
var stream = pkgZip.GetInputStream(e).ToMemStream();
|
var name = Path.GetFileNameWithoutExtension(e.Name);
|
||||||
ResourceStreams.Add(Path.GetFileNameWithoutExtension(e.Name), stream);
|
if (!ResourceStreams.TryAdd(name, e.Open(FileMode.Open)))
|
||||||
Logger?.Debug("Resource added: " + Path.GetFileNameWithoutExtension(e.Name));
|
{
|
||||||
|
Logger?.Warning($"Resource \"{name}\" already loaded, ignoring");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Logger?.Debug("Resource added: " + name);
|
||||||
}
|
}
|
||||||
|
Packages.Add(reader, pkgStream);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger?.Error("Failed to read resources from package: " + pkg, ex);
|
||||||
}
|
}
|
||||||
pkgZip.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,9 +79,16 @@ namespace RageCoop.Server.Scripting
|
|||||||
{
|
{
|
||||||
foreach (var resourceFolder in resourceFolders)
|
foreach (var resourceFolder in resourceFolders)
|
||||||
{
|
{
|
||||||
|
var zipPath = Path.Combine(tmpDir, Path.GetFileName(resourceFolder)) + ".res";
|
||||||
|
var name = Path.GetFileNameWithoutExtension(zipPath);
|
||||||
|
if (ClientResources.ContainsKey(name))
|
||||||
|
{
|
||||||
|
Logger?.Warning($"Client resource \"{name}\" already loaded, ignoring");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Pack client side resource as a zip file
|
// Pack client side resource as a zip file
|
||||||
Logger?.Info("Packing client-side resource: " + resourceFolder);
|
Logger?.Info("Packing client-side resource: " + resourceFolder);
|
||||||
var zipPath = Path.Combine(tmpDir, Path.GetFileName(resourceFolder)) + ".res";
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using ZipFile zip = ZipFile.Create(zipPath);
|
using ZipFile zip = ZipFile.Create(zipPath);
|
||||||
@ -82,7 +104,7 @@ namespace RageCoop.Server.Scripting
|
|||||||
}
|
}
|
||||||
zip.CommitUpdate();
|
zip.CommitUpdate();
|
||||||
zip.Close();
|
zip.Close();
|
||||||
ClientResources.Add(Path.GetFileNameWithoutExtension(zipPath), File.OpenRead(zipPath));
|
ClientResources.Add(name, File.OpenRead(zipPath));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -91,14 +113,6 @@ namespace RageCoop.Server.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var packed = Directory.GetFiles(path, "*.res", SearchOption.TopDirectoryOnly);
|
|
||||||
if (packed.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (var file in packed)
|
|
||||||
{
|
|
||||||
ClientResources.Add(Path.GetFileNameWithoutExtension(file), File.OpenRead(file));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
@ -127,14 +141,6 @@ namespace RageCoop.Server.Scripting
|
|||||||
Logger?.Error(ex);
|
Logger?.Error(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var res in Directory.GetFiles(path, "*.res", SearchOption.TopDirectoryOnly))
|
|
||||||
{
|
|
||||||
if (!ResourceStreams.TryAdd(Path.GetFileNameWithoutExtension(res), File.OpenRead(res)))
|
|
||||||
{
|
|
||||||
Logger?.Warning($"Resource \"{res}\" cannot be loaded, ignoring...");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var res in ResourceStreams)
|
foreach (var res in ResourceStreams)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -206,6 +212,18 @@ namespace RageCoop.Server.Scripting
|
|||||||
}
|
}
|
||||||
LoadedResources.Clear();
|
LoadedResources.Clear();
|
||||||
}
|
}
|
||||||
|
foreach (var s in ClientResources.Values)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
s.Close();
|
||||||
|
s.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger?.Error("[Resources.CloseStream]", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach (var s in ResourceStreams.Values)
|
foreach (var s in ResourceStreams.Values)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -218,17 +236,10 @@ namespace RageCoop.Server.Scripting
|
|||||||
Logger?.Error("[Resources.CloseStream]", ex);
|
Logger?.Error("[Resources.CloseStream]", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var s in ClientResources.Values)
|
foreach (var r in Packages)
|
||||||
{
|
{
|
||||||
try
|
r.Key.Dispose();
|
||||||
{
|
r.Value.Dispose();
|
||||||
s.Close();
|
|
||||||
s.Dispose();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger?.Error("[Resources.CloseStream]", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void SendTo(Client client)
|
public void SendTo(Client client)
|
||||||
|
Reference in New Issue
Block a user