Example #1
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            Boolean valid = false;
            if (nFtpHost.Text == "" || !nFtpHost.Text.StartsWith("ftp://"))
                MessageBox.Show("FTP host must be defined like : ftp://myserver/folder/");
            else if (nFtpLogin.Text == "")
                MessageBox.Show("FTP login must be defined");
            else if (nFtpPassword.Text == "")
                MessageBox.Show("FTP password must be defined");
            else
                valid = true;

            int minperiod = 0;
            try
            {
                minperiod = Int32.Parse(nFtpMinPeriod.Text);
            }
            catch
            {
                MessageBox.Show("FTP minperiod must be an Integer");
                valid = false;
            }
            if (valid)
            {
                String host = nFtpHost.Text;
                String login = nFtpLogin.Text;
                String password = nFtpPassword.Text;
                
                FtpAccount f = new FtpAccount();
                f.server = host;
                f.login = login;
                f.password = password;
                f.minperiod = minperiod;

                this.zFtpList.Items.Add(f);
            }
        }
Example #2
0
        public static void load(String filename) 
        {
            if (!File.Exists(filename))
                throw new FileNotFoundException();
            configfile = filename;
            try
            {
                XmlTextReader reader = new XmlTextReader(filename);
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element: // The node is an element.

                            if (reader.Name == "slide")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "src")
                                        CMSConfig.dirslide = reader.Value;

                                }
                            }
                            else if (reader.Name == "template")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "src")
                                        CMSConfig.dirtemplate = reader.Value;

                                }
                            }
                            else if (reader.Name == "watch")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "src")
                                        CMSConfig.dirwatch = reader.Value;

                                }
                            }
                            else if (reader.Name == "input")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "type")
                                        CMSConfig.inputtype = reader.Value;
                                    else if (reader.Name == "httpport")
                                        CMSConfig.httpport = Int32.Parse(reader.Value);
                                    else if (reader.Name == "httpurlseparator")
                                        CMSConfig.httpurlseparator = reader.Value;

                                }

                            }
                            else if (reader.Name == "ftp")
                            {
                                FtpAccount f = new FtpAccount();
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "server")
                                        f.server = reader.Value;
                                    else if (reader.Name == "user")
                                        f.login = reader.Value;
                                    else if (reader.Name == "password")
                                        f.password = reader.Value;
                                    else if (reader.Name == "minperiod")
                                        f.minperiod = Int32.Parse(reader.Value);
                                    else if (reader.Name == "externalprocess")
                                        f.externalProcess = (reader.Value.Equals("yes"));

                                }
                                CMSConfig.ftp.AddLast(f);

                            }

                            else if (reader.Name == "stomp")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "server")
                                        CMSConfig.stompserver = reader.Value;
                                    else if (reader.Name == "port")
                                        CMSConfig.stompport = Int32.Parse(reader.Value);
                                    else if (reader.Name == "login")
                                        CMSConfig.stomplogin = reader.Value;
                                    else if (reader.Name == "passcode")
                                        CMSConfig.stomppasscode = reader.Value;
                                    else if (reader.Name == "httpurl")
                                        CMSConfig.stomphttpurl = reader.Value;
                                }
                            }
                            else if (reader.Name == "topic")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "destination")
                                        CMSConfig.stomptopic.AddLast(reader.Value);
                                }
                            }
                            else if (reader.Name == "playout")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "broadcastdelay")
                                        CMSConfig.broadcastdelay = Int32.Parse(reader.Value);
                                    else if (reader.Name == "slidecartprefix")
                                        CMSConfig.slidecartprefix = reader.Value;
                                }
                            }
                            else if (reader.Name == "radiovis")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "link")
                                        CMSConfig.radiovislink = reader.Value;
                                    else if (reader.Name == "text")
                                        CMSConfig.radiovistxt = reader.Value;
                                }
                            }
                            else if (reader.Name == "image")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "width")
                                        CMSConfig.imagewidth = Int32.Parse(reader.Value);
                                    else if (reader.Name == "height")
                                        CMSConfig.imageheight = Int32.Parse(reader.Value);
                                    else if (reader.Name == "quality")
                                        CMSConfig.imagequality = Int32.Parse(reader.Value);
                                    else if (reader.Name == "ep_quality")
                                        CMSConfig.ep_quality = Int32.Parse(reader.Value);
                                }
                            }
                            else if (reader.Name == "station")
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    if (reader.Name == "image")
                                    {
                                        CMSConfig.stationimage = reader.Value;
                                    }
                                }
                            }
                            break;
                        case XmlNodeType.Text: //Display the text in each element.

                            break;
                        case XmlNodeType.EndElement: //Display the end of the element.

                            break;
                    }
                }


                reader.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: "+e.Message);
            }

            CMSConfig.print();


        }