コード例 #1
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
 public void AddParamSyntax(ParamSyntax obj)
 {
     this.Model.Add(obj);
     obj.Project = this;
     obj.Model   = this.Model;//assure l'initialisation (normalement par this.Model.Add)
     if (this.PropertyChanged != null)
     {
         this.PropertyChanged(this, new PropertyChangedEventArgs("ParamSyntax"));
     }
 }
コード例 #2
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
 public void RemoveParamSyntax(ParamSyntax obj)
 {
     obj.Model.Remove(obj);
     obj.Project = null;
     obj.Model   = null;
     if (this.PropertyChanged != null)
     {
         this.PropertyChanged(this, new PropertyChangedEventArgs("ParamSyntax"));
     }
 }
コード例 #3
0
ファイル: ParamSyntax.cs プロジェクト: Ace4teaM/Syntaxi
 // copie
 public ParamSyntax(ParamSyntax src) : this()
 {
     // ContentRegEx
     this.contentregex = src.contentregex;
     // ParamRegEx
     this.paramregex = src.paramregex;
     // ParamType
     this.paramtype = src.paramtype;
     // GroupName
     this.groupname = src.groupname;
 }
コード例 #4
0
ファイル: ParamSyntax.cs プロジェクト: Ace4teaM/Syntaxi
        // clone
        public IEntity Clone()
        {
            ParamSyntax e = new ParamSyntax();

            // ContentRegEx
            e.contentregex = this.contentregex;
            // ParamRegEx
            e.paramregex = this.paramregex;
            // ParamType
            e.paramtype = this.paramtype;
            // GroupName
            e.groupname = this.groupname;
            return(e);
        }
コード例 #5
0
        // copie
        public IEntity Copy(IEntity _dst, IEntity _src)
        {
            ParamSyntax src = _src as ParamSyntax;
            ParamSyntax dst = _dst as ParamSyntax;

            if (src == null || dst == null)
            {
                return(null);
            }

            // ContentRegEx
            dst.contentregex = src.contentregex;
            // ParamRegEx
            dst.paramregex = src.paramregex;
            // ParamType
            dst.paramtype = src.paramtype;
            // GroupName
            dst.groupname = src.groupname;
            return(dst);
        }
コード例 #6
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
        /// <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;
                }
            }
        }
コード例 #7
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
        /// <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>();
                //}
            }
        }
コード例 #8
0
 // copie
 public ParamSyntax(ParamSyntax src) : this()
 {
     Copy(this, src);
 }
コード例 #9
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
        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>();
                }
            }
        }
コード例 #10
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
 public void RemoveParamSyntax(ParamSyntax obj)
 {
     obj.Project = null;
     ParamSyntax.Remove(obj);
 }
コード例 #11
0
ファイル: Project.cs プロジェクト: Ace4teaM/Syntaxi
 public void AddParamSyntax(ParamSyntax obj)
 {
     obj.Project = this;
     ParamSyntax.Add(obj);
 }