| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Text;
- namespace ENet
- {
- public struct Address : IEquatable<Address>
- {
- private ENetAddress address;
- public bool Equals(Address addr)
- {
- ENetAddress enetAddr = addr.Struct;
- return this.address.host == enetAddr.host &&
- this.address.port == enetAddr.port;
- }
- public string IP
- {
- get
- {
- var hostIP = new StringBuilder(256);
- Native.enet_address_get_host_ip(ref this.address, hostIP, (uint)hostIP.Length);
- return hostIP.ToString();
- }
- }
- public string Host
- {
- get
- {
- var hostName = new StringBuilder(256);
- Native.enet_address_get_host(ref this.address, hostName, (uint)hostName.Length);
- return hostName.ToString();
- }
- set
- {
- Native.enet_address_set_host(ref this.address, value);
- }
- }
- public ENetAddress Struct
- {
- get
- {
- return this.address;
- }
- }
- public ushort Port
- {
- get
- {
- return this.address.port;
- }
- set
- {
- this.address.port = value;
- }
- }
- }
- }
|