Exemple #1
0
        /// <summary>
        /// Read process.
        /// </summary>
        /// <param name="reader">Reader from which to deserialize.</param>
        /// <returns>Process.</returns>
        private static Rendezvous.Process ReadProcess(BinaryReader reader)
        {
            var processName    = reader.ReadString();
            var processVersion = reader.ReadString();
            var process        = new Rendezvous.Process(processName, processVersion);

            // read endpoint info
            var endpointCount = reader.ReadInt32();

            for (var i = 0; i < endpointCount; i++)
            {
                Rendezvous.Endpoint endpoint;
                switch (reader.ReadByte())
                {
                case 0:     // TcpEndpoint
                    var address = reader.ReadString();
                    var port    = reader.ReadInt32();
                    endpoint = new Rendezvous.TcpSourceEndpoint(address, port);
                    break;

                case 1:     // NetMQEndpoint
                    endpoint = new Rendezvous.NetMQSourceEndpoint(reader.ReadString());
                    break;

                case 2:     // RemoteExporterEndpoint
                    var host = reader.ReadString();
                    port = reader.ReadInt32();
                    var transport = (TransportKind)reader.ReadInt32();
                    endpoint = new Rendezvous.RemoteExporterEndpoint(host, port, transport);
                    break;

                case 3:     // RemoteClockExporerEndpoint
                    host     = reader.ReadString();
                    port     = reader.ReadInt32();
                    endpoint = new Rendezvous.RemoteClockExporterEndpoint(host, port);
                    break;

                default:
                    throw new Exception("Unknown type of Endpoint.");
                }

                // read stream info
                var streamCount = reader.ReadInt32();
                for (var j = 0; j < streamCount; j++)
                {
                    var name     = reader.ReadString();
                    var typeName = reader.ReadString();
                    endpoint.AddStream(new Rendezvous.Stream(name, typeName));
                }

                process.AddEndpoint(endpoint);
            }

            return(process);
        }
Exemple #2
0
 /// <summary>
 /// Create a <see cref="RemoteClockImporter"/> from a <see cref="Rendezvous.RemoteClockExporterEndpoint"/>.
 /// </summary>
 /// <param name="endpoint"><see cref="Rendezvous.RemoteClockExporterEndpoint"/> from which to create .</param>
 /// <param name="pipeline">The pipeline to add the component to.</param>
 /// <returns><see cref="RemoteClockImporter"/>.</returns>
 public static RemoteClockImporter ToRemoteClockImporter(this Rendezvous.RemoteClockExporterEndpoint endpoint, Pipeline pipeline)
 {
     return(new RemoteClockImporter(pipeline, endpoint.Host, endpoint.Port));
 }