Client LuaCsForBarotrauma
TrimLString.cs
1 #nullable enable
2 using System;
3 
4 namespace Barotrauma
5 {
6  public class TrimLString : LocalizedString
7  {
8  [Flags]
9  public enum Mode { Start = 0x1, End = 0x2, Both=0x3 }
10  private readonly LocalizedString nestedStr;
11  private readonly Mode mode;
12 
13  public TrimLString(LocalizedString nestedStr, Mode mode)
14  {
15  this.nestedStr = nestedStr;
16  this.mode = mode;
17  }
18 
19  public override bool Loaded => nestedStr.Loaded;
20  public override void RetrieveValue()
21  {
22  cachedValue = nestedStr.Value;
23  if (mode.HasFlag(Mode.Start)) { cachedValue = cachedValue.TrimStart(); }
24  if (mode.HasFlag(Mode.End)) { cachedValue = cachedValue.TrimEnd(); }
26  }
27  }
28 }
override void RetrieveValue()
Definition: TrimLString.cs:20
override bool Loaded
Definition: TrimLString.cs:19
TrimLString(LocalizedString nestedStr, Mode mode)
Definition: TrimLString.cs:13