• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Common.MinecraftStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Craft.Net.Common.MinecraftStream的典型用法代码示例。如果您正苦于以下问题:C# MinecraftStream类的具体用法?C# MinecraftStream怎么用?C# MinecraftStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MinecraftStream类属于Craft.Net.Common命名空间,在下文中一共展示了MinecraftStream类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Log

 public Log(StreamWriter stream, ProxySettings settings)
 {
     Stream = stream;
     MemoryStream = new MemoryStream();
     MinecraftStream = new MinecraftStream(MemoryStream);
     Settings = settings;
 }
开发者ID:Niha911,项目名称:SMProxy,代码行数:7,代码来源:Log.cs


示例2: ReadPacket

 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ProtocolVersion = stream.ReadVarInt();
     ServerHostname = stream.ReadString();
     ServerPort = stream.ReadUInt16();
     NextState = (NetworkMode)stream.ReadVarInt();
     return NextState;
 }
开发者ID:umby24,项目名称:Craft.Net,代码行数:8,代码来源:Packets.cs


示例3: WritePacket

 public NetworkMode WritePacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     stream.WriteVarInt(ProtocolVersion);
     stream.WriteString(ServerHostname);
     stream.WriteUInt16(ServerPort);
     stream.WriteVarInt((int)NextState);
     return NextState;
 }
开发者ID:umby24,项目名称:Craft.Net,代码行数:8,代码来源:Packets.cs


示例4: ReadPacket

 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     LevelType = stream.ReadString();
     GameMode = (GameMode)stream.ReadUInt8();
     Dimension = (Dimension)stream.ReadInt8();
     Difficulty = (Difficulty)stream.ReadUInt8();
     Discarded = stream.ReadUInt8();
     MaxPlayers = stream.ReadUInt8();
 }
开发者ID:nevercast,项目名称:Craft.Net,代码行数:10,代码来源:Packets.cs


示例5: Proxy

 public Proxy(NetworkStream client, NetworkStream server, Log log, ProxySettings settings)
 {
     Client = client;
     Server = server;
     Log = log;
     ClientStream = new MinecraftStream(new BufferedStream(Client));
     ServerStream = new MinecraftStream(new BufferedStream(Server));
     CryptoServiceProvider = new RSACryptoServiceProvider(1024);
     ServerKey = CryptoServiceProvider.ExportParameters(true);
     Settings = settings;
 }
开发者ID:SirCmpwn,项目名称:SMProxy,代码行数:11,代码来源:Proxy.cs


示例6: WritePacket

 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteString(LevelType);
     stream.WriteUInt8((byte)GameMode);
     stream.WriteInt8((sbyte)Dimension);
     stream.WriteUInt8((byte)Difficulty);
     stream.WriteUInt8(Discarded);
     stream.WriteUInt8(MaxPlayers);
 }
开发者ID:nevercast,项目名称:Craft.Net,代码行数:11,代码来源:Packets.cs


示例7: MessageRecieved

 public override void MessageRecieved(RemoteClient client, byte[] data)
 {
     if (ServerPingReceived != null)
     {
         var stream = new MinecraftStream(new MemoryStream(data));
         var eventArgs = new ServerPingEventArgs(
             stream.ReadInt32(),
             stream.ReadString(),
             stream.ReadInt32());
         ServerPingReceived(this, eventArgs);
     }
 }
开发者ID:Booser,项目名称:Craft.Net,代码行数:12,代码来源:ServerPingChannel.cs


示例8: Connect

 public void Connect(IPEndPoint endPoint)
 {
     if (Client != null && Client.Connected)
         throw new InvalidOperationException("Already connected to a server!");
     EndPoint = endPoint;
     Client = new TcpClient();
     Client.Connect(EndPoint);
     NetworkStream = Client.GetStream();
     Stream = new MinecraftStream(new BufferedStream(NetworkStream));
     NetworkWorkerThread = new Thread(NetworkWorker);
     NetworkWorkerThread.Start();
     var handshake = new HandshakePacket(PacketReader.ProtocolVersion, Session.SelectedProfile.Name,
         EndPoint.Address.ToString(), EndPoint.Port);
     SendPacket(handshake);
 }
开发者ID:nevercast,项目名称:Craft.Net,代码行数:15,代码来源:MinecraftClient.cs


示例9: FromStream

        public static MetadataDictionary FromStream(MinecraftStream stream)
        {
            var value = new MetadataDictionary();
            while (true)
            {
                byte key = stream.ReadUInt8();
                if (key == 127) break;

                byte type = (byte)((key & 0xE0) >> 5);
                byte index = (byte)(key & 0x1F);

                var entry = EntryTypes[type]();
                entry.FromStream(stream);
                entry.Index = index;

                value[index] = entry;
            }
            return value;
        }
开发者ID:Bitterholz,项目名称:Craft.Net,代码行数:19,代码来源:MetadataDictionary.cs


示例10: WriteTo

 public override void WriteTo(MinecraftStream stream, byte index)
 {
     stream.WriteUInt8(GetKey(index));
     stream.WriteInt16(Value.Id);
     if (Value.Id != -1)
     {
         stream.WriteInt8(Value.Count);
         stream.WriteInt16(Value.Metadata);
         if (Value.Nbt != null)
         {
             var file = new NbtFile(Value.Nbt);
             var data = file.SaveToBuffer(NbtCompression.GZip);
             stream.WriteInt16((short)data.Length);
             stream.WriteUInt8Array(data);
         }
         else
             stream.WriteInt16(-1);
     }
 }
开发者ID:Booser,项目名称:Craft.Net,代码行数:19,代码来源:MetadataSlot.cs


示例11: DoPing

 public static ServerPing DoPing(IPEndPoint endPoint)
 {
     var client = new TcpClient();
     client.Connect(endPoint);
     var stream = new MinecraftStream(client.GetStream());
     var ping = new ServerListPingPacket();
     ping.WritePacket(stream);
     var response = PacketReader.ReadPacket(stream);
     client.Close();
     // TODO: Handle old pings
     var pong = (DisconnectPacket)response;
     var parts = pong.Reason.Substring(3).Split('\0');
     var result = new ServerPing();
     result.ProtocolVersion = int.Parse(parts[0]);
     result.ServerVersion = parts[1];
     result.MotD = parts[2];
     result.CurrentPlayers = int.Parse(parts[3]);
     result.MaxPlayers = int.Parse(parts[4]);
     return result;
 }
开发者ID:nevercast,项目名称:Craft.Net,代码行数:20,代码来源:ServerPing.cs


示例12: FromStream

 public override void FromStream(MinecraftStream stream)
 {
     Value = stream.ReadInt32();
 }
开发者ID:Bitterholz,项目名称:Craft.Net,代码行数:4,代码来源:MetadataInt.cs


示例13: FromStream

 public override void FromStream(MinecraftStream stream)
 {
     Value = ItemStack.FromStream(stream);
 }
开发者ID:Booser,项目名称:Craft.Net,代码行数:4,代码来源:MetadataSlot.cs


示例14: WriteTo

 public override void WriteTo(MinecraftStream stream, byte index)
 {
     stream.WriteUInt8(GetKey(index));
     stream.WriteInt32(Value);
 }
开发者ID:Bitterholz,项目名称:Craft.Net,代码行数:5,代码来源:MetadataInt.cs



注:本文中的Craft.Net.Common.MinecraftStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.World类代码示例发布时间:2022-05-24
下一篇:
C# Net.MinecraftStream类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap