Exemplo n.º 1
0
        public static List <Station> LeerEstaciones()
        {
            List <Station> estaciones = new List <Station>();

            System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
            var xmlStream = client.GetStreamAsync("http://radioudg.okhosting.com/virtuales.xml").Result;

            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(xmlStream);

            //extraer episodios del xml
            while (reader.ReadToFollowing("estacion"))
            {
                Station estacion = new Station();

                reader.ReadToFollowing("imagen");
                estacion.WebSiteUri = new Uri(reader.ReadElementContentAsString());

                reader.ReadToFollowing("streaming");
                estacion.StramingUri = new Uri(reader.ReadElementContentAsString());

                reader.ReadToFollowing("nombre");
                estacion.Name = reader.ReadElementContentAsString();

                reader.ReadToFollowing("descripcion");
                estacion.Description = reader.ReadElementContentAsString();

                estaciones.Add(estacion);
            }

            reader.Dispose();
            xmlStream.Dispose();
            client.Dispose();

            return(estaciones);
        }
 void IDisposable.Dispose()
 {
     if (reader != null)
     {
         reader.Dispose();
         reader = null;
     }
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (m_reader != null)
     {
         m_reader.Dispose();
     }
     if (m_stream != null)
     {
         m_stream.Dispose();
         m_stream = null;
     }
 }
Exemplo n.º 4
0
        static StackObject *Dispose_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Xml.XmlReader instance_of_this_method = (System.Xml.XmlReader) typeof(System.Xml.XmlReader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Dispose();

            return(__ret);
        }
Exemplo n.º 5
0
        public override void Start()
        {
            base.Start();


            IRelativePanel panel = Platform.Current.Create <IRelativePanel>();

            panel.BackgroundColor = new Color(255, 255, 255, 255);

            IGrid grdMenu = Constantes.CrearMenuVacio();

            panel.Add(grdMenu, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);

            IImageButton imgHome = Platform.Current.Create <IImageButton>();

            imgHome.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images/app-15.png"));
            imgHome.Click += cmdHome_Click;
            grdMenu.SetContent(1, 0, imgHome);

            IImageButton imgRegionales = Platform.Current.Create <IImageButton>();

            imgRegionales.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-11.png"));
            imgRegionales.Click += cmdEstaciones_Click;
            grdMenu.SetContent(1, 1, imgRegionales);

            IImageButton cmdProgramas = Platform.Current.Create <IImageButton>();

            cmdProgramas.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-08.png"));
            //cmdProgramas.Click += (object sender, EventArgs e) => new ProgramasController().Start();
            grdMenu.SetContent(1, 2, cmdProgramas);

            IImageButton imgVirtuales = Platform.Current.Create <IImageButton>();

            imgVirtuales.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-09.png"));
            imgVirtuales.Click += cmdVirtuales_Click;
            grdMenu.SetContent(1, 3, imgVirtuales);

            ILabel lblTitulo = Constantes.CrearTitulo("Archivo de programa", new Color(255, 255, 143, 0));

            panel.Add(lblTitulo, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, grdMenu);

            if (Platform.Current.Page.Width > 250)
            {
                IImage imgLogo = Platform.Current.Create <IImage> ();
                imgLogo.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon2--14.png"));
                imgLogo.Width  = Platform.Current.Page.Width / 6;
                imgLogo.Height = lblTitulo.Height;
                imgLogo.Margin = new Thickness(0, 0, 10, 0);
                panel.Add(imgLogo, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.TopWith, lblTitulo);
            }

            System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
            var xmlStream = client.GetStreamAsync(Show.PodcastUri).Result;

            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(xmlStream);

            IList <Episode> episodios = new List <Episode>();

            //extraer episodios del xml
            while (reader.ReadToFollowing("item"))
            {
                reader.ReadToFollowing("title");
                Episode episodio = new Episode();
                episodio.Name = reader.ReadElementContentAsString();
                reader.ReadToFollowing("link");
                string mp3string = reader.ReadElementContentAsString();
                episodio.EpisodeUri  = new Uri(mp3string);
                episodio.ImagenUri   = Show.LogoUri;
                episodio.Description = Show.Name;

                episodios.Add(episodio);
            }

            reader.Dispose();
            xmlStream.Dispose();
            client.Dispose();

            IControl referencia = lblTitulo;

            foreach (Episode episodio in episodios)
            {
                IImageButton imgLogo = Platform.Current.Create <IImageButton>();
                imgLogo.LoadFromUrl(Show.LogoUri);
                imgLogo.Click += Episode_Click;
                imgLogo.Tag    = episodio;
                imgLogo.Width  = Constantes.AnchoIconos;
                imgLogo.Height = Constantes.AnchoIconos;

                //set margin for first iteration
                if (referencia == lblTitulo)
                {
                    imgLogo.Margin = new Thickness(10, 10, 10, 10);
                }
                else
                {
                    imgLogo.Margin = new Thickness(0, 10, 10, 10);
                }

                panel.Add(imgLogo, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, referencia);

                referencia = imgLogo;

                ILabelButton lblNombre = Platform.Current.Create <ILabelButton> ();
                lblNombre.Click    += Episode_Click;
                lblNombre.Text      = episodio.Name;
                lblNombre.Tag       = episodio;
                lblNombre.Bold      = true;
                lblNombre.FontSize  = Constantes.FontSize2;
                lblNombre.FontColor = Constantes.FontColor2;
                lblNombre.Width     = Platform.Current.Page.Width - (Constantes.AnchoIconos * 3) + 10;
                panel.Add(lblNombre, RelativePanelHorizontalContraint.RightOf, RelativePanelVerticalContraint.TopWith, imgLogo);

                IImageButton imgPlay = Platform.Current.Create <IImageButton>();
                imgPlay.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-20.png"));
                imgPlay.Click += Episode_Click;
                imgPlay.Tag    = episodio;
                imgPlay.Width  = Constantes.AnchoIconos;
                imgPlay.Height = Constantes.AnchoIconos;

                panel.Add(imgPlay, RelativePanelHorizontalContraint.RightOf, RelativePanelVerticalContraint.TopWith, lblNombre);
            }

            Platform.Current.Page.Title   = "Selecciona un episodio";
            Platform.Current.Page.Content = panel;
        }
Exemplo n.º 6
0
        void ReloadTime_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            DateTime startLoad = DateTime.Now;

            System.Xml.XmlDocument mv_schema_xml_temp             = new System.Xml.XmlDocument();
            System.Xml.XmlDocument import_attribute_flow_xml_temp = new System.Xml.XmlDocument();
            System.Data.DataTable  mms_management_agent_temp      = new System.Data.DataTable("mms_metaverse_multivalue");
            System.Data.DataTable  mms_metaverse_temp             = new System.Data.DataTable("mms_metaverse");

            System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings["FIMSynchronizationService"]);
            connection.Open();

            //Load XML schema
            //mv_schema_xml
            System.Data.SqlClient.SqlCommand SqlCommand = new System.Data.SqlClient.SqlCommand("select mv_schema_xml from mms_server_configuration (nolock)", connection);
            System.Xml.XmlReader             XmlReader  = SqlCommand.ExecuteXmlReader();
            mv_schema_xml_temp.Load(XmlReader);
            XmlReader.Dispose();
            SqlCommand.Dispose();

            //import_attribute_flow_xml
            SqlCommand = new System.Data.SqlClient.SqlCommand("select import_attribute_flow_xml from mms_server_configuration (nolock)", connection);
            XmlReader  = SqlCommand.ExecuteXmlReader();
            import_attribute_flow_xml_temp.Load(XmlReader);
            XmlReader.Dispose();
            SqlCommand.Dispose();

            //
            ////Load Tabell schema
            //SqlCommand = new System.Data.SqlClient.SqlCommand("select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'mms_metaverse'", connection);
            //System.Data.DataTable INFORMATION_SCHEMA = new System.Data.DataTable("INFORMATION_SCHEMA");
            //System.Data.SqlClient.SqlDataAdapter DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand);
            //int count = DataAdapter.Fill(INFORMATION_SCHEMA);
            //DataAdapter.Dispose();
            //SqlCommand.Dispose();

            System.Data.SqlClient.SqlDataAdapter DataAdapter;
            int count;

            //Load mms_metaverse attributes
            SqlCommand  = new System.Data.SqlClient.SqlCommand("select top 1 * from mms_metaverse (nolock)", connection);
            DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand);
            count       = DataAdapter.Fill(mms_metaverse_temp);
            DataAdapter.Dispose();
            SqlCommand.Dispose();

            //Load mms_management_agent
            SqlCommand  = new System.Data.SqlClient.SqlCommand("select * from mms_management_agent (nolock)", connection);
            DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand);
            count       = DataAdapter.Fill(mms_management_agent_temp);
            DataAdapter.Dispose();
            SqlCommand.Dispose();

            connection.Close();
            connection.Dispose();

            mv_schema_xml             = mv_schema_xml_temp;
            import_attribute_flow_xml = import_attribute_flow_xml_temp;

            //mms_management_agent
            Dictionary <Guid, LD.IdentityManagement.API.Models.managementagent> Schema_managementagent_temp = new Dictionary <Guid, LD.IdentityManagement.API.Models.managementagent>();

            foreach (DataRow row in mms_management_agent_temp.Rows)
            {
                LD.IdentityManagement.API.Models.managementagent ma = new LD.IdentityManagement.API.Models.managementagent();
                ma.name        = (string)row["ma_name"];
                ma.guid        = (Guid)row["ma_id"];
                ma.description = (string)row["ma_description"];
                ma.type        = (string)row["ma_type"];

                Schema_managementagent_temp.Add(ma.guid, ma);

                //import-flow
                foreach (System.Xml.XmlNodeList flowrule in import_attribute_flow_xml.SelectNodes(string.Format("/import-attribute-flow/import-flow-set/import-flows/import-flow[@src-ma='{0}']", ma.guid)))
                {
                    flowObject temp = new flowObject()
                    {
                        type = "",
                        mvclassobjectname = "",
                        csclassobjectname = "",
                        attribute         = new flowAttribute[0]
                    };
                }
            }

            Schema_managementagent = Schema_managementagent_temp;

            System.Xml.XmlNamespaceManager ns = new System.Xml.XmlNamespaceManager(mv_schema_xml.NameTable);
            ns.AddNamespace("dsml", "http://www.dsml.org/DSML");
            //Create Schema Attributes list
            Dictionary <string, LD.IdentityManagement.API.Models.Attribute> Schema_Attributes_temp         = new Dictionary <string, LD.IdentityManagement.API.Models.Attribute>();
            Dictionary <string, LD.IdentityManagement.API.Models.Attribute> Schema_Private_Attributes_temp = new Dictionary <string, LD.IdentityManagement.API.Models.Attribute>();

            foreach (System.Xml.XmlNode Node in mv_schema_xml.SelectNodes("dsml:dsml/dsml:directory-schema/dsml:attribute-type", ns))
            {
                LD.IdentityManagement.API.Models.Attribute NewAttribute = new LD.IdentityManagement.API.Models.Attribute();
                NewAttribute.name       = Node["dsml:name"].InnerText.ToLower();
                NewAttribute.mulitvalue = Node.Attributes["single-value"] != null ? false : true;
                NewAttribute.indexable  = Node.Attributes["ms-dsml:indexable"] == null || Node.Attributes["ms-dsml:indexable"].Value == "false" ? false : true;
                NewAttribute.indexed    = Node.Attributes["ms-dsml:indexed"] == null || Node.Attributes["ms-dsml:indexed"].Value == "false" ? false : true;
                NewAttribute.syntax     = Node["dsml:syntax"].InnerText;

                //syntax to type
                switch (NewAttribute.syntax)
                {
                case "1.3.6.1.4.1.1466.115.121.1.5":
                    //Binary
                    NewAttribute.type = typeof(byte[]);
                    break;

                case "1.3.6.1.4.1.1466.115.121.1.7":
                    //Boolean
                    NewAttribute.type = typeof(bool);
                    break;

                case "1.3.6.1.4.1.1466.115.121.1.12":
                    //DN (string)
                    NewAttribute.type = typeof(string);
                    break;

                case "1.3.6.1.4.1.1466.115.121.1.15":
                    //DirectoryString
                    NewAttribute.type = typeof(string);
                    break;

                case "1.3.6.1.4.1.1466.115.121.1.27":
                    //Integer
                    NewAttribute.type = typeof(int);
                    break;

                default:
                    //NewAttribute.type = typeof(string);
                    break;
                }

                if (!Schema_private.Contains(NewAttribute.name))
                {
                    if (NewAttribute.mulitvalue || mms_metaverse_temp.Columns.Contains(NewAttribute.name))
                    {
                        //logger.Debug("{0} {1}", NewAttribute.name, NewAttribute.mulitvalue);
                        Schema_Attributes_temp.Add(NewAttribute.name, NewAttribute);
                    }
                }
                else
                {
                    Schema_Private_Attributes_temp.Add(NewAttribute.name, NewAttribute);
                }
            }

            Schema_Attributes         = Schema_Attributes_temp;
            Schema_Private_Attributes = Schema_Private_Attributes_temp;

            //Create Schema Object list
            Dictionary <string, LD.IdentityManagement.API.Models.classobject> Schema_Object_temp = new Dictionary <string, LD.IdentityManagement.API.Models.classobject>();

            foreach (System.Xml.XmlNode Node in mv_schema_xml.SelectNodes("dsml:dsml/dsml:directory-schema/dsml:class", ns))
            {
                LD.IdentityManagement.API.Models.classobject newClassObject = new LD.IdentityManagement.API.Models.classobject();
                newClassObject.name = Node["dsml:name"].InnerText.ToLower();

                List <LD.IdentityManagement.API.Models.objectattribute> ObjectAttributeList = new List <LD.IdentityManagement.API.Models.objectattribute>();
                foreach (System.Xml.XmlNode attributeNodes in Node.SelectNodes("dsml:attribute", ns))
                {
                    LD.IdentityManagement.API.Models.objectattribute NewObjectAttribute = new LD.IdentityManagement.API.Models.objectattribute();
                    NewObjectAttribute.required = attributeNodes.Attributes["required"].Value == "true" ? true : false;
                    LD.IdentityManagement.API.Models.Attribute Attribute;
                    string attname = attributeNodes.Attributes["ref"].Value.Substring(1);
                    if (Schema_Attributes.TryGetValue(attname, out Attribute) || Schema_Private_Attributes.TryGetValue(attname, out Attribute))
                    {
                        NewObjectAttribute.attribute = Attribute;
                        ObjectAttributeList.Add(NewObjectAttribute);
                    }
                }

                newClassObject.objectattributes = ObjectAttributeList.ToArray();
                Schema_Object_temp.Add(newClassObject.name, newClassObject);
            }

            Schema_Object = Schema_Object_temp;

            TimeSpan time = DateTime.Now - startLoad;

            ReloadTime.Enabled = true;
        }