Esempio n. 1
0
        /// <summary>
        /// Initialise l'instance depuis des données XML
        /// </summary>
        /// <param name="element">Élément contenant les information sur l'objet</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void FromXml(XmlElement element, EntityCallback aggregationCallback)
        {
            foreach (XmlElement m in element.ChildNodes)
            {
                string property_value = m.InnerText.Trim();
                // charge les paramètres
                switch (m.Name)
                {
                //
                // Fields
                //

                // Assigne le membre Name
                case "Name":
                {
                    this.name = property_value;
                }
                break;

                // Assigne le membre Version
                case "Version":
                {
                    this.version = property_value;
                }
                break;

                //
                // Compositions
                //

                // Assigne la collection ObjectContent
                case "ObjectContent":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ObjectContent" == c.Name)
                        {
                            ObjectContent value = new ObjectContent();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddObjectContent(value);
                        }
                    }
                }
                break;

                // Assigne la collection SearchParams
                case "SearchParams":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("SearchParams" == c.Name)
                        {
                            SearchParams value = new SearchParams();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddSearchParams(value);
                        }
                    }
                }
                break;

                // Assigne la collection ObjectSyntax
                case "ObjectSyntax":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ObjectSyntax" == c.Name)
                        {
                            ObjectSyntax value = new ObjectSyntax();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddObjectSyntax(value);
                        }
                    }
                }
                break;

                // Assigne la collection ParamSyntax
                case "ParamSyntax":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ParamSyntax" == c.Name)
                        {
                            ParamSyntax value = new ParamSyntax();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddParamSyntax(value);
                        }
                    }
                }
                break;

                // Assigne la collection DatabaseSource
                case "DatabaseSource":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("DatabaseSource" == c.Name)
                        {
                            DatabaseSource value = new DatabaseSource();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddDatabaseSource(value);
                        }
                    }
                }
                break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initialise l'instance depuis les données d'un flux binaire
        /// </summary>
        /// <param name="reader">Flux binaire</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void ReadBinary(BinaryReader reader, EntityCallback aggregationCallback)
        {
            // Properties
            Name    = reader.ReadString();
            Version = reader.ReadString();

            // ObjectContent
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.ObjectContent = new Collection<ObjectContent>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectContent o = new ObjectContent();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddObjectContent(o);
                    }
                }
                //else
                //{
                //    this.ObjectContent = new Collection<ObjectContent>();
                //}
            }
            // SearchParams
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.SearchParams = new Collection<SearchParams>();
                    for (int i = 0; i < size; i++)
                    {
                        SearchParams o = new SearchParams();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddSearchParams(o);
                    }
                }
                //else
                //{
                //    this.SearchParams = new Collection<SearchParams>();
                //}
            }
            // ObjectSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.ObjectSyntax = new Collection<ObjectSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectSyntax o = new ObjectSyntax();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddObjectSyntax(o);
                    }
                }
                //else
                //{
                //    this.ObjectSyntax = new Collection<ObjectSyntax>();
                //}
            }
            // ParamSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.ParamSyntax = new Collection<ParamSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ParamSyntax o = new ParamSyntax();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddParamSyntax(o);
                    }
                }
                //else
                //{
                //    this.ParamSyntax = new Collection<ParamSyntax>();
                //}
            }
            // DatabaseSource
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.DatabaseSource = new Collection<DatabaseSource>();
                    for (int i = 0; i < size; i++)
                    {
                        DatabaseSource o = new DatabaseSource();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddDatabaseSource(o);
                    }
                }
                //else
                //{
                //    this.DatabaseSource = new Collection<DatabaseSource>();
                //}
            }
        }
Esempio n. 3
0
 // copie
 public ObjectSyntax(ObjectSyntax src) : this()
 {
     Copy(this, src);
 }
Esempio n. 4
0
        public void ReadBinary(BinaryReader reader)
        {
            // Properties
            Name    = reader.ReadString();
            Version = reader.ReadString();

            // ObjectContent
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ObjectContent = new Collection <ObjectContent>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectContent o = new ObjectContent();
                        o.ReadBinary(reader);
                        this.AddObjectContent(o);
                    }
                }
                else
                {
                    this.ObjectContent = new Collection <ObjectContent>();
                }
            }
            // SearchParams
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.SearchParams = new Collection <SearchParams>();
                    for (int i = 0; i < size; i++)
                    {
                        SearchParams o = new SearchParams();
                        o.ReadBinary(reader);
                        this.AddSearchParams(o);
                    }
                }
                else
                {
                    this.SearchParams = new Collection <SearchParams>();
                }
            }
            // ObjectSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ObjectSyntax = new Collection <ObjectSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectSyntax o = new ObjectSyntax();
                        o.ReadBinary(reader);
                        this.AddObjectSyntax(o);
                    }
                }
                else
                {
                    this.ObjectSyntax = new Collection <ObjectSyntax>();
                }
            }
            // ParamSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ParamSyntax = new Collection <ParamSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ParamSyntax o = new ParamSyntax();
                        o.ReadBinary(reader);
                        this.AddParamSyntax(o);
                    }
                }
                else
                {
                    this.ParamSyntax = new Collection <ParamSyntax>();
                }
            }
            // DatabaseSource
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.DatabaseSource = new Collection <DatabaseSource>();
                    for (int i = 0; i < size; i++)
                    {
                        DatabaseSource o = new DatabaseSource();
                        o.ReadBinary(reader);
                        this.AddDatabaseSource(o);
                    }
                }
                else
                {
                    this.DatabaseSource = new Collection <DatabaseSource>();
                }
            }
        }
Esempio n. 5
0
 public void RemoveObjectSyntax(ObjectSyntax obj)
 {
     obj.Project = null;
     ObjectSyntax.Remove(obj);
 }
Esempio n. 6
0
 public void AddObjectSyntax(ObjectSyntax obj)
 {
     obj.Project = this;
     ObjectSyntax.Add(obj);
 }