Client LuaCsForBarotrauma
SteamWorkshopId.cs
1 #nullable enable
2 using System;
3 using System.Globalization;
4 
5 namespace Barotrauma
6 {
8  {
9  public readonly UInt64 Value;
10 
11  public SteamWorkshopId(UInt64 value)
12  {
13  Value = value;
14  }
15 
16  private const string Prefix = "STEAM_WORKSHOP_";
17 
18  public override string StringRepresentation => Value.ToString(CultureInfo.InvariantCulture);
19 
20  public override bool Equals(object? obj)
21  => obj is SteamWorkshopId otherWorkshopId && otherWorkshopId.Value == Value;
22 
23  public override int GetHashCode() => Value.GetHashCode();
24 
25  public new static Option<SteamWorkshopId> Parse(string s)
26  {
27  if (s.StartsWith(Prefix)) { s = s[Prefix.Length..]; }
28  if (!UInt64.TryParse(s, out var id) || id == 0) { return Option<SteamWorkshopId>.None(); }
29  return Option<SteamWorkshopId>.Some(new SteamWorkshopId(id));
30  }
31  }
32 }
override bool Equals(object? obj)
override string StringRepresentation
static new Option< SteamWorkshopId > Parse(string s)
override int GetHashCode()