コード例 #1
0
        public IEnumerable <InstanceInformation> GetInstances()
        {
            using (var requestChain = new RequestChain(this))
            {
                Send(new Packet(Header.List, requestChain.Id));

                requestChain.WaitForResult(5000);

                var list = new List <InstanceInformation>();

                var buffer            = requestChain.ResultBuffer;
                var numberOfInstances = buffer.ReadInt32();
                while (numberOfInstances-- > 0)
                {
                    var instanceId  = buffer.ReadString();
                    var status      = (InstanceStatus)buffer.ReadInt32();
                    var packageName = buffer.ReadString();
                    //var configuration = InstanceConfiguration.Deserialize(buffer);

                    //list.Add(new InstanceInformation(instanceId, status, packageName, configuration));
                }

                return(list);
            }
        }
コード例 #2
0
        public string CreateInstance(string packageName, InstanceConfiguration configuration)
        {
            using (var requestChain = new RequestChain(this))
            {
                var packet = new Packet(Header.New, requestChain.Id);
                packet.Write(packageName);
                configuration.Serialize(packet);
                Send(packet);

                requestChain.WaitForResult(5000);

                return(requestChain.ResultBuffer.ReadString()); // instanceId
            }
        }