mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Add xmldocs
This commit is contained in:
56 files changed
+1036
-148
No files matched your search
@@ -8,8 +8,18 @@ using System.Text;
|
||||
|
||||
namespace Reactor.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Reactor.Protocol mod.
|
||||
/// </summary>
|
||||
public readonly struct Mod : IEquatable<Mod>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mod"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="id">The id of the mod.</param>
|
||||
/// <param name="version">The version of the mod.</param>
|
||||
/// <param name="flags">The flags of the mod.</param>
|
||||
/// <param name="name">The name of the mod.</param>
|
||||
public Mod(string id, string version, ModFlags flags, string? name = null)
|
||||
{
|
||||
Id = id;
|
||||
@@ -18,38 +28,62 @@ public readonly struct Mod : IEquatable<Mod>
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id of the mod.
|
||||
/// </summary>
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the mod.
|
||||
/// </summary>
|
||||
public string Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the flags of the mod.
|
||||
/// </summary>
|
||||
public ModFlags Flags { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the mod.
|
||||
/// </summary>
|
||||
public string? Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the mod is required on all clients.
|
||||
/// </summary>
|
||||
public bool IsRequiredOnAllClients => (Flags & ModFlags.RequireOnAllClients) != 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Equals(Mod other)
|
||||
{
|
||||
return Id == other.Id && Version == other.Version;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Mod other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public static bool operator ==(Mod left, Mod right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public static bool operator !=(Mod left, Mod right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Id, Version);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Name ?? Id} ({Version})";
|
||||
|
||||
@@ -2,9 +2,15 @@ using System;
|
||||
|
||||
namespace Reactor.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// Represents flags of the mod.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ModFlags : ushort
|
||||
{
|
||||
/// <summary>
|
||||
/// No flags.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<NoBuild>true</NoBuild>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -22,6 +23,10 @@
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>$(ContentTargetFolders)\cs\any\$(PackageId)\%(RecursiveDir)\</PackagePath>
|
||||
</Compile>
|
||||
<Compile Update="Mod.cs">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>contentFiles\cs\any\Reactor.Networking.Shared\\</PackagePath>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
namespace Reactor.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GameData flag for Reactor messages.
|
||||
/// </summary>
|
||||
public enum ReactorGameDataFlag : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// KickWithReason GameData message.
|
||||
/// </summary>
|
||||
KickWithReason,
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
namespace Reactor.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a message flag for Reactor messages.
|
||||
/// </summary>
|
||||
public enum ReactorMessageFlags : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Handshake message.
|
||||
/// </summary>
|
||||
Handshake,
|
||||
}
|
||||
Reference in new issue
Block a user