Skip to content

Commit e6c088e

Browse files
committed
Fix logs. Added SendUnconnected method with NetDataWriter argument.
1 parent 2008465 commit e6c088e

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

LiteNetLib/NetBase.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ public bool SendUnconnectedMessage(byte[] message, NetEndPoint remoteEndPoint)
227227
return SendUnconnectedMessage(message, 0, message.Length, remoteEndPoint);
228228
}
229229

230+
/// <summary>
231+
/// Send message without connection
232+
/// </summary>
233+
/// <param name="writer">Data serializer</param>
234+
/// <param name="remoteEndPoint">Packet destination</param>
235+
/// <returns>Operation result</returns>
236+
public bool SendUnconnectedMessage(NetDataWriter writer, NetEndPoint remoteEndPoint)
237+
{
238+
return SendUnconnectedMessage(writer.Data, 0, writer.Length, remoteEndPoint);
239+
}
240+
230241
/// <summary>
231242
/// Send message without connection
232243
/// </summary>

LiteNetLib/NetSocket.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public int ReceiveFrom(ref byte[] data, ref NetEndPoint remoteEndPoint, ref int
122122
}
123123

124124
//All ok!
125-
NetUtils.DebugWriteError("[R]Recieved data from {0}, result: {1}", remoteEndPoint.ToString(), result);
125+
NetUtils.DebugWrite(ConsoleColor.Blue, "[R]Recieved data from {0}, result: {1}", remoteEndPoint.ToString(), result);
126126

127127
//Assign data
128128
data = _receiveBuffer;

LiteNetLib/NetUtils.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ public static string GetLocalIp(ConnectionAddressType connectionAddressType)
116116

117117
private static readonly object DebugLogLock = new object();
118118

119-
[Conditional("DEBUG_MESSAGES")]
120-
internal static void DebugWrite(ConsoleColor color, string str, params object[] args)
119+
private static void DebugWriteLogic(ConsoleColor color, string str, params object[] args)
121120
{
122121
lock (DebugLogLock)
123122
{
@@ -133,16 +132,22 @@ internal static void DebugWrite(ConsoleColor color, string str, params object[]
133132
}
134133
}
135134

135+
[Conditional("DEBUG_MESSAGES")]
136+
internal static void DebugWrite(ConsoleColor color, string str, params object[] args)
137+
{
138+
DebugWriteLogic(color, str, args);
139+
}
140+
136141
[Conditional("DEBUG_MESSAGES"), Conditional("DEBUG")]
137142
internal static void DebugWriteForce(ConsoleColor color, string str, params object[] args)
138143
{
139-
DebugWrite(color, str, args);
144+
DebugWriteLogic(color, str, args);
140145
}
141146

142147
[Conditional("DEBUG_MESSAGES"), Conditional("DEBUG")]
143148
internal static void DebugWriteError(string str, params object[] args)
144149
{
145-
DebugWrite(ConsoleColor.Red, str, args);
150+
DebugWriteLogic(ConsoleColor.Red, str, args);
146151
}
147152
}
148153
}

0 commit comments

Comments
 (0)