コード例 #1
0
ファイル: SubscriptionModule.cs プロジェクト: TriAdX/OCTGN
 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);
 }
コード例 #2
0
ファイル: SubscriptionModule.cs プロジェクト: haslo/OCTGN
 public string GetSubscribeUrl(SubType type)
 {
     return AppConfig.WebsitePath;
 }
コード例 #3
0
ファイル: SubscriptionModule.cs プロジェクト: rerbes/OCTGN
 public string GetSubscribeUrl(SubType type)
 {
     return(AppConfig.WebsitePath);
 }
コード例 #4
0
ファイル: SubscriptionModule.cs プロジェクト: TriAdX/OCTGN
        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;
        }