Update master server, fix installer
This commit is contained in:
@ -55,7 +55,7 @@ namespace RageCoop.Client.Installer
|
|||||||
var shvPath = Path.Combine(root, "ScriptHookV.dll");
|
var shvPath = Path.Combine(root, "ScriptHookV.dll");
|
||||||
var shvdnPath = Path.Combine(root, "ScriptHookVDotNetCore.dll");
|
var shvdnPath = Path.Combine(root, "ScriptHookVDotNetCore.dll");
|
||||||
var scriptsPath = Path.Combine(root, "Scripts");
|
var scriptsPath = Path.Combine(root, "Scripts");
|
||||||
var installPath = Path.Combine(root, "RageCoop");
|
var installPath = Path.Combine(root, "CoreScripts");
|
||||||
var legacyPath = Path.Combine(scriptsPath, "RageCoop");
|
var legacyPath = Path.Combine(scriptsPath, "RageCoop");
|
||||||
if (Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName.StartsWith(installPath))
|
if (Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName.StartsWith(installPath))
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
@ -70,37 +70,35 @@ namespace RageCoop.Client.Installer
|
|||||||
|
|
||||||
if (!File.Exists(shvdnPath))
|
if (!File.Exists(shvdnPath))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please install ScriptHookVDotNet first!");
|
MessageBox.Show("Please install ScriptHookVDotNetCore first!");
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var shvdnVer = GetVer(shvdnPath);
|
var shvdnVer = GetVer(shvdnPath);
|
||||||
if (shvdnVer < new Version(3, 5, 1))
|
if (shvdnVer < new Version(1, 2, 1))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please update ScriptHookVDotNet to latest version!" +
|
MessageBox.Show("Please update ScriptHookVDotNetCore to latest version!" +
|
||||||
$"\nCurrent version is {shvdnVer}, 3.5.1 or higher is required");
|
$"\nCurrent version is {shvdnVer}, 1.2.1 or higher is required");
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateStatus("Removing old versions");
|
UpdateStatus("Removing old versions");
|
||||||
|
|
||||||
foreach (var f in Directory.GetFiles(scriptsPath, "RageCoop.*", SearchOption.AllDirectories))
|
if (Directory.Exists(scriptsPath))
|
||||||
File.Delete(f);
|
foreach (var f in Directory.GetFiles(scriptsPath, "RageCoop.*", SearchOption.AllDirectories))
|
||||||
|
File.Delete(f);
|
||||||
|
|
||||||
// <= 1.5 installation check
|
// <= 1.5 installation check
|
||||||
if (Directory.Exists(legacyPath)) Directory.Delete(legacyPath, true);
|
if (Directory.Exists(legacyPath)) Directory.Delete(legacyPath, true);
|
||||||
|
|
||||||
foreach (var f in Directory.GetFiles(installPath, "*.dll", SearchOption.AllDirectories)) File.Delete(f);
|
foreach (var f in Directory.GetFiles(installPath, "*.dll", SearchOption.AllDirectories)) File.Delete(f);
|
||||||
|
|
||||||
if (File.Exists("Scripts/RageCoop.Core.dll") && File.Exists("Scripts/RageCoop.Client.dll") &&
|
if (File.Exists("Scripts/RageCoop.Core.dll") && File.Exists("Scripts/RageCoop.Client.dll"))
|
||||||
File.Exists("Loader/RageCoop.Client.Loader.dll"))
|
|
||||||
{
|
{
|
||||||
UpdateStatus("Installing...");
|
UpdateStatus("Installing...");
|
||||||
CoreUtils.CopyFilesRecursively(new DirectoryInfo(Directory.GetCurrentDirectory()),
|
CoreUtils.CopyFilesRecursively(new DirectoryInfo(Directory.GetCurrentDirectory()),
|
||||||
new DirectoryInfo(installPath));
|
new DirectoryInfo(installPath));
|
||||||
File.Copy("Loader/RageCoop.Client.Loader.dll", Path.Combine(scriptsPath, "RageCoop.Client.Loader.dll"),
|
|
||||||
true);
|
|
||||||
Finish();
|
Finish();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -114,7 +112,7 @@ namespace RageCoop.Client.Installer
|
|||||||
checkKeys:
|
checkKeys:
|
||||||
UpdateStatus("Checking conflicts");
|
UpdateStatus("Checking conflicts");
|
||||||
var menyooConfig = Path.Combine(root, @"menyooStuff\menyooConfig.ini");
|
var menyooConfig = Path.Combine(root, @"menyooStuff\menyooConfig.ini");
|
||||||
var settingsPath = Path.Combine(root, SettingsPath);
|
var settingsPath = Path.Combine(installPath, "Data", "Setting.json");
|
||||||
ClientSettings settings = null;
|
ClientSettings settings = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace RageCoop.Client
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
|
public string MasterServer { get; set; } = "https://test.ragecoop.com/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
@ -56,7 +56,7 @@ namespace RageCoop.Client
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disable world NPC traffic, mission entities won't be affected
|
/// Disable world NPC traffic, mission entities won't be affected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DisableTraffic { get; set; } = true;
|
public bool DisableTraffic { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bring up pause menu but don't freeze time when FrontEndPauseAlternate(Esc) is pressed.
|
/// Bring up pause menu but don't freeze time when FrontEndPauseAlternate(Esc) is pressed.
|
||||||
|
@ -354,7 +354,7 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else
|
else if (veh.GetPedOnSeat(seat) != null)
|
||||||
{
|
{
|
||||||
var isDead = veh.GetPedOnSeat(seat).IsDead;
|
var isDead = veh.GetPedOnSeat(seat).IsDead;
|
||||||
if (isDead)
|
if (isDead)
|
||||||
|
@ -31,7 +31,10 @@ namespace RageCoop.Core
|
|||||||
{
|
{
|
||||||
internal static class CoreUtils
|
internal static class CoreUtils
|
||||||
{
|
{
|
||||||
private static readonly Random random = new();
|
internal static Random SafeRandom => _randInstance.Value;
|
||||||
|
private static int _randSeed = Environment.TickCount;
|
||||||
|
private static readonly ThreadLocal<Random> _randInstance
|
||||||
|
= new(() => new Random(Interlocked.Increment(ref _randSeed)));
|
||||||
|
|
||||||
private static readonly HashSet<string> ToIgnore = new()
|
private static readonly HashSet<string> ToIgnore = new()
|
||||||
{
|
{
|
||||||
@ -72,7 +75,7 @@ namespace RageCoop.Core
|
|||||||
|
|
||||||
public static int RandInt(int start, int end)
|
public static int RandInt(int start, int end)
|
||||||
{
|
{
|
||||||
return random.Next(start, end);
|
return SafeRandom.Next(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetTempDirectory(string dir = null)
|
public static string GetTempDirectory(string dir = null)
|
||||||
@ -91,7 +94,7 @@ namespace RageCoop.Core
|
|||||||
{
|
{
|
||||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
return new string(Enumerable.Repeat(chars, length)
|
return new string(Enumerable.Repeat(chars, length)
|
||||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
.Select(s => s[SafeRandom.Next(s.Length)]).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Version GetLatestVersion(string branch = "dev-nightly")
|
public static Version GetLatestVersion(string branch = "dev-nightly")
|
||||||
|
@ -28,7 +28,7 @@ public class Settings
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The website address to be shown on master server
|
/// The website address to be shown on master server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Website { get; set; } = "https://ragecoop.online/";
|
public string Website { get; set; } = "https://ragecoop.com/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The description to be shown on master server
|
/// The description to be shown on master server
|
||||||
@ -58,7 +58,7 @@ public class Settings
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Master server address, mostly doesn't need to be changed.
|
/// Master server address, mostly doesn't need to be changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
|
public string MasterServer { get; set; } = "https://test.ragecoop.com/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// See <see cref="Core.Logger.LogLevel" />.
|
/// See <see cref="Core.Logger.LogLevel" />.
|
||||||
|
Reference in New Issue
Block a user