예제 #1
0
        public void AutoAdd()
        {
            ZoggrLogger.Log("Attempting to auto-discover all ReplayTVs...");
            SortedList list = null;

            try
            {
                list = ReplayUPnP.DiscoverRTVs(this.options.Options.allowWiRNS);
                ZoggrLogger.DebugLog("Successful auto-discovery of all ReplayTVs...");
            }
            catch (Exception exception)
            {
                ZoggrLogger.Log(exception.Message);
            }
            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    try
                    {
                        this.options.Options.rtvList.AddDevice((ReplayDevice)list.GetByIndex(i));
                    }
                    catch (DuplicateIPException exception2)
                    {
                        ZoggrLogger.Log(exception2.Message);
                    }
                    catch (Exception exception3)
                    {
                        ZoggrLogger.Log(exception3.Message);
                    }
                }
            }
            this.options.SaveConfiguration();
            ZoggrLogger.Log(string.Format("Found {0} ReplayTV{1} on the local area network.", list.Count, (list.Count <= 1) ? "" : "s"));
        }
예제 #2
0
        public string LookupISN(string isn)
        {
            byte[] bytes;
            string text4;
            string plainText  = "isn=" + isn;
            string text2      = ReplayHelper.ByteArrayToHexString(ReplayCrypt.RDDNSEncrypt(plainText)).ToLower();
            string requestUri = string.Format("http://{0}/rd/servlet/gu?q={1}", this.rddnsServer, text2);

            ZoggrLogger.DebugLog("requestUri: " + requestUri);
            try
            {
                bytes = ReplayCrypt.RDDNSDecrypt(HTTPClient.Get(requestUri));
                text4 = Encoding.Default.GetString(bytes);
            }
            catch
            {
                Console.WriteLine("RDDNS Lookup Failed");
                return(null);
            }
            if (text4.IndexOf("ReplayError") >= 0)
            {
                char[]   separator = new char[] { ' ' };
                string[] textArray = text4.Split(separator);
                char[]   trimChars = new char[] { '"' };
                string   text5     = textArray[2].Substring(5).Trim(trimChars);
                char[]   chArray3  = new char[] { '"' };
                string   text6     = textArray[3].Substring(3).Trim(chArray3);
                if (!text5.Equals("SERVER") || !text6.Equals("-1"))
                {
                    return(text4);
                }
                text2      = ReplayHelper.ByteArrayToHexString(ReplayCrypt.RDDNSEncrypt(plainText)).ToLower();
                requestUri = string.Format("http://{0}/rd/servlet/gu?q={1}", this.rddnsServer, text2);
                ZoggrLogger.DebugLog("requestUri: " + requestUri);
                try
                {
                    bytes = ReplayCrypt.RDDNSDecrypt(HTTPClient.Get(requestUri));
                    text4 = Encoding.Default.GetString(bytes);
                }
                catch
                {
                    Console.WriteLine("RDDNS Lookup Failed");
                    return(null);
                }
            }
            return(text4);
        }
예제 #3
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);
            }
        }
예제 #4
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!");
            }
        }
예제 #5
0
 public void Run(bool auto_add, string manual_add, string remove_device, bool offlineMode)
 {
     ZoggrLogger.Log("Starting Zoggr Update...");
     try
     {
         if ((manual_add != null) && (manual_add.Length != 0))
         {
             this.ManualAdd(manual_add);
         }
         if ((remove_device != null) && (remove_device.Length != 0))
         {
             this.Remove(remove_device);
         }
         if (auto_add)
         {
             this.AutoAdd();
         }
         if (!ZoggrDriver.noRefreshGuide)
         {
             this.RefreshGuides();
         }
         else
         {
             ZoggrLogger.DebugLog("noFreshGuide");
         }
         if (!offlineMode)
         {
             this.UpdateZoggr();
         }
     }
     catch (Exception exception)
     {
         ZoggrLogger.Log(exception.Message);
     }
     ZoggrLogger.Log("Finished Zoggr Update!");
 }