public override ITransport GetTransport() { var transport = new DefaultTransport(new TestAssemblyLocator()); transport.InitializeForConsuming(); transport.InitializeForPublishing(); return(transport); }
private IN3(Chain chainId) { // Starting to get convoluted. Need to think of a better way. Transport = new DefaultTransport(); Storage = new InMemoryStorage(); Signer = new Crypto.SimpleWallet(this); NativeClient = new NativeClient(this, chainId); Btc = new Btc.Api(this); Eth1 = new Eth1.Api(this); Crypto = new Crypto.Api(this); Ipfs = new Ipfs.Api(this); Configuration = NativeClient.ReadConfiguration(); }
internal void FromBase64(string base64) { byte[] binary = Convert.FromBase64String(base64); using (BitReader reader = BitReader.Get(binary)) { ProtocolVersion = reader.ReadUShort(); Transport = (DefaultTransport)reader.ReadBits(5); ushort channelCount = reader.ReadUShort(); Channels.Clear(); for (int i = 0; i < channelCount; i++) { Channel channel = new Channel() { Name = reader.ReadString(), Encrypted = reader.ReadBool(), Type = (ChannelType)reader.ReadBits(5) }; Channels.Add(channel); } ushort messageTypeCount = reader.ReadUShort(); MessageTypes.Clear(); for (int i = 0; i < messageTypeCount; i++) { MessageType messageType = new MessageType() { Name = reader.ReadString(), Passthrough = reader.ReadBool() }; MessageTypes.Add(messageType); } ushort sceneCount = reader.ReadUShort(); RegisteredScenes.Clear(); for (int i = 0; i < sceneCount; i++) { RegisteredScenes.Add(reader.ReadString()); } ushort networkedPrefabsCount = reader.ReadUShort(); NetworkedPrefabs.Clear(); GameObject root = new GameObject("MLAPI: Dummy prefabs"); for (int i = 0; i < networkedPrefabsCount; i++) { bool playerPrefab = reader.ReadBool(); string prefabName = reader.ReadString(); GameObject dummyPrefab = new GameObject("REPLACEME: " + prefabName + "(Dummy prefab)", typeof(NetworkedObject)); dummyPrefab.GetComponent <NetworkedObject>().NetworkedPrefabName = prefabName; dummyPrefab.transform.SetParent(root.transform); //This is just here to not ruin your hierarchy NetworkedPrefab networkedPrefab = new NetworkedPrefab() { playerPrefab = playerPrefab, prefab = dummyPrefab }; NetworkedPrefabs.Add(networkedPrefab); } MessageBufferSize = reader.ReadInt(); ReceiveTickrate = reader.ReadInt(); MaxReceiveEventsPerTickRate = reader.ReadInt(); SendTickrate = reader.ReadInt(); EventTickrate = reader.ReadInt(); MaxConnections = reader.ReadInt(); ConnectPort = reader.ReadInt(); ConnectAddress = reader.ReadString(); ClientConnectionBufferTimeout = reader.ReadInt(); ConnectionApproval = reader.ReadBool(); SecondsHistory = reader.ReadInt(); HandleObjectSpawning = reader.ReadBool(); EnableEncryption = reader.ReadBool(); SignKeyExchange = reader.ReadBool(); AllowPassthroughMessages = reader.ReadBool(); EnableSceneSwitching = reader.ReadBool(); EnableTimeResync = reader.ReadBool(); AttributeMessageMode = (AttributeMessageMode)reader.ReadBits(3); } }