本文整理汇总了C#中System.Byte.Redim方法的典型用法代码示例。如果您正苦于以下问题:C# Byte.Redim方法的具体用法?C# Byte.Redim怎么用?C# Byte.Redim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Byte
的用法示例。
在下文中一共展示了Byte.Redim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameListener
/// <summary>
/// Game Connection Packet List Manager.
/// </summary>
protected void GameListener(object args)
{
if (State == ConnectionState.Connected && StreamGame != null && StreamLocal != null) {
try {
if (StreamGame != null && StreamGame.CanRead && StreamGame.DataAvailable) {
//Byte to Store Server Packets.
var data = new Byte[8192];
//Get Game Server Packets.
var length = StreamGame.Read(data, 0, data.Length);
if (length > 0) {
//Send Packet to Client if Needed.
if (StreamLocal.CanWrite) { StreamLocal.Write(data, 0, length); }
//Stack the Intercepted Packet.
PacketChangedCall.BeginInvoke(data.Redim(length), PacketSource.Server, null, PacketChangedCall);
//Initialize the Client Listener, if Needed.
if (TMClientListener != null) { return; }
TMClientListener = new System.Threading.Timer(ClientListener, null, 0, 100);
}
}
}
catch (IOException) { Disconnect(); }
}
}
示例2: ClientListener
/// <summary>
/// Client Connection Packet List Manager.
/// </summary>
protected void ClientListener(object args)
{
try {
if (StreamLocal != null && StreamLocal.CanRead && StreamLocal.DataAvailable) {
//Byte to Store Client Packets.
var data = new Byte[8192];
//Get Client Local Packets.
var length = StreamLocal.Read(data, 0, data.Length);
if (length > 0) {
//Send Packet to Server if Needed.
if (StreamGame.CanWrite) { StreamGame.Write(data, 0, length); }
//Stack the Intercepted Packet.
PacketChangedCall.BeginInvoke(data.Redim(length), PacketSource.Client, null, PacketChangedCall);
}
}
}
catch (IOException) { Disconnect(); }
}