Game.Modding.Toolchain.Dependencies.RiderDependency
Assembly: Game
Namespace: Game.Modding.Toolchain.Dependencies
Type: class
Base: BaseIDEDependency
Summary:
Represents the Rider IDE dependency used by the modding toolchain. This class reports information about a locally installed JetBrains Rider installation (version and metadata) but does not support installing or uninstalling Rider itself. It queries installed Rider instances via RiderPathLocator and returns the most recent found product version or an empty string if none are found. The class enforces a minimum supported Rider version of "2021.3.3".
Fields
- None
This class declares no private or public fields of its own; it relies on functionality inherited from BaseIDEDependency and on RiderPathLocator for discovery.
Properties
-
public override string name { get; }
Returns the friendly name of the IDE dependency. For this class the value is "Rider". -
public override string icon { get; }
Returns a path to an icon representing the IDE. Value: "Media/Toolchain/Rider.svg". -
public override bool canBeInstalled { get; }
Indicates whether the toolchain can install Rider automatically. Value: false — Rider must be installed by the user/outside the toolchain. -
public override bool canBeUninstalled { get; }
Indicates whether the toolchain can uninstall Rider. Value: false — uninstallation is not handled by the toolchain. -
public override string minVersion { get; }
The minimum required Rider version for compatibility. Value: "2021.3.3".
Constructors
public RiderDependency()
No explicit constructor is defined in the source file; the default parameterless constructor is used. The class requires no construction parameters and initializes no instance state of its own.
Methods
protected override Task<string> GetIDEVersion(CancellationToken token)
Finds installed Rider instances using RiderPathLocator.GetAllRiderPaths(), orders them by BuildNumber descending, and returns the ProductInfo.version string of the first (newest) entry as a completed Task. If no Rider installations are found, it returns an already-completed Task containing an empty string. Note: the provided CancellationToken parameter is not used in the current implementation.
Implementation summary: - Calls RiderPathLocator.GetAllRiderPaths(). - Sorts the results by BuildNumber descending. - If any entries exist, returns the version of the first entry. - Otherwise returns string.Empty. - Uses Task.FromResult for synchronous completion.
Usage Example
// RiderDependency.GetIDEVersion is protected, so demonstrate calling it
// by subclassing (for testing or internal tooling purposes).
using System;
using System.Threading;
using System.Threading.Tasks;
using Game.Modding.Toolchain.Dependencies;
public class TestRiderDependency : RiderDependency
{
public Task<string> GetRiderVersion(CancellationToken token)
{
// Call protected method from derived class
return GetIDEVersion(token);
}
}
public static async Task Demo()
{
var dep = new TestRiderDependency();
Console.WriteLine($"Name: {dep.name}");
Console.WriteLine($"Icon path: {dep.icon}");
Console.WriteLine($"Can be installed by toolchain: {dep.canBeInstalled}");
Console.WriteLine($"Can be uninstalled by toolchain: {dep.canBeUninstalled}");
Console.WriteLine($"Minimum supported Rider version: {dep.minVersion}");
string version = await dep.GetRiderVersion(CancellationToken.None);
if (string.IsNullOrEmpty(version))
{
Console.WriteLine("No Rider installation detected.");
}
else
{
Console.WriteLine($"Detected Rider version: {version}");
}
}
Additional notes: - Because canBeInstalled and canBeUninstalled are false, the toolchain treats Rider as an external dependency and expects the user to manage installation. - The class relies on RiderPathLocator; make sure that component is available and correctly returns RiderInfo entries for discovery to work.