MailKit.Security.Ntlm.TargetInfo.EncodeString C# (CSharp) Method

EncodeString() static private method

static private EncodeString ( byte buf, int &index, short type, string value, bool unicode ) : void
buf byte
index int
type short
value string
unicode bool
return void
		static void EncodeString (byte[] buf, ref int index, short type, string value, bool unicode)
		{
			var encoding = unicode ? Encoding.Unicode : Encoding.UTF8;
			int length = value.Length;

			if (unicode)
				length *= 2;

			EncodeTypeAndLength (buf, ref index, type, (short) length);
			encoding.GetBytes (value, 0, value.Length, buf, index);
			index += length;
		}