Client LuaCsForBarotrauma
ConcatComponent.cs
1 using System.Xml.Linq;
2 using System;
3 
5 {
7  {
8  private int maxOutputLength;
9 
10  [Editable, Serialize(256, IsPropertySaveable.No, description: "The maximum length of the output string. Warning: Large values can lead to large memory usage or networking load.")]
11  public int MaxOutputLength
12  {
13  get { return maxOutputLength; }
14  set
15  {
16  maxOutputLength = Math.Max(value, 0);
17  }
18  }
19 
21  public string Separator
22  {
23  get;
24  set;
25  }
26 
28  : base(item, element)
29  {
30  }
31 
32  protected override string Calculate(string signal1, string signal2)
33  {
34  string output;
35  if (string.IsNullOrEmpty(Separator))
36  {
37  output = signal1 + signal2;
38  }
39  else
40  {
41  output = signal1 + Separator + signal2;
42  }
43  return output.Length <= maxOutputLength ? output : output.Substring(0, MaxOutputLength);
44  }
45  }
46 }
ConcatComponent(Item item, ContentXElement element)
override string Calculate(string signal1, string signal2)