示例#1
0
        public static void GetAccountInfo()
        {
            string   url  = AmiConfiguration.Get().URL_IPTV;
            IPTVData data = IPTVData.Get();
            Uri      uri  = new Uri(AmiConfiguration.Get().URL_IPTV);

            data.HOST = uri.Host;
            data.PORT = uri.Port;
            data.USER = HttpUtility.ParseQueryString(uri.Query).Get("username");
            if (string.IsNullOrEmpty(data.USER))
            {
                data.USER = Strings.UNKNOWN;
            }
            data.MAX_CONECTIONS = "0";
            try
            {
                if (url.Contains("get.php"))
                {
                    url = url.Replace("get.php", "player_api.php");
                    string  result     = GetUrl(url);
                    dynamic dataServer = JsonConvert.DeserializeObject(result);
                    data.EXPIRE_DATE       = UnixToDate(int.Parse(dataServer["user_info"]["exp_date"].Value.ToString()));
                    data.USER              = dataServer["user_info"]["username"].Value.ToString();
                    data.MAX_CONECTIONS    = dataServer["user_info"]["max_connections"].Value.ToString();
                    data.ACTIVE_CONECTIONS = dataServer["user_info"]["active_cons"].Value.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Strings.ACCOUNT_INFO_ERROR, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public static IPTVData Get()
 {
     if (instance == null)
     {
         instance = new IPTVData();
     }
     return(instance);
 }
 private void btnSend_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtTitle.Text))
     {
         MessageBox.Show(Strings.FillReqVOD, Strings.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!String.IsNullOrEmpty(AmiConfiguration.Get().REQ_EMAIL))
     {
         var overview      = "";
         var title         = txtTitle.Text;
         var year          = txtYear.Text;
         var stype         = cmbTypes.SelectedItem.ToString();
         var originalTitle = "";
         var logo          = "https://i.ibb.co/vP1QYdy/No-Cover-Image-01.png";
         if (!chSenAdition.Checked && SEToSend != null)
         {
             overview = SEToSend.SearchData["overview"]?.ToString();
             if (SEToSend.SearchData["poster_path"] != null)
             {
                 logo = Utils.LogoUrl(SEToSend.SearchData["poster_path"].ToString());
             }
             if (stype == Strings.Movie)
             {
                 originalTitle = SEToSend.SearchData["original_title"]?.ToString();
             }
             else
             {
                 originalTitle = SEToSend.SearchData["original_name"]?.ToString();
             }
         }
         string template = File.ReadAllText("./resources/emailtemplate.html");
         template = template.Replace("$$EMAILHEADER$$", Strings.EmailHeader);
         template = template.Replace("$$EMAILTEXT$$", Strings.EmailText);
         template = template.Replace("$$NAMETITLE$$", Strings.FITitle);
         template = template.Replace("$$ONAMETITLE$$", Strings.FIOrigTitle);
         template = template.Replace("$$OVERVIEWTITLE$$", Strings.lbDescriptionTitle);
         template = template.Replace("$$TYPETITLE$$", Strings.Type);
         template = template.Replace("$$YEARTITLE$$", Strings.FIYear);
         template = template.Replace("$$POSTERTITLE$$", Strings.PosterEmail);
         template = template.Replace("$$THANKS$$", Strings.ThanksEmail);
         template = template.Replace("$$USERTITLE$$", Strings.User);
         template = template.Replace("$$NAME$$", title);
         template = template.Replace("$$ONAME$$", originalTitle);
         template = template.Replace("$$OVERVIEW$$", overview);
         template = template.Replace("$$TYPE$$", stype);
         template = template.Replace("$$YEAR$$", year);
         template = template.Replace("$$URL$$", logo);
         template = template.Replace("$$USER$$", IPTVData.Get().USER);
         SendEmail(template);
     }
     else
     {
         MessageBox.Show(Strings.FillReqEmail, Strings.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void PrintValues()
        {
            IPTVData data = IPTVData.Get();

            txtServer.Text    = data.HOST;
            txtUser.Text      = data.USER;
            lbMaxCon.Text     = data.MAX_CONECTIONS;
            lbActiveCons.Text = data.ACTIVE_CONECTIONS;
            lbExp.Text        = data.EXPIRE_DATE.ToString();
        }