Пример #1
0
        public CsfFileEntryViewModel(CsfLabel label)
        {
            Name = label.Name;

            if (label.Strings.Length > 0)
            {
                var csfString = label.Strings[0];
                Value     = csfString.Value;
                ExtraVaue = csfString.ExtraValue;
            }
        }
Пример #2
0
        public static async Task Serialize(this CsfLabel @this, Stream stream, byte[] buffer)
        {
            buffer.SizeCheck(12);
            FLAG_RAW.CopyToLittleEndianByteArray(buffer);
            @this.Values.Count.CopyToLittleEndianByteArray(buffer, 4);
            @this.Label.Length.CopyToLittleEndianByteArray(buffer, 8);

            await stream.WriteAsync(buffer.AsMemory(0, 12)).ConfigureAwait(false);

            await stream.WriteAsync(Encoding.ASCII.GetBytes(@this.Label).AsMemory()).ConfigureAwait(false);

            foreach (var i in @this.Values)
            {
                await i.Serialize(stream, buffer).ConfigureAwait(false);
            }
        }