Пример #1
0
 private void parentalControlToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(AmiConfiguration.Get().PARENTAL_PASS))
     {
         MessageBox.Show(Strings.FillParentalPass, Strings.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         using (var askForm = new AskPass())
         {
             var result = askForm.ShowDialog();
             if (result == DialogResult.OK)
             {
                 ParentalControlForm pcontrol = new ParentalControlForm();
                 pcontrol.ShowDialog();
             }
         }
     }
 }
Пример #2
0
        private void ChangeChannelTo(ChannelInfo channel, string number)
        {
            if (channel == null)
            {
                MessageBox.Show(Strings.NOT_FOUND_CH + number);
            }
            else
            {
                if (ParentalControl.Get().IsChBlock(channel))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                Logger.Current.Info($"[ChangeChannelTo] Change channel to {channel.TVGName}");
                playerForm.Stop();
                playerForm.SetIsChannel(channel.ChannelType == ChType.CHANNEL);
                playerForm.SetIsPaused(false);
                Thread.Sleep(500);
                currLang = -1;
                currSub  = -1;
                int currPostion = 0;
                if (channel.currentPostion != null && !channel.seen)
                {
                    if (MessageBox.Show(owner: this, Strings.Resume, "AmiIptvPlayer", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        currPostion = (int)channel.currentPostion;
                    }
                    else
                    {
                        channel.currentPostion = null;
                        SeenResumeChannels.Get().RemoveResume(channel.Title);
                        RefreshListView();
                    }
                }
                playerForm.SetMedia(channel.URL, currPostion, currLang, currSub);
                try
                {
                    string        chName = channel.TVGName.Length < 100 ? channel.TVGName : channel.TVGName.Substring(0, 99);
                    Task <string> stats  = Utils.GetAsync("http://amian.es:5085/stats?ctype=connected&app=net&chn=" + chName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR SENDING STATS");
                }

                logoChannel.LoadCompleted -= logoLoaded;

                logoChannel.Image = Image.FromFile("./resources/images/nochannel.png");
                if (!string.IsNullOrEmpty(channel.TVGLogo))
                {
                    logoChannel.LoadAsync(channel.TVGLogo);
                    logoChannel.LoadCompleted += logoLoaded;
                }

                string title = channel.Title;
                if (title.Length > 20)
                {
                    title = title.Substring(0, 20) + "...";
                }
                lbChName.Text = title;
                chnl          = channel;
                currentChType = channel.ChannelType;
                SetEPG(channel);
            }
            playerForm.SetFocusOnVideoPanel();
        }
        private void Ok()
        {
            AmiConfiguration amiconf = AmiConfiguration.Get();
            var encode = Utils.Base64Encode(txtParentalControl.Text);

            if (amiconf.PARENTAL_PASS != encode && !string.IsNullOrEmpty(txtParentalControl.Text))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                amiconf.PARENTAL_PASS = encode;
            }
            if (string.IsNullOrEmpty(txtParentalControl.Text) && !string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }

                amiconf.PARENTAL_PASS = "";
            }
            amiconf.URL_IPTV = "NEW_VERSION";

            /*if (amiconf.URL_IPTV != txtURL.Text)
             * {
             *  amiconf.URL_IPTV = txtURL.Text;
             *  Channels channels = Channels.Get();
             *  channels.SetUrl(txtURL.Text);
             *  channels.SetNeedRefresh(true);
             * }
             * else
             * {
             *  Channels channels = Channels.Get();
             *  channels.SetNeedRefresh(false);
             * }*/
            if (amiconf.REQ_EMAIL != txtRequestEmail.Text)
            {
                amiconf.REQ_EMAIL = txtRequestEmail.Text;
            }

            if (amiconf.URL_EPG != txtEPG.Text)
            {
                amiconf.URL_EPG = txtEPG.Text;
                EPG_DB epgDB = EPG_DB.Get();
                epgDB.Refresh = true;
            }
            if (!amiconf.ENABLE_LOG && chLog.Checked)
            {
                amiconf.ENABLE_LOG = true;
                PrincipalForm.RepaintLabels();
            }
            if (amiconf.ENABLE_LOG && !chLog.Checked)
            {
                amiconf.ENABLE_LOG = false;
                PrincipalForm.RepaintLabels();
            }
            if (!amiconf.AUTOPLAY_EPISODES && chAutoPlayEpisodes.Checked)
            {
                amiconf.AUTOPLAY_EPISODES = true;
                PrincipalForm.RepaintLabels();
            }
            if (amiconf.AUTOPLAY_EPISODES && !chAutoPlayEpisodes.Checked)
            {
                amiconf.AUTOPLAY_EPISODES = false;
                PrincipalForm.RepaintLabels();
                PrincipalForm.HideAutoPlay();
            }
            if (!amiconf.REMOVE_DONATE && chDonate.Checked)
            {
                amiconf.REMOVE_DONATE = true;
                PrincipalForm.RepaintLabels();
            }
            if (amiconf.REMOVE_DONATE && !chDonate.Checked)
            {
                amiconf.REMOVE_DONATE = false;
                PrincipalForm.RepaintLabels();
            }
            if (audio.SelectedItem != null)
            {
                amiconf.DEF_LANG = Utils.GetAudioConfName(audio.SelectedItem.ToString());
            }
            else
            {
                amiconf.DEF_LANG = "spa";
            }
            if (sub.SelectedItem != null)
            {
                amiconf.DEF_SUB = Utils.GetSubConfName(sub.SelectedItem.ToString());
            }
            else
            {
                amiconf.DEF_SUB = "none";
            }

            using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json"))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, amiconf);
            }

            this.Close();
            this.Dispose();
        }
        private void Ok()
        {
            AmiConfiguration amiconf = AmiConfiguration.Get();
            var encode = Utils.Base64Encode(txtParentalControl.Text);

            if (amiconf.PARENTAL_PASS != encode && !string.IsNullOrEmpty(txtParentalControl.Text))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                amiconf.PARENTAL_PASS = encode;
            }
            if (string.IsNullOrEmpty(txtParentalControl.Text) && !string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }

                amiconf.PARENTAL_PASS = "";
            }
            if (amiconf.URL_IPTV != txtURL.Text)
            {
                amiconf.URL_IPTV = txtURL.Text;
                Channels channels = Channels.Get();
                channels.SetUrl(txtURL.Text);
                channels.SetNeedRefresh(true);
            }
            else
            {
                Channels channels = Channels.Get();
                channels.SetNeedRefresh(false);
            }
            if (amiconf.REQ_EMAIL != txtRequestEmail.Text)
            {
                amiconf.REQ_EMAIL = txtRequestEmail.Text;
            }

            if (amiconf.URL_EPG != txtEPG.Text)
            {
                amiconf.URL_EPG = txtEPG.Text;
                EPG_DB epgDB = EPG_DB.Get();
                epgDB.Refresh = true;
            }
            amiconf.DEF_LANG = Utils.GetAudioConfName(audio.SelectedItem.ToString());
            amiconf.DEF_SUB  = Utils.GetSubConfName(sub.SelectedItem.ToString());

            using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json"))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, amiconf);
            }

            this.Close();
            this.Dispose();
        }