本文整理汇总了C#中CWrapped.Wrapped类的典型用法代码示例。如果您正苦于以下问题:C# Wrapped类的具体用法?C# Wrapped怎么用?C# Wrapped使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Wrapped类属于CWrapped命名空间,在下文中一共展示了Wrapped类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(Wrapped wSock) {
wSock.writeVarInt(0x01);
wSock.writeShort(SharedLength);
wSock.Send(SharedSecret);
wSock.writeShort(VerifyLength);
wSock.Send(VerifyToken);
wSock.Purge();
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:8,代码来源:IPacket.cs
示例2: Start
/// <summary>
/// Starts the transparent proxy
/// </summary>
public void Start() {
cbaseListener = new TcpListener(IPAddress.Any, CPort);
cbaseListener.Start();
cbaseSock = cbaseListener.AcceptTcpClient();
sbaseSock = new TcpClient(IP, SPort);
sbaseStream = sbaseSock.GetStream();
cbaseStream = cbaseSock.GetStream(); // -- Client accepted successfully, woo.
sSock = new Wrapped(sbaseStream);
cSock = new Wrapped(cbaseStream);
ServerThread = new Thread(ServerNetworkHandler);
ClientThread = new Thread(ClientNetworkHandler);
ServerThread.Start();
ClientThread.Start();
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:21,代码来源:Proxy.cs
示例3: Start
/// <summary>
/// Starts the transparent proxy
/// </summary>
public void Start() {
_cbaseListener = new TcpListener(IPAddress.Any, CPort);
_cbaseListener.Start();
_cbaseSock = _cbaseListener.AcceptTcpClient();
_sbaseSock = new TcpClient(Ip, SPort);
_sbaseStream = _sbaseSock.GetStream();
_cbaseStream = _cbaseSock.GetStream(); // -- Client accepted successfully, woo.
SSock = new Wrapped(_sbaseStream);
CSock = new Wrapped(_cbaseStream);
_serverThread = new Thread(ServerNetworkHandler);
_clientThread = new Thread(ClientNetworkHandler);
_serverThread.Start();
_clientThread.Start();
}
开发者ID:linuxcodefire,项目名称:libMC.NET,代码行数:21,代码来源:Proxy.cs
示例4: ReadEntityMetadata
public static object[] ReadEntityMetadata(Wrapped wSock) {
var MetadataDict = new Dictionary<int, object>();
do {
var item = wSock.readByte();
if (item == 127)
break;
var index = item & 0x1F;
var type = item >> 5;
switch (type) {
case 0:
MetadataDict.Add(index, wSock.readByte());
break;
case 1:
MetadataDict.Add(index, wSock.readShort());
break;
case 2:
MetadataDict.Add(index, wSock.readInt());
break;
case 3:
MetadataDict.Add(index, wSock.readFloat());
break;
case 4:
MetadataDict.Add(index, wSock.readString());
break;
case 5:
MetadataDict.Add(index, ReadSlot(wSock));
break;
case 6:
MetadataDict.Add(index, new Vector(wSock.readInt(), wSock.readInt(), wSock.readInt()));
break;
}
} while (true);
MetadataDict.OrderBy(o => o.Key); // -- Order the dictionary based on the index values
return MetadataDict.Values.ToArray(); // -- Return the data as an array.
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:40,代码来源:WrappedExtension.cs
示例5: Start
/// <summary>
/// Starts the network handler. (Connects to a minecraft server)
/// </summary>
public void Start() {
try {
_baseSock = new TcpClient();
var ar = _baseSock.BeginConnect(_mainMc.ServerIp, _mainMc.ServerPort, null, null);
using (var wh = ar.AsyncWaitHandle) {
if (!ar.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5), false)) {
_baseSock.Close();
RaiseSocketError(this, "Failed to connect: Connection Timeout");
return;
}
_baseSock.EndConnect(ar);
}
} catch (Exception e) {
RaiseSocketError(this, "Failed to connect: " + e.Message);
return;
}
_mainMc.Running = true;
RaiseSocketInfo(this, "Connected to server.");
RaiseSocketDebug(this, string.Format("IP: {0} Port: {1}", _mainMc.ServerIp, _mainMc.ServerPort.ToString()));
// -- Create our Wrapped socket.
_baseStream = _baseSock.GetStream();
WSock = new Wrapped(_baseStream);
RaiseSocketDebug(this, "Socket Created");
DoHandshake();
_packetHandlers = new PacketEventHandler(this);
// -- Start network parsing.
_handler = new Thread(NetworkPacketHandler);
_handler.Start();
RaiseSocketDebug(this, "Handler thread started");
}
开发者ID:linuxcodefire,项目名称:libMC.NET,代码行数:42,代码来源:NetworkHandler.cs
示例6: WriteModifierData
public static void WriteModifierData(Wrapped wSock, ModifierData Data) {
wSock.Send(Data.UUID);
wSock.writeDouble(Data.Amount);
wSock.writeByte(Data.Operation);
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:5,代码来源:WrappedExtension.cs
示例7: WritePropertyData
public static void WritePropertyData(Wrapped wSock, PropertyData Data) {
wSock.writeString(Data.Key);
wSock.writeDouble(Data.Value);
wSock.writeShort(Data.ListLength);
for (int x = 0; x < Data.ListLength; x++)
WriteModifierData(wSock, Data.Modifiers[x]);
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:8,代码来源:WrappedExtension.cs
示例8: ReadModifierData
public static ModifierData ReadModifierData(Wrapped wSock) {
var Data = new ModifierData();
Data.UUID = wSock.readByteArray(16); // -- Because fuck Minecraft.
Data.Amount = wSock.readDouble();
Data.Operation = wSock.readByte();
return Data;
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:9,代码来源:WrappedExtension.cs
示例9: WriteObjectMetadata
public static void WriteObjectMetadata(Wrapped wSock, ObjectMetadata Data) {
wSock.writeInt(Data.ObjectID);
if (Data.ObjectID != 0) {
wSock.writeShort(Data.SpeedX);
wSock.writeShort(Data.SpeedY);
wSock.writeShort(Data.SpeedZ);
}
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:9,代码来源:WrappedExtension.cs
示例10: ReadPropertyData
public static PropertyData ReadPropertyData(Wrapped wSock) {
var Data = new PropertyData();
Data.Key = wSock.readString();
Data.Value = wSock.readDouble();
Data.ListLength = wSock.readShort();
Data.Modifiers = new ModifierData[Data.ListLength];
for (int x = 0; x < Data.ListLength; x++)
Data.Modifiers[x] = ReadModifierData(wSock);
return Data;
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:13,代码来源:WrappedExtension.cs
示例11: ReadRecord
public static Record ReadRecord(Wrapped wSock) {
var Data = new Record();
var RecordData = wSock.readInt();
Data.Metadata = (byte)(RecordData & 0xF);
Data.BlockID = (short)((RecordData >> 4) & 0xFFF);
Data.Y = (byte)((RecordData >> 16) & 0xFF);
Data.Z = (byte)((RecordData >> 24) & 0xF);
Data.X = (byte)((RecordData >> 28) & 0xF);
return Data;
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:12,代码来源:WrappedExtension.cs
示例12: Read
public void Read(Wrapped wSock) {
EntityID = wSock.readVarInt();
Animation = wSock.readByte();
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:4,代码来源:IPacket.cs
示例13: ReadSlot
public static SlotData ReadSlot(Wrapped wSock) {
var Data = new SlotData();
Data.ID = wSock.readShort();
if (Data.ID == -1) {
Data.ID = 0;
Data.ItemCount = 0;
Data.ItemDamage = 0;
return Data;
}
Data.ItemCount = wSock.readByte();
Data.ItemDamage = wSock.readShort();
var NBTLength = wSock.readShort();
if (NBTLength == -1)
return Data;
Data.NbtData = wSock.readByteArray(NBTLength);
return Data;
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:21,代码来源:WrappedExtension.cs
示例14: ReadObjectMetadata
public static ObjectMetadata ReadObjectMetadata(Wrapped wSock) {
var Data = new ObjectMetadata();
Data.ObjectID = wSock.readInt();
if (Data.ObjectID != 0) {
Data.SpeedX = wSock.readShort();
Data.SpeedY = wSock.readShort();
Data.SpeedZ = wSock.readShort();
}
return Data;
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:12,代码来源:WrappedExtension.cs
示例15: WriteSlot
public static void WriteSlot(Wrapped wSock, SlotData Data) {
if (Data.ID == -1) {
wSock.writeShort(-1);
return;
}
wSock.writeShort(Data.ID);
wSock.writeByte(Data.ItemCount);
wSock.writeShort(Data.ItemDamage);
if (Data.NbtData == null) {
wSock.writeShort(-1);
return;
}
wSock.writeShort((short)Data.NbtData.Length);
wSock.Send(Data.NbtData);
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:18,代码来源:WrappedExtension.cs
示例16: WriteRecord
public static void WriteRecord(Wrapped wSock, Record Data) {
int RecordData = Data.Metadata & 0xF | (Data.BlockID & 0xFFF) << 4 | (Data.Y & 0xFF) << 16 | (Data.Z & 0xF) << 24 | (Data.X & 0xF) << 28;
wSock.writeInt(RecordData);
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:4,代码来源:WrappedExtension.cs
示例17: WriteEntityMetadata
public static void WriteEntityMetadata(Wrapped wSock, object[] Metadata) {
throw new NotImplementedException("Not quite done here yet.");
}
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:3,代码来源:WrappedExtension.cs
示例18: Stop
/// <summary>
/// Stops the network handler. (Disconnects from a minecraft server)
/// </summary>
public void Stop() {
DebugMessage(this, "Stopping network handler...");
_handler.Abort();
WSock = null;
_baseStream = null;
_baseSock.Close();
InfoMessage(this, "Disconnected from Minecraft Server.");
}
开发者ID:linuxcodefire,项目名称:libMC.NET,代码行数:14,代码来源:NetworkHandler.cs
注:本文中的CWrapped.Wrapped类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论