SharpCifs.Netbios.Name.WriteWireFormat C# (CSharp) Method

WriteWireFormat() private method

private WriteWireFormat ( byte dst, int dstIndex ) : int
dst byte
dstIndex int
return int
		internal virtual int WriteWireFormat(byte[] dst, int dstIndex)
		{
			// write 0x20 in first byte
			dst[dstIndex] = unchecked(0x20);
			// write name
			try
			{
				byte[] tmp = Runtime.GetBytesForString(name, OemEncoding
					);
				int i;
				for (i = 0; i < tmp.Length; i++)
				{
					dst[dstIndex + (2 * i + 1)] = unchecked((byte)(((tmp[i] & unchecked(0xF0))
						 >> 4) + unchecked(0x41)));
					dst[dstIndex + (2 * i + 2)] = unchecked((byte)((tmp[i] & unchecked(0x0F)) 
						+ unchecked(0x41)));
				}
				for (; i < 15; i++)
				{
					dst[dstIndex + (2 * i + 1)] = unchecked(unchecked(0x43));
					dst[dstIndex + (2 * i + 2)] = unchecked(unchecked(0x41));
				}
				dst[dstIndex + TypeOffset] = unchecked((byte)(((HexCode & unchecked(0xF0)
					) >> 4) + unchecked(0x41)));
				dst[dstIndex + TypeOffset + 1] = unchecked((byte)((HexCode & unchecked(0x0F)) + unchecked(0x41)));
			}
			catch (UnsupportedEncodingException)
			{
			}
			return ScopeOffset + WriteScopeWireFormat(dst, dstIndex + ScopeOffset);
		}

Usage Example

コード例 #1
0
ファイル: NameServicePacket.cs プロジェクト: zxz2020/Emby
        internal virtual int WriteResourceRecordWireFormat(byte[] dst, int dstIndex)
        {
            int start = dstIndex;

            if (RecordName == QuestionName)
            {
                dst[dstIndex++] = unchecked (unchecked (0xC0));
                // label string pointer to
                dst[dstIndex++] = unchecked (unchecked (0x0C));
            }
            else
            {
                // questionName (offset 12)
                dstIndex += RecordName.WriteWireFormat(dst, dstIndex);
            }
            WriteInt2(RecordType, dst, dstIndex);
            dstIndex += 2;
            WriteInt2(RecordClass, dst, dstIndex);
            dstIndex += 2;
            WriteInt4(Ttl, dst, dstIndex);
            dstIndex   += 4;
            RDataLength = WriteRDataWireFormat(dst, dstIndex + 2);
            WriteInt2(RDataLength, dst, dstIndex);
            dstIndex += 2 + RDataLength;
            return(dstIndex - start);
        }
All Usage Examples Of SharpCifs.Netbios.Name::WriteWireFormat