Example #1
0
 public string GetSubscribeUrl(SubType type)
 {
     try
     {
         for (var i = 0; i < 4; i++)
         {
             try
             {
                 Log.InfoFormat("Getting subscribe url for {0}", type.Name);
                 var wc      = new WebClient();
                 var callurl = AppConfig.WebsitePath + "api/user/subscribe.php?username="******"&subtype=" + type.Name;
                 Log.InfoFormat("Call url {0}", callurl);
                 var res = wc.DownloadString(callurl).Trim();
                 Log.InfoFormat("Result {0}", res);
                 if (res.Substring(0, 2) == "ok")
                 {
                     var url = res.Substring(3);
                     return(url);
                 }
                 return(null);
             }
             catch (Exception)
             {
                 if (i == 3)
                 {
                     throw;
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Warn("ss", e);
         throw new UserMessageException("Could not subscribe. Please visit " + AppConfig.WebsitePath + " to subscribe.", e);
     }
     return(null);
 }
Example #2
0
 public string GetSubscribeUrl(SubType type)
 {
     return AppConfig.WebsitePath;
 }
Example #3
0
 public string GetSubscribeUrl(SubType type)
 {
     return(AppConfig.WebsitePath);
 }
Example #4
0
        public string GetSubscribeUrl(SubType type)
        {
            try
            {
                for (var i = 0; i < 4; i++)
                {
                    try
                    {
                        Log.InfoFormat("Getting subscribe url for {0}", type.Name);
                        var wc = new WebClient();
                        var callurl = AppConfig.WebsitePath + "api/user/subscribe.php?username="******"&subtype=" + type.Name;
                        Log.InfoFormat("Call url {0}", callurl);
                        var res = wc.DownloadString(callurl).Trim();
                        Log.InfoFormat("Result {0}", res);
                        if (res.Substring(0, 2) == "ok")
                        {
                            var url = res.Substring(3);
                            return url;
                        }
                        return null;

                    }
                    catch (Exception)
                    {
                        if (i == 3) throw;
                    }
                }
            }
            catch (Exception e)
            {
                Log.Warn("ss", e);
                throw new UserMessageException("Could not subscribe. Please visit " + AppConfig.WebsitePath + " to subscribe.",e);
            }
            return null;
        }