예제 #1
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>();
                //}
            }
        }
예제 #2
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>();
                }
            }
        }