Worms4Editor/LibXom/Data/XomString.cs

53 lines
1.1 KiB
C#
Raw Normal View History

2023-01-07 09:36:13 +00:00
using LibXom.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibXom.Data
{
public class XomString : XomFileComponent
{
private string value;
public override int Id
{
get
{
2023-01-11 09:22:45 +00:00
return this.fileBelongs.calculateIdForXomFileComponent(this.uuid, fileBelongs.XomStrings) - 1;
2023-01-07 09:36:13 +00:00
}
}
public string Value
{
get
{
2023-01-11 09:22:45 +00:00
return this.value;
2023-01-07 09:36:13 +00:00
}
2023-01-11 09:22:45 +00:00
set
{
this.value = value;
fileBelongs.updateStringById(this.Id, this);
}
}
public int Length
{
get
{
return Encoding.UTF8.GetByteCount(this.Value);
}
}
public override string ToString()
{
return this.Value;
2023-01-07 09:36:13 +00:00
}
2023-01-09 06:28:17 +00:00
internal XomString(XomFile fromFile, string value)
2023-01-07 09:36:13 +00:00
{
this.fileBelongs = fromFile;
this.value = value;
}
}
}