예제 #1
0
        public string IVSTest(string isn, string responseContentText)
        {
            ReplayDevice device = new ReplayDevice();

            char[]   separator = new char[] { ' ' };
            string[] textArray = responseContentText.Split(separator);
            char[]   trimChars = new char[] { '"' };
            device.isn = textArray[1].Substring(4).Trim(trimChars);
            char[] chArray3 = new char[] { '"' };
            device.ip = textArray[2].Substring(3).Trim(chArray3);
            char[] chArray4 = new char[] { '"' };
            device.port = textArray[3].Substring(5).Trim(chArray4);
            try
            {
                string      xml      = HTTPClient.GetAsString("http://" + device.ip + ":" + device.port + "/ivs-IVSGetUnitInfo", 0x3a98);
                XmlDocument document = new XmlDocument();
                document.LoadXml(xml);
                foreach (XmlNode node in document.SelectNodes("/UnitInfo"))
                {
                    XmlElement element = node as XmlElement;
                    if (element != null)
                    {
                        return(element.GetAttribute("nickname"));
                    }
                }
            }
            catch
            {
            }
            return(null);
        }
예제 #2
0
        public int Send(string fromDevice, string showID, string recipientISN)
        {
            int num = 1;

            ZoggrLogger.Log(string.Format("Sending showID {0} from {1} to {2}...", showID, fromDevice, recipientISN));
            try
            {
                ReplayDevice[] replayDevices = this.options.Options.rtvList.ReplayDevices;
                int            length        = replayDevices.Length;
                for (int i = 0; i < length; i++)
                {
                    ReplayDevice re = replayDevices[i];
                    if (fromDevice.Equals(re.friendlyName))
                    {
                        ReplayClient client = new ReplayClient(re);
                        ZoggrLogger.Log(string.Format("Found {0}...", re.friendlyName));
                        num = client.IVSSend(recipientISN, showID, this.rddnsServer);
                        if (num == 1)
                        {
                            ZoggrLogger.Log("Error: Failed to send the show!");
                        }
                        else
                        {
                            ZoggrLogger.Log("Show successfully sent.");
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ZoggrLogger.Log(exception.Message);
            }
            return(num);
        }
예제 #3
0
 public void ManualAdd(string ip_address)
 {
     ZoggrLogger.Log("Attempting to manually add a ReplayTV...");
     try
     {
         ReplayDevice theDevice = new ReplayDevice(ip_address, this.options.Options.allowWiRNS);
         this.options.Options.rtvList.AddDevice(theDevice);
         this.options.SaveConfiguration();
         ZoggrLogger.Log(string.Format("Successfully added ReplayTV at {0}.", ip_address));
     }
     catch (Exception exception)
     {
         ZoggrLogger.Log(exception.Message);
     }
 }
예제 #4
0
        public void RefreshGuides()
        {
            ZoggrLogger.DebugLog("Refreshing guide(s)...");
            ReplayDevice[] replayDevices = this.options.Options.rtvList.ReplayDevices;
            int            length        = replayDevices.Length;

            for (int i = 0; i < length; i++)
            {
                ReplayDevice rd    = replayDevices[i];
                ReplayGuide  guide = new ReplayGuide(rd);
                if (!ZoggrDriver.noGetGuide)
                {
                    guide.GetGuide();
                }
                else
                {
                    ZoggrLogger.DebugLog("noGetGuide");
                }
                bool showHDTV = true;
                guide.SaveGuideAsXML(this.options.Options.shareReceived, showHDTV);
            }
        }
예제 #5
0
        public void UpdateZoggr()
        {
            ZoggrLogger.Log("Updating your show database on Zoggr...");
            ReplayDevice[] replayDevices = this.options.Options.rtvList.ReplayDevices;
            int            length        = replayDevices.Length;

            for (int i = 0; i < length; i++)
            {
                ZoggrLogger.DebugLog("UpdateZoggr loop");
                ReplayDevice rd = replayDevices[i];
                if (!ZoggrDriver.noUpload)
                {
                    string filename = rd.serialNumber + ".xml";
                    int    status   = ZoggrWorker.UploadToZoggr(rd.serialNumber, filename);
                    ZoggrLogger.Log("UploadToZoggr status = {0}", status);
                    if (status == 1)    // if Success
                    {
                        ZoggrWorker.DeleteFile(filename);
                    }
                }
                ZoggrLogger.Log("Upload to Zoggr successful!");
            }
        }