Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SIPSorcery/net/STUN/STUNAppState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static string PrintBuffer(byte[] buffer)

if (byteStr.Length == 1)
{
bufferStr += "0" + byteStr;
bufferStr += $"0{byteStr}";
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override int ToByteBuffer(byte[] buffer, int startIndex)

public override string ToString()
{
string attrDescrStr = "STUN Attribute: " + base.AttributeType + ", address=" + Address.ToString() + ", port=" + Port + ".";
string attrDescrStr = $"STUN Attribute: {base.AttributeType}, address={Address.ToString()}, port={Port}.";

return attrDescrStr;
}
Expand Down
4 changes: 2 additions & 2 deletions src/SIPSorcery/net/STUN/STUNAttributes/STUNAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static List<STUNAttribute> ParseMessageAttributes(byte[] buffer, int star

attributes.Add(attribute);

// Attributes start on 32 bit word boundaries so where an attribute length is not a multiple of 4 it gets padded.
// Attributes start on 32 bit word boundaries so where an attribute length is not a multiple of 4 it gets padded.
int padding = (stunAttributeLength % 4 != 0) ? 4 - (stunAttributeLength % 4) : 0;

startAttIndex = startAttIndex + 4 + stunAttributeLength + padding;
Expand Down Expand Up @@ -258,7 +258,7 @@ public virtual int ToByteBuffer(byte[] buffer, int startIndex)

public new virtual string ToString()
{
string attrDescrString = "STUN Attribute: " + AttributeType.ToString() + ", length=" + PaddedLength + ".";
string attrDescrString = $"STUN Attribute: {AttributeType.ToString()}, length={PaddedLength}.";

return attrDescrString;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public STUNChangeRequestAttribute(byte[] attributeValue)

public override string ToString()
{
string attrDescrStr = "STUN Attribute: " + STUNAttributeTypesEnum.ChangeRequest.ToString() + ", key byte=" + m_changeRequestByte.ToString("X") + ", change address=" + ChangeAddress + ", change port=" + ChangePort + ".";
string attrDescrStr = $"STUN Attribute: {STUNAttributeTypesEnum.ChangeRequest.ToString()}, key byte={m_changeRequestByte.ToString("X")}, change address={ChangeAddress}, change port={ChangePort}.";

return attrDescrStr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public STUNConnectionIdAttribute(uint connectionId)

public override string ToString()
{
string attrDescrStr = "STUN CONNECTION_ID Attribute: value=" + ConnectionId + ".";
string attrDescrStr = $"STUN CONNECTION_ID Attribute: value={ConnectionId}.";

return attrDescrStr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static byte[] BuildValue(int errorCode, string reasonPhrase)

public override string ToString()
{
string attrDescrStr = "STUN ERROR_CODE_ADDRESS Attribute: error code=" + ErrorCode + ", reason phrase=" + ReasonPhrase + ".";
string attrDescrStr = $"STUN ERROR_CODE_ADDRESS Attribute: error code={ErrorCode}, reason phrase={ReasonPhrase}.";

return attrDescrStr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public override int ToByteBuffer(byte[] buffer, int startIndex)

public override string ToString()
{
string attrDescrStr = "STUN XOR_MAPPED_ADDRESS Attribute: " + base.AttributeType + ", address=" + Address.ToString() + ", port=" + Port + ".";
string attrDescrStr = $"STUN XOR_MAPPED_ADDRESS Attribute: {base.AttributeType}, address={Address.ToString()}, port={Port}.";

return attrDescrStr;
}
Expand Down
6 changes: 3 additions & 3 deletions src/SIPSorcery/net/STUN/STUNMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ public byte[] ToByteBuffer(byte[] messageIntegrityKey, bool addFingerprint)
return buffer;
}

public new string ToString()
public override string ToString()
{
string messageDescr = "STUN Message: " + Header.MessageType.ToString() + ", length=" + Header.MessageLength;
string messageDescr = $"STUN Message: {Header.MessageType.ToString()}, length={Header.MessageLength}";

foreach (STUNAttribute attribute in Attributes)
{
messageDescr += "\n " + attribute.ToString();
messageDescr += $"\n {attribute.ToString()}";
}

return messageDescr;
Expand Down
Loading