Files
AlayaCore/AlayaCore/Models/Configuration/ManifestServiceOptions.cs

53 lines
2.1 KiB
C#

using System;
namespace AlayaCore.Models.Configuration
{
public sealed class ManifestServiceOptions
{
public Uri CoreManifestUri { get; }
public Uri LauncherManifestUri { get; }
public string CoreManifestSha512Hash { get; }
public string LauncherManifestSha512Hash { get; }
public string ManifestDirectoryPath { get; }
public ManifestServiceOptions(
Uri coreManifestUri,
Uri launcherManifestUri,
string coreManifestSha512Hash,
string launcherManifestSha512Hash,
string manifestDirectoryPath)
{
CoreManifestUri = coreManifestUri ?? throw new ArgumentNullException(nameof(coreManifestUri));
LauncherManifestUri = launcherManifestUri ?? throw new ArgumentNullException(nameof(launcherManifestUri));
if (!CoreManifestUri.IsAbsoluteUri)
{
throw new ArgumentException("Core manifest URI must be absolute.", nameof(coreManifestUri));
}
if (!LauncherManifestUri.IsAbsoluteUri)
{
throw new ArgumentException("Launcher manifest URI must be absolute.", nameof(launcherManifestUri));
}
if (string.IsNullOrWhiteSpace(coreManifestSha512Hash))
{
throw new ArgumentException("Core manifest SHA-512 hash cannot be null, empty, or whitespace.", nameof(coreManifestSha512Hash));
}
if (string.IsNullOrWhiteSpace(launcherManifestSha512Hash))
{
throw new ArgumentException("Launcher manifest SHA-512 hash cannot be null, empty, or whitespace.", nameof(launcherManifestSha512Hash));
}
if (string.IsNullOrWhiteSpace(manifestDirectoryPath))
{
throw new ArgumentException("Manifest directory path cannot be null, empty, or whitespace.", nameof(manifestDirectoryPath));
}
CoreManifestSha512Hash = coreManifestSha512Hash;
LauncherManifestSha512Hash = launcherManifestSha512Hash;
ManifestDirectoryPath = manifestDirectoryPath;
}
}
}