Exemple #1
0
        private short AddString(BamlStringInfo stringInfo)
        {
            short stringId = (short)_stringToID.Count;

            _stringToID.Add(stringInfo, stringId);

            return(stringId);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        private void ReadStringInfo()
        {
            ReadRecordSize();

            var node = new BamlStringInfo();

            short stringId = _accessor.ReadInt16();

            node.Value = _accessor.ReadLengthPrefixedString(Encoding.UTF8);

            AddString(stringId, node);
            AddNode(node);
        }
Exemple #4
0
        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);
            }
        }