Exemplo n.º 1
0
        private Readable SendRequest(Writeable payload)
        {
            // build the request header
            PlayerRqst request = CreateHeader(payload);

            // build request data
            MemoryStream  requestStream = new MemoryStream();
            XmlDataWriter requestWriter = new XmlDataWriter(requestStream);

            requestWriter.WriteObject(request.GetType().Name, request);
            requestWriter.Flush();
            if (Logger.Enabled)
            {
                Logger.LogInfo(this, "SendRequest", String.Format("Request: {0}", Encoding.UTF8.GetString(requestStream.ToArray())));
            }

            // send request
            MemoryStream responseStream = SendRequestViaHttp(requestStream);

            if (Logger.Enabled)
            {
                Logger.LogInfo(this, "SendRequest", String.Format("Response: {0}", Encoding.UTF8.GetString(responseStream.ToArray())));
            }

            // read response
            XmlDataReader responseReader = new XmlDataReader(responseStream);
            PlayerResp    response       = (PlayerResp)responseReader.ReadObject("PlayerResp", PlayerResp.CtorDataReader);

            // parse response header
            return(ParseHeader(response));
        }
Exemplo n.º 2
0
        private UserData ReadDataFile(Stream stream)
        {
            XmlDataReader reader   = new XmlDataReader(stream);
            UserData      userData = (UserData)reader.ReadObject(UserElement, UserData.CtorDataReader);

            fSettings = userData.Settings;
            fShowList = userData.ShowList;

            return(userData);
        }
Exemplo n.º 3
0
        private Config ReadDataFile(Stream stream)
        {
            XmlDataReader reader = new XmlDataReader(stream);

            return((Config)reader.ReadObject(ConfigElement, Config.CtorDataReader));
        }