1: public static class Tivo
2: {
3: public static string GetShowList(string TivoAddress, string Password)
4: {
5: return GetFileContents(new Uri("https://" + TivoAddress + "/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying"), "tivo", Password);
6: }
7:
8: private static string GetFileContents(Uri FileName, string UserName, string Password)
9: {
10: WebClient Client = new WebClient();
11: StreamReader Reader = null;
12: try
13: {
14: ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(IgnoreCertErrorsCallback);
15: Client.Credentials = new NetworkCredential(UserName, Password);
16: Reader = new StreamReader(Client.OpenRead(FileName));
17: string Contents = Reader.ReadToEnd();
18: return Contents;
19: }
20: catch
21: {
22: return "";
23: }
24: finally
25: {
26: if (Reader != null)
27: {
28: Reader.Close();
29: }
30: }
31: }
32:
33: private static bool IgnoreCertErrorsCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
34: {
35: return true;
36: }
37: }