private short AddString(BamlStringInfo stringInfo) { short stringId = (short)_stringToID.Count; _stringToID.Add(stringInfo, stringId); return(stringId); }
private void WriteStringInfo(BamlStringInfo node) { BeginVarSize(); short stringId = AddString(node); _blob.Write(ref _pos, (short)stringId); _blob.WriteLengthPrefixedString(ref _pos, (string)node.Value); WriteVarSize(RecordType.StringInfo); }
private void ReadStringInfo() { ReadRecordSize(); var node = new BamlStringInfo(); short stringId = _accessor.ReadInt16(); node.Value = _accessor.ReadLengthPrefixedString(Encoding.UTF8); AddString(stringId, node); AddNode(node); }
private void AddString(short stringId, BamlStringInfo stringInfo) { int stringCount = _strings.Count; if (stringId > stringCount) { throw new BamlException(SR.BamlLoadError); } if (stringId == stringCount) { _strings.Add(stringInfo); } }