internal void ToBytes(SlpWriter writer) { StringBuilder sb = new StringBuilder(); foreach (KeyValuePair <string, string> item in _InnerCollection) { if (sb.Length > 0) { sb.Append(","); } sb.Append("("); sb.Append(writer.Escape(item.Key, Constants.ATTRIBUTETAGRESERVED)); if (!string.IsNullOrEmpty(item.Value)) { sb.Append("="); if (item.Value.StartsWith("\\FF", StringComparison.InvariantCultureIgnoreCase)) { sb.Append(item.Value); } else { sb.Append(writer.Escape(item.Value, Constants.ATTRIBUTEVALUERESERVED)); } } sb.Append(")"); } writer.WriteRaw(sb.ToString()); }
internal void ToBytes(SlpWriter writer) { if (Uri == null) throw new ServiceException("Service URL cannot be null."); writer.Write((byte)0); writer.Write((short)Lifetime.TotalSeconds); writer.Write(Uri.ToString()); writer.Write((byte)AuthBlocks.Count); foreach (var item in AuthBlocks) { item.ToBytes(writer); } }
internal void ToBytes(SlpWriter writer) { if (Uri == null) { throw new ServiceException("Service URL cannot be null."); } writer.Write((byte)0); writer.Write((short)Lifetime.TotalSeconds); writer.Write(Uri.ToString()); writer.Write((byte)AuthBlocks.Count); foreach (var item in AuthBlocks) { item.ToBytes(writer); } }
public void Write(SlpWriter value) { value.CopyTo(_stream); Length += value.Length; }