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); }
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")); }
public ZoggrUploader() { ZoggrLogger.Log(AppInfo.GetTitle() + " v" + AppInfo.GetVersion() + " - (c) 2008 Zoggr"); ZoggrLogger.LogThanks(); this.options = new ZoggrOptions(); this.options.LoadConfiguration(); }
public static int UploadToZoggr(string serialNumber, string filename) { byte[] data = ZoggrHelper.ReadFile(ZoggrHelper.MakePathAndFile(filename)); string uri = "http://www.zoggr.com/Upload.aspx?sn=" + serialNumber; ZoggrLogger.Log("UploadToZoggr URI: " + uri); return(UploadData(uri, data, serialNumber)); }
public ZoggrSender() { ZoggrLogger.Log(AppInfo.GetTitle() + " v" + AppInfo.GetVersion() + " - (c) 2008 Zoggr"); ZoggrLogger.LogThanks(); this.options = new ZoggrOptions(); this.options.LoadConfiguration(); if (this.options.Options.rddnsip.Length > 0) { this.rddnsServer = this.options.Options.rddnsip; } }
public void Remove(string serial_number) { ZoggrLogger.Log(string.Format("Removing ReplayTV {0}...", serial_number)); try { this.options.Options.rtvList.RemoveDevice(serial_number); this.options.SaveConfiguration(); ZoggrLogger.Log("Successfully removed ReplayTV."); } catch (Exception exception) { ZoggrLogger.Log(exception.Message); } }
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); } }
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); }
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); } }
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!"); } }
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!"); }
private static int Main(string[] args) { bool flag = false; bool offlineMode = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; string text = null; string text2 = null; string pathname = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar.ToString() + "Zoggr"; for (int i = 0; i < args.Length; i++) { string str = args[i]; if (str != null) { str = string.IsInterned(str); if (str == "--auto-add") { flag = true; goto Label_0246; } if (str == "--add") { if ((i + 1) < args.Length) { text = args[++i].Trim(); } goto Label_0246; } if (str == "--remove") { if ((i + 1) < args.Length) { text2 = args[++i].Trim(); } goto Label_0246; } if (str == "--config") { if ((i + 1) < args.Length) { pathname = args[++i].Trim(); } goto Label_0246; } if (str == "--debug") { flag4 = true; goto Label_0246; } if (str == "--console") { flag5 = true; goto Label_0246; } if (str == "--noupdate") { offlineMode = true; goto Label_0246; } if (str == "--version") { Console.WriteLine(AppInfo.GetTitle() + " v" + AppInfo.GetVersion() + " - (c) 2008 Zoggr"); return(0); } if (str == "--usage") { flag3 = true; goto Label_0246; } if (str == "--help") { flag3 = true; goto Label_0246; } if (str == "--norefresh") { noRefreshGuide = true; noUpload = true; goto Label_0246; } if (str == "--norefreshguide") { noRefreshGuide = true; noUpload = true; goto Label_0246; } if (str == "--nogetguide") { noGetGuide = true; noUpload = true; goto Label_0246; } } flag3 = true; Label_0246: if (flag3) { break; } } if (flag3) { Console.Write((((((((AppInfo.GetTitle() + " v" + AppInfo.GetVersion() + " - (c) 2008 Zoggr\n") + "Options:\n") + " --onvacation - Set vacation Mode on\n" + " --novacation - Set vacation Mode off\n") + " --auto-add\n" + " --add <IP>\n") + " --remove <RTV Serial Number>\n" + " --config <dir> - use <dir> instead of ~/.Zoggr\n") + " --noupdate - don't update Zoggr\n" + " --debug\n") + " --console\n" + " --version\n") + " --usage\n" + " --help\n"); return(0); } ZoggrHelper.WorkingDir(pathname); if (!Directory.Exists(ZoggrHelper.WorkingDir())) { Directory.CreateDirectory(ZoggrHelper.WorkingDir()); if (text == null) { flag = true; } } ZoggrLogger.ConsoleMode(flag5); ZoggrLogger.DebugMode(flag4); if (offlineMode) { ZoggrLogger.Log("Working in offline mode"); } new ZoggrUploader().Run(flag, text, text2, offlineMode); return(0); }