Client LuaCsForBarotrauma
IgnoredHints.cs
1 #nullable enable
2 using System;
3 using System.Collections.Generic;
4 using System.Collections.Immutable;
5 using System.Linq;
6 using System.Xml.Linq;
7 
8 namespace Barotrauma
9 {
10  public class IgnoredHints
11  {
12  private readonly HashSet<Identifier> identifiers = new HashSet<Identifier>();
13 
14  private IgnoredHints() { }
15 
16  private IgnoredHints(XElement element)
17  {
18  identifiers = element.GetAttributeIdentifierArray("identifiers", Array.Empty<Identifier>())
19  .ToHashSet();
20  }
21 
22  public static void Init(XElement? element)
23  {
24  if (element is null) { return; }
25 
26  Instance = new IgnoredHints(element);
27  }
28 
29  public void SaveTo(XElement element)
30  {
31  element.SetAttributeValue("identifiers", string.Join(",", identifiers));
32  }
33 
34  public bool Contains(Identifier identifier) => identifiers.Contains(identifier);
35 
36  public void Add(Identifier identifier) => identifiers.Add(identifier);
37 
38  public void Remove(Identifier identifier) => identifiers.Remove(identifier);
39 
40  public void Clear() => identifiers.Clear();
41 
42  public static IgnoredHints Instance { get; private set; } = new IgnoredHints();
43  }
44 }
static IgnoredHints Instance
Definition: IgnoredHints.cs:42
void Remove(Identifier identifier)
void SaveTo(XElement element)
Definition: IgnoredHints.cs:29
void Add(Identifier identifier)
bool Contains(Identifier identifier)
static void Init(XElement? element)
Definition: IgnoredHints.cs:22