Client LuaCsForBarotrauma
ConcatComponent.cs
1
using
System.Xml.Linq;
2
using
System;
3
4
namespace
Barotrauma.Items.Components
5
{
6
class
ConcatComponent
:
StringComponent
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
20
[
InGameEditable
,
Serialize
(
""
,
IsPropertySaveable
.No)]
21
public
string
Separator
22
{
23
get
;
24
set
;
25
}
26
27
public
ConcatComponent
(
Item
item
,
ContentXElement
element)
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
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
Barotrauma.Items.Components.ConcatComponent
Definition:
ConcatComponent.cs:7
Barotrauma.Items.Components.ConcatComponent.ConcatComponent
ConcatComponent(Item item, ContentXElement element)
Definition:
ConcatComponent.cs:27
Barotrauma.Items.Components.ConcatComponent.Calculate
override string Calculate(string signal1, string signal2)
Definition:
ConcatComponent.cs:32
Barotrauma.Items.Components.ConcatComponent.MaxOutputLength
int MaxOutputLength
Definition:
ConcatComponent.cs:12
Barotrauma.Items.Components.ConcatComponent.Separator
string Separator
Definition:
ConcatComponent.cs:22
Barotrauma.Items.Components.ItemComponent.item
Item item
Definition:
BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs:36
Barotrauma.Items.Components.StringComponent
Definition:
StringComponent.cs:6
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Editable
Definition:
Editable.cs:7
InGameEditable
Definition:
Editable.cs:60
Barotrauma.Items.Components
Definition:
BarotraumaShared/SharedSource/Items/Components/DockingPort.cs:15
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Items
Components
Signal
ConcatComponent.cs
Generated by
1.9.1