Game.Modding.Toolchain.Dependencies.MainDependency
Assembly: Assembly-CSharp (game runtime)
Namespace: Game.Modding.Toolchain.Dependencies
Type: public class
Base: IToolchainDependency
Summary: Represents the "main" toolchain dependency used by the modding toolchain UI. This class largely acts as a lightweight proxy that exposes the dependency manager's cached state (ToolchainDeployment.dependencyManager.cachedState) to UI and tooling code. Most installation/download operations are not supported by this proxy and will throw NotSupportedException. It is mainly intended for read-only reporting of the overall toolchain state and localized descriptions used in the UI.
Fields
- This class declares no explicit private fields. Additional info: The compiler may generate backing fields for auto-properties and the event, but there are no developer-declared fields in the source.
Properties
-
public string name => GetType().Name;
This returns the runtime type name ("MainDependency"). Used for display or identification. -
public LocalizedString localizedName => LocalizedString.Id("Options.OPTION[ModdingSettings.ToolchainDeployment]");
Localized display name for the dependency as used in the UI. -
public DeploymentAction availableActions => DeploymentAction.None;
Indicates no available actions (read-only / none) for this dependency. -
public IToolchainDependency.State state { get; set; }
Getter: returns ToolchainDeployment.dependencyManager.cachedState.toDependencyState.
Setter: intentionally empty (no-op).
This property exposes the current dependency state from the centralized dependency manager; however, setting the property has no effect. -
string IToolchainDependency.version { get; set; }
Explicit interface implementation for version. Auto-implemented (get/set). Not used in the class itself. -
bool IToolchainDependency.needDownload { get; set; }
Explicit interface implementation indicating whether a download is needed. -
List<IToolchainDependency.DiskSpaceRequirements> IToolchainDependency.spaceRequirements { get; set; }
Explicit interface implementation holding disk-space requirements if applicable. -
IEnumerable<string> IToolchainDependency.envVariables
Explicit interface implementation whose getter yields nothing (empty enumeration). No environment variables are provided by this dependency. -
public string icon => null;
No icon is provided. -
public bool confirmUninstallation { get; }
Read-only property with no initializer — defaults to false. Signifies whether uninstallation requires confirmation (not set here). -
public bool canBeInstalled { get; }
Read-only, defaults to false. Indicates whether this dependency can be installed (not supported). -
public bool canBeUninstalled { get; }
Read-only, defaults to false. Indicates whether this dependency can be uninstalled (not supported). -
public bool canChangeInstallationDirectory => false;
Explicitly indicates that installation directory cannot be changed. -
public string installationDirectory { get; set; } = string.Empty;
Holds the installation directory path; default is an empty string. -
public LocalizedString description => LocalizedString.Id("Options.OPTION_DESCRIPTION[ModdingSettings.ToolchainDeployment]");
Localized description text used by the UI. -
public LocalizedString installDescr { get; }
Read-only localized install description (not provided here). -
public LocalizedString uninstallDescr { get; }
Read-only localized uninstall description (not provided here). -
public LocalizedString uninstallMessage { get; }
Read-only localized uninstall message (not provided here). -
public Type[] dependsOnInstallation { get; }
Read-only array of dependency types this depends on for installation (none specified here). -
public Type[] dependsOnUninstallation { get; }
Read-only array of dependency types this depends on for uninstallation (none specified here). -
public event IToolchainDependency.ProgressDelegate onNotifyProgress;
Event that observers can subscribe to for progress notifications. Note: this class does not raise the event in its own code — it is intended to be raised elsewhere (e.g., the dependency manager).
Constructors
public MainDependency()
Implicit default constructor. The class has no custom construction logic.
Methods
-
public LocalizedString GetLocalizedState(bool includeProgress)
Returns localized state text by delegating to ToolchainDeployment.dependencyManager.cachedState.GetLocalizedState(includeProgress). This is the primary non-throwing method useful to UI code. -
public override int GetHashCode()
Returns ToolchainDeployment.dependencyManager.cachedState.GetHashCode() so hash codes are consistent with the underlying cached state. -
public Task<bool> IsInstalled(CancellationToken token)
Throws NotSupportedException. This dependency does not provide installation check via this API. -
public Task<bool> IsUpToDate(CancellationToken token)
Throws NotSupportedException. -
public Task<bool> NeedDownload(CancellationToken token)
Throws NotSupportedException. -
public Task Download(CancellationToken token)
Throws NotSupportedException. -
public Task Install(CancellationToken token)
Throws NotSupportedException. -
public Task Uninstall(CancellationToken token)
Throws NotSupportedException. -
public Task<List<IToolchainDependency.DiskSpaceRequirements>> GetRequiredDiskSpace(CancellationToken token)
Throws NotSupportedException. -
public Task Refresh(CancellationToken token)
Throws NotSupportedException.
Additional info: All task-based operations are intentionally unsupported here; the dependency manager is expected to handle actual operations. This class is a lightweight view/proxy for the UI.
Usage Example
// Create and inspect the main dependency (usually created/managed by the toolchain system)
var mainDep = new Game.Modding.Toolchain.Dependencies.MainDependency();
// Read identifying info
Console.WriteLine(mainDep.name); // "MainDependency"
Console.WriteLine(mainDep.localizedName); // localized string id used in UI
Console.WriteLine(mainDep.description);
// Read state (delegates to the dependency manager)
var localizedState = mainDep.GetLocalizedState(includeProgress: true);
Console.WriteLine(localizedState);
// Subscribe to progress notifications (the class itself doesn't raise events;
// the dependency manager or other system component may raise them).
mainDep.onNotifyProgress += (progress) => Console.WriteLine($"Progress: {progress:P0}");
// Note: calling Install/Download/etc. on this instance will throw NotSupportedException.
// This class is intended as a read-only / reporting proxy for the toolchain UI.