Esempio n. 1
0
        private void UpdateOrAddMPClient(string broadcastMessage)
        {
            string[] clientInfo = broadcastMessage.Split(',');
            if (clientInfo.Length != 5)
                return;
            uWiMP.TVServer.MPClient.Client client = new uWiMP.TVServer.MPClient.Client();
            try
            {
                client.Friendly = clientInfo[0];
                client.Hostname = clientInfo[0];
                client.MACAddress = clientInfo[1];
                client.Port = clientInfo[2];
                client.usesMovingPictures = Convert.ToBoolean(clientInfo[3]);
                client.usesTVSeries = Convert.ToBoolean(clientInfo[4]);

                if (uWiMP.TVServer.MPClientDatabase.IsExistingClientByHostname(client.Hostname))
                {
                    uWiMP.TVServer.MPClient.Client oldClient = uWiMP.TVServer.MPClientDatabase.GetClientByHostname(client.Hostname);
                    client.Friendly = oldClient.Friendly;
                    bool result = uWiMP.TVServer.MPClientDatabase.ManageClient(client, "update");
                }
                else
                {
                    bool result = uWiMP.TVServer.MPClientDatabase.ManageClient(client, "insert");
                }
            }
            catch (Exception ex)
            {
                //Fubar somewhere - just ignore it
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType = "text/xml";
            Response.ContentEncoding = Encoding.UTF8;

            string wa = "waClientUpdateResult";

            uWiMP.TVServer.MPClient.Client client = new uWiMP.TVServer.MPClient.Client();
            client.Friendly = Request.QueryString["friendly"];
            client.Hostname = Request.QueryString["hostname"];
            client.Port = Request.QueryString["port"];
            client.MACAddress = Request.QueryString["macaddress"];
            client.usesMovingPictures = Convert.ToBoolean(Request.QueryString["usemovpics"]);
            client.usesTVSeries = Convert.ToBoolean(Request.QueryString["usetvseries"]);

            TextWriter tw = new StreamWriter(Response.OutputStream, Encoding.UTF8);
            XmlWriter xw = new XmlTextWriter(tw);

            //start doc
            xw.WriteStartDocument();

            //start root
            xw.WriteStartElement("root");

            //go
            xw.WriteStartElement("go");
            xw.WriteAttributeString("to", wa);
            xw.WriteEndElement();
            //end go

            //start title
            xw.WriteStartElement("title");
            xw.WriteAttributeString("set", wa);
            xw.WriteEndElement();
            //end title

            //start dest
            xw.WriteStartElement("destination");
            xw.WriteAttributeString("mode", "replace");
            xw.WriteAttributeString("zone", wa);
            xw.WriteAttributeString("create", "true");
            xw.WriteEndElement();
            //end dest

            //start data
            xw.WriteStartElement("data");
            xw.WriteCData(UpdateClient(wa, client));
            xw.WriteEndElement();
            //end data

            //end root
            xw.WriteEndElement();

            //end doc
            xw.WriteEndDocument();
            xw.Close();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType = "text/xml";
            Response.ContentEncoding = Encoding.UTF8;

            string wa = "waClientDeleteConfirm";

            uWiMP.TVServer.MPClient.Client client = new uWiMP.TVServer.MPClient.Client();
            client.Friendly = Request.QueryString["friendly"];

            TextWriter tw = new StreamWriter(Response.OutputStream, Encoding.UTF8);
            XmlWriter xw = new XmlTextWriter(tw);

            //start doc
            xw.WriteStartDocument();

            //start root
            xw.WriteStartElement("root");

            //go
            xw.WriteStartElement("go");
            xw.WriteAttributeString("to", wa);
            xw.WriteEndElement();
            //end go

            //start title
            xw.WriteStartElement("title");
            xw.WriteAttributeString("set", wa);
            xw.WriteEndElement();
            //end title

            //start dest
            xw.WriteStartElement("destination");
            xw.WriteAttributeString("mode", "replace");
            xw.WriteAttributeString("zone", wa);
            xw.WriteAttributeString("create", "true");
            xw.WriteEndElement();
            //end dest

            //start data
            xw.WriteStartElement("data");
            xw.WriteCData(DeleteClientMenuConfirm(wa, client));
            xw.WriteEndElement();
            //end data

            //end root
            xw.WriteEndElement();

            //end doc
            xw.WriteEndDocument();
            xw.Close();
        }