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 { return this.fileBelongs.calculateIdForXomStrings(this); } } public string Value { get { return this.value; } } public int Length { get { return Encoding.UTF8.GetByteCount(this.Value); } } public override bool Equals(object? obj) { if (obj is XomString) return this.Value.Equals((obj as XomString).Value, StringComparison.InvariantCulture); else if(obj is string) return this.Value.Equals((obj as string), StringComparison.InvariantCulture); else return false; } public override int GetHashCode() { return this.Value.GetHashCode(); } /* public void OverwriteXomString(string newValue) { this.value = newValue; fileBelongs.updateStringById(this.Id, this); } */ public override string ToString() { return this.Value; } internal XomString(XomFile fromFile, string value) { this.fileBelongs = fromFile; this.value = value; } } }