private void SubscribeEvents(SectionBase sectionBase)
 {
     if (sectionBase is ISectionOpenSectionRequester openSectionRequester)
     {
         openSectionRequester.OnRequestOpenSection += OpenSection;
     }
     if (sectionBase is ISectionHideContextMenuRequester hideContextMenuRequester)
     {
         hideContextMenuRequester.OnRequestContextMenuHide += OnHideContextMenuRequested;
     }
     if (sectionBase is ISectionUpdateSceneDataRequester updateSceneDataRequester)
     {
         updateSceneDataRequester.OnRequestUpdateSceneData += OnUpdateSceneDataRequested;
     }
     if (sectionBase is ISectionUpdateSceneContributorsRequester updateSceneContributorsRequester)
     {
         updateSceneContributorsRequester.OnRequestUpdateSceneContributors += OnUpdateSceneContributorsRequested;
     }
     if (sectionBase is ISectionUpdateSceneAdminsRequester updateSceneAdminsRequester)
     {
         updateSceneAdminsRequester.OnRequestUpdateSceneAdmins += OnUpdateSceneAdminsRequested;
     }
     if (sectionBase is ISectionUpdateSceneBannedUsersRequester updateSceneBannedUsersRequester)
     {
         updateSceneBannedUsersRequester.OnRequestUpdateSceneBannedUsers += OnUpdateSceneBannedUsersRequested;
     }
 }
Exemple #2
0
    SectionBase ISectionFactory.GetSectionController(SectionsController.SectionId id)
    {
        SectionBase result = null;

        switch (id)
        {
        case SectionsController.SectionId.SCENES_MAIN:
            result = new SectionScenesController();
            break;

        case SectionsController.SectionId.SCENES_DEPLOYED:
            break;

        case SectionsController.SectionId.SCENES_PROJECT:
            result = new SectionProjectScenesController();
            break;

        case SectionsController.SectionId.LAND:
            break;

        case SectionsController.SectionId.SETTINGS_PROJECT_GENERAL:
            result = new SectionSceneGeneralSettingsController();
            break;
        }

        return(result);
    }
            public static void AppendParagraph(ICollection <SectionBase> SectionBaseList, string Value)
            {
                XElement Para = new XElement(p);

                Para.Value = Value;

                SectionBase SectionBase = SectionBaseList.LastOrDefault();

                if (SectionBase != null)
                {
                    if (SectionBase is Paragraph oParagraph)
                    {
                        oParagraph._ParagraphCollction.Add(Para);
                    }
                    else
                    {
                        SectionBase.End();
                        Paragraph oParagraph2 = new Paragraph();
                        oParagraph2._Header = null;
                        oParagraph2._ParagraphCollction.Add(Para);
                        SectionBaseList.Add(oParagraph2);
                    }
                }
                else
                {
                    Paragraph oParagraph = new Paragraph();
                    oParagraph._Header = null;
                    oParagraph._ParagraphCollction.Add(Para);
                    SectionBaseList.Add(oParagraph);
                }
            }
        public byte[][] GetFilteredSections()
        {
            List <byte[]> filtered = new List <byte[]>();

            SectionBase s = _Section;

            byte[] f;

            while (s != null)
            {
                if (s.Data == null)
                {
                    break;
                }

                if (Filter(s.Data, 0))
                {
                    f = new byte[s.SectionSize];
                    Array.Copy(s.Data, f, f.Length);
                    filtered.Add(f);
                }
                s = s.NextSection;
            }

            return(filtered.ToArray());
        }
Exemple #5
0
        private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.Section = SectionBase.Create(this.SelectedSection);
            Section.CalculateSecProps();
            Material = new StructuralBase.Material.Steel(210000, 355, 70000);
            Design   = (StructuralBase.Design.Steel.SteelDesign)Section.DesignSection(Material);

            sectionControl = (InputControl)ControlBase.Create(ControlTypes.Input);
            sectionControl.SourceObject  = this.Section;
            sectionControl.InputChanged += Check;
            sectionControl.Settings.UpdateDynamically = true;


            this.SectionInput.Children.Clear();
            this.SectionInput.Children.Add(sectionControl);

            outputControl = (OutputControl)ControlBase.Create(ControlTypes.Output);
            outputControl.SourceObject = this.Section;
            outputControl.Settings.UpdateDynamically = true;

            this.SectionOutput.Children.Clear();
            this.SectionOutput.Children.Add(outputControl);

            sectionControl.InputChanged += new InputControl.InputEventHandler(outputControl.Refresh);


            InputControl designCont = (InputControl)ControlBase.Create(ControlTypes.Input);

            designCont.Settings.UpdateDynamically = true;
            designCont.SourceObject = this.Design;
            this.DesignInput.Children.Clear();
            this.DesignInput.Children.Add(designCont);
            designCont.InputChanged += Check;
        }
        public void SwitchOpenSection()
        {
            SectionBase openSection   = null;
            SectionBase hiddenSection = null;

            void OnSectionOpen(SectionBase section)
            {
                openSection = section;
            }

            void OnSectionHide(SectionBase section)
            {
                hiddenSection = section;
            }

            controller.OnSectionShow += OnSectionOpen;
            controller.OnSectionHide += OnSectionHide;

            controller.OpenSection(SectionsController.SectionId.SCENES_MAIN);

            Assert.IsTrue(sectionFactory_Mock.sectionScenesMain.isVisible);
            Assert.AreEqual(sectionFactory_Mock.sectionScenesMain, openSection);

            controller.OpenSection(SectionsController.SectionId.SCENES_PROJECT);

            Assert.IsFalse(sectionFactory_Mock.sectionScenesMain.isVisible);
            Assert.IsTrue(sectionFactory_Mock.sectionScenesProjects.isVisible);

            Assert.AreEqual(sectionFactory_Mock.sectionScenesProjects, openSection);
            Assert.AreEqual(sectionFactory_Mock.sectionScenesMain, hiddenSection);
        }
            public static void NewParagraph(ICollection <SectionBase> SectionBaseList, string Value, string Heading = null, int HeaderStrength = 1)
            {
                XElement Header = null;

                if (!string.IsNullOrWhiteSpace(Heading))
                {
                    Header       = new XElement(GetHeaderStrength(HeaderStrength), new XAttribute("style", "color: black;"));
                    Header.Value = Heading;
                }

                XElement Para = new XElement(p);

                Para.Value = Value;

                SectionBase SectionBase = SectionBaseList.LastOrDefault();

                if (SectionBase != null)
                {
                    SectionBase.End();
                }
                Paragraph oParagraph = new Paragraph();

                if (Header != null)
                {
                    oParagraph._Header = Header;
                }
                oParagraph._ParagraphCollction.Add(Para);
                SectionBaseList.Add(oParagraph);
            }
Exemple #8
0
        private bool WriteSection(SectionType type, SectionBase section, BinaryWriter bw)
        {
            //Write section type
            bw.Write((byte)type);

            //Reserve space for section length
            long sectLenPos = bw.BaseStream.Position;

            bw.Write(int.MinValue);

            //Write the section
            bool opCompleted = section.WriteSection(bw);

            //Check if something was wrong
            int sectionSize = (int)(bw.BaseStream.Position - sectLenPos - sizeof(int));

            if (!opCompleted || sectionSize == 0)
            {
                return(false);
            }

            //Update section size
            bw.BaseStream.Seek(sectLenPos, SeekOrigin.Begin);
            bw.Write(sectionSize);
            bw.BaseStream.Seek(0, SeekOrigin.End);

            return(true);
        }
Exemple #9
0
        public GridBlockComposite Add(SectionBase rowPart, SectionBase colPart)
        {
            var block = GridBlockSimple.Create(rowPart, colPart);

            _simpleBlocksList.Add(block);

            return(this);
        }
Exemple #10
0
 protected SectionPropertiesBase(SectionBase section)
 {
     Section = section;
     innerList.Add(_keepWithNext);
     innerList.Add(_sectionHeight);
     innerList.Add(_sectionWidth);
     innerList.Add(_onPostSection);
     innerList.Add(_onPreSection);
 }
Exemple #11
0
        public GridBlockComposite Add(SectionsList rowParts, SectionBase colPart)
        {
            var blocksList =
                rowParts
                .Select(rowPart => GridBlockSimple.Create(rowPart, colPart));

            _simpleBlocksList.AddRange(blocksList);

            return(this);
        }
 public static void Write(this SectionBase reportDataItemSection, CSideWriter writer)
 {
     writer.Write("{ ");
     writer.Indent();
     writer.BeginSection("PROPERTIES");
     reportDataItemSection.AllProperties.Where(p => p.HasValue).Write(PropertiesStyle.Object, writer);
     writer.EndSection();
     reportDataItemSection.Controls.Write(writer, 58);
     writer.WriteLine(" }");
     writer.Unindent();
 }
        public DemuxFilter(int number, int pid, byte[] data, byte[] mask, byte[] mode, int timeout, Flags flags)
        {
            _Data  = data;
            _Mask  = mask;
            _Mode  = mode;
            _Flags = flags;
            Pid    = pid;

            Number = number;

            _Section = new SectionBase(pid, _Flags.HasFlag(Flags.CheckCrc));
        }
Exemple #14
0
        private void AddCurrentSection(SectionBase section)
        {
            var act = section as Act;

            if (act != null)
            {
                Act = act;
                return;
            }
            var sequence = section as Sequence;

            if (sequence != null)
            {
                Sequence = sequence;
                return;
            }
            var scene = section as Scene;

            if (scene != null)
            {
                Scene = scene;
                return;
            }
            var moment = section as Moment;

            if (moment != null)
            {
                Moment = moment;
                return;
            }
            var slice = section as Slice;

            if (slice != null)
            {
                Slice = slice;
                return;
            }
            var microSlice = section as MicroSlice;

            if (microSlice != null)
            {
                MicroSlice = microSlice;
                return;
            }
            var nanoSlice = section as NanoSlice;

            if (nanoSlice != null)
            {
                NanoSlice = nanoSlice;
                return;
            }
        }
Exemple #15
0
            public void Read(FileReader reader, PTCL ptcl)
            {
                uint Position = (uint)reader.Position; //Offsets are relative to this

                reader.ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian;
                Signature        = reader.ReadString(4, Encoding.ASCII);

                if (Signature == "EFTB")
                {
                    reader.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;

                    reader.Seek(48, SeekOrigin.Begin);
                }
                else if (Signature == "VFXB")
                {
                    uint padding = reader.ReadUInt32();
                    GraphicsAPIVersion = reader.ReadUInt16();
                    VFXVersion         = reader.ReadUInt16();
                    ByteOrderMark      = reader.ReadUInt16();
                    Alignment          = reader.ReadByte();
                    TargetOffset       = reader.ReadByte();
                    uint HeaderSize = reader.ReadUInt32();
                    Flag        = reader.ReadUInt16();
                    BlockOffset = reader.ReadUInt16();
                    uint padding2 = reader.ReadUInt32();
                    uint FileSize = reader.ReadUInt32();
                    reader.Seek(Position + BlockOffset, SeekOrigin.Begin);
                }
                else
                {
                    throw new Exception("Unknown ptcl format. Signature not valid " + Signature);
                }


                while (reader.Position < reader.BaseStream.Length)
                {
                    SectionBase sectionBase = new SectionBase();
                    sectionBase.Read(reader, this);
                    Sections.Add(sectionBase);
                    ptcl.Nodes.Add(sectionBase);

                    if (sectionBase.NextSectionOffset == NullOffset)
                    {
                        break;
                    }
                }

                MapTextureIDs(ptcl);

                reader.Dispose();
                reader.Close();
            }
Exemple #16
0
            private TreeNodeFile GetMagic(SectionBase section)
            {
                TreeNodeFile node = new TreeNodeFile();

                node.Text = section.Signature;

                foreach (var child in section.ChildSections)
                {
                    node.Nodes.Add(GetMagic(child));
                }

                return(node);
            }
Exemple #17
0
 protected SectionPropertiesBase(SectionBase section)
 {
     Section      = section;
     _sectionType = new ClassicSectionTypeProperty("SectionType", section);
     innerList.Add(_sectionType);
     innerList.Add(_printOnEveryPage);
     innerList.Add(_placeInBottom);
     innerList.Add(_sectionWidth);
     innerList.Add(_sectionHeight);
     innerList.Add(_keepWithNext);
     innerList.Add(_onPreSection);
     innerList.Add(_onPostSection);
 }
        public int CountSections()
        {
            int c = 0;

            SectionBase s = _Section;

            while (s != null)
            {
                c++;
                s = s.NextSection;
            }

            return(c);
        }
        /// <summary>
        /// Sollte nur nach Addpacket verwendet werden.
        /// Setzt letzte unvollständige Section als nächste Section.
        /// Falls Section alle voll wird eine neue gestartet.
        /// </summary>
        public void Reset()
        {
            // prüfen ob letzte Section vollständig oder nicht
            SectionBase last = GetLastSection();

            if (last.Finished)
            {
                _Section = new SectionBase(Pid, _Flags.HasFlag(Flags.CheckCrc));
            }
            else
            {
                _Section = last;
            }
        }
        /// <summary>
        /// Gibt die letzte Section zurück. Sinnvoll um dort weiter fortzufahren,
        /// wenn diese noch nicht abgeschlossen ist.
        /// </summary>
        /// <returns></returns>
        public SectionBase GetLastSection()
        {
            SectionBase s = _Section;

            while (s != null)
            {
                if (s.NextSection == null)
                {
                    return(s);
                }

                s = s.NextSection;
            }

            return(null);
        }
            public static void AppendValuePairList(ICollection <SectionBase> SectionBaseList, string Desciption, string Value)
            {
                XElement SpanDesc = new XElement(span);
                XElement Bold     = new XElement(b);

                SpanDesc.Add(Bold);
                Bold.Value = string.Format("{0}: ", Desciption);
                XElement TableDataDesc = new XElement(td);

                TableDataDesc.Add(SpanDesc);

                XElement SpanValue = new XElement(span);

                SpanValue.Value = Value;

                XElement TableDataValue = new XElement(td);

                TableDataValue.Add(SpanValue);

                XElement TableRow = new XElement(tr);

                TableRow.Add(TableDataDesc);
                TableRow.Add(TableDataValue);

                SectionBase SectionBase = SectionBaseList.LastOrDefault();

                if (SectionBase != null)
                {
                    if (SectionBase is ValuePair oValuePair1)
                    {
                        oValuePair1.ElementList.Add(TableRow);
                    }
                    else
                    {
                        SectionBase.End();
                        ValuePair oValuePair = new ValuePair();
                        oValuePair.ElementList.Add(TableRow);
                        SectionBaseList.Add(oValuePair);
                    }
                }
                else
                {
                    ValuePair oValuePair = new ValuePair();
                    oValuePair.ElementList.Add(TableRow);
                    SectionBaseList.Add(oValuePair);
                }
            }
Exemple #22
0
        private void GetSections_Click(object sender, RoutedEventArgs e)
        {
            Button      btnObj = sender as Button;
            ContextMenu menu   = btnObj.ContextMenu;

            List <SectionBase> sections = new List <SectionBase>();

            foreach (MenuItem group in menu.Items)
            {
                if (group.IsChecked != true)
                {
                    continue;
                }

                string     fileName = group.Header.ToString();
                TextReader reader   = File.OpenText(@"../../SectionProps/" + fileName + ".txt");

                string line;
                int    count = sections.Count;
                while ((line = reader.ReadLine()) != null)
                {
                    SectionBase section = SectionBase.Create(fileName);
                    if (section == null)
                    {
                        section = SectionBase.Create(SectionType.Rectangular);
                    }
                    section.FromString(line);

                    if (sections.Count >= count + 3)
                    {
                        break;
                    }

                    section.GroupName = fileName;

                    if (Model.CheckSection(section))
                    {
                        sections.Add(section);
                    }
                }
            }

            this.SectionsDatagrid.Children.Clear();
            listSections = new ListSections(sections, Model.parameters);
            this.SectionsDatagrid.Children.Add(listSections);
        }
        public SectionBase GetSection(int index)
        {
            int c = 0;

            SectionBase s = _Section;

            while (s != null)
            {
                if (c++ == index)
                {
                    return(s);
                }

                s = s.NextSection;
            }

            return(null);
        }
        public void OpenSection()
        {
            bool        openCallbackCalled = false;
            SectionBase sectionOpened      = null;

            void OnSectionOpen(SectionBase section)
            {
                openCallbackCalled = true;
                sectionOpened      = section;
            }

            controller.OnSectionShow += OnSectionOpen;
            controller.OpenSection(SectionsController.SectionId.SCENES_MAIN);

            Assert.IsTrue(openCallbackCalled);
            Assert.IsTrue(sectionFactory_Mock.sectionScenesMain.isVisible);
            Assert.AreEqual(sectionFactory_Mock.sectionScenesMain, sectionOpened);
        }
        public void setPlan(SectionBase planToDraw)
        {
            Rectangle3d tempBoundingBox = new Rectangle3d(Plane.WorldXY, planToDraw.boundingBox.Min, planToDraw.boundingBox.Max);
            Rectangle   canvasRectangle = new Rectangle();

            canvasRectangle.Width  = typicalPlan.Width;
            canvasRectangle.Height = typicalPlan.Height;

            System.Windows.Point tempOrigin = new System.Windows.Point();
            double tempScaleFactor          = PlanDrawingFunction_90degree.scaleToFitFactor(canvasRectangle, tempBoundingBox, out tempOrigin);

            scaleFactor = tempScaleFactor;
            origin      = tempOrigin;


            foreach (Hatch i in planToDraw.Hatchs)
            {
                PlanDrawingFunction_90degree.drawHatch(tempBoundingBox, i, tempScaleFactor, tempOrigin, System.Windows.Media.Brushes.DimGray, ref this.typicalPlan);
            }

            PlanDrawingFunction_90degree.drawPlan(tempBoundingBox, planToDraw.CoreOutLines, tempScaleFactor, tempOrigin, ref this.typicalPlan, System.Windows.Media.Brushes.Black, 0.1);
            PlanDrawingFunction_90degree.drawPlan(tempBoundingBox, planToDraw.SectionLines, tempScaleFactor, tempOrigin, ref this.typicalPlan, System.Windows.Media.Brushes.Black, 0.2);

            foreach (Text3d i in planToDraw.texts)
            {
                PlanDrawingFunction_90degree.drawText_section(tempBoundingBox, i, tempScaleFactor, tempOrigin, ref this.typicalPlan, 5, System.Windows.Media.Brushes.Black);
            }

            PlanDrawingFunction_90degree.drawDimension(tempBoundingBox, planToDraw.Dimensions, tempScaleFactor, tempOrigin, ref this.typicalPlan);

            foreach (UnitInfo i in planToDraw.Unitinfo)
            {
                PlanDrawingFunction_90degree.drawPlan(tempBoundingBox, i.curves, tempScaleFactor, tempOrigin, ref this.typicalPlan, System.Windows.Media.Brushes.Black, 0.1);

                foreach (Text3d j in i.text)
                {
                    PlanDrawingFunction_90degree.drawText_section(tempBoundingBox, j, tempScaleFactor, tempOrigin, ref this.typicalPlan, 5, System.Windows.Media.Brushes.Black);
                }
            }

            PlanDrawingFunction_90degree.drawPlan(tempBoundingBox, planToDraw.RegsOutput, tempScaleFactor, tempOrigin, ref this.typicalPlan, System.Windows.Media.Brushes.HotPink, 0.4);
        }
            public static void NewTable(ICollection <SectionBase> SectionBaseList, string Heading = null, int HeaderStrength = 1, bool IsHeaderRow = false, params string[] Values)
            {
                XElement Header = null;

                if (!string.IsNullOrWhiteSpace(Heading))
                {
                    Header       = new XElement(GetHeaderStrength(HeaderStrength));
                    Header.Value = Heading;
                }

                XElement Row = new XElement(tr);

                foreach (string Value in Values)
                {
                    XElement Data = null;
                    if (IsHeaderRow)
                    {
                        Data = new XElement(th);
                    }
                    else
                    {
                        Data = new XElement(td);
                    }
                    Data.Value = Value;
                    Row.Add(Data);
                }

                SectionBase SectionBase = SectionBaseList.LastOrDefault();

                if (SectionBase != null)
                {
                    SectionBase.End();
                }
                Table oTable = new Table();

                if (Header != null)
                {
                    oTable._Header = Header;
                }
                oTable._RowCollction.Add(Row);
                SectionBaseList.Add(oTable);
            }
    private void OpenSection(SectionBase section)
    {
        if (currentOpenSection == section)
        {
            return;
        }

        if (currentOpenSection != null)
        {
            currentOpenSection.SetVisible(false);
            OnSectionHide?.Invoke(currentOpenSection);
        }

        currentOpenSection = section;

        if (currentOpenSection != null)
        {
            currentOpenSection.SetVisible(true);
            OnSectionShow?.Invoke(currentOpenSection);
        }
    }
Exemple #28
0
        public FileMutilType Parse(List <Token> tokens, ContextFile fileContext)
        {
            tape               = new TokenTape(tokens, fileContext);
            fileMY             = new FileMutilType();
            fileMY.FileContext = fileContext;

            while (tape.CurrentKind != TokenKind.EOF)
            {
                TokenKind nkind = tape.Next.Kind;
                if (nkind == TokenKind.Colon && tape.CurrentKind == TokenKind.Ident)
                {
                    SectionBase section = ParseSection();
                    if (section != null)
                    {
                        fileMY.AddSection(section);
                    }
                }
                else if (tape.CurrentKind == TokenKind.NewLine)
                {
                    SkipNewLine();
                }
                else
                {
                    SectionProc section = ParseProc();
                    if (section != null)
                    {
                        if (section.NamePart.IsConstructor())
                        {
                            SectionConstructor constructor = new SectionConstructor(section);
                            fileMY.AddSection(constructor);
                        }
                        else
                        {
                            fileMY.AddSection(section);
                        }
                    }
                }
            }
            return(fileMY);
        }
Exemple #29
0
 private void SubscribeEvents(SectionBase sectionBase)
 {
     if (sectionBase is ISectionOpenSectionRequester openSectionRequester)
     {
         openSectionRequester.OnRequestOpenSection += OpenSection;
     }
     if (sectionBase is ISectionHideContextMenuRequester hideContextMenuRequester)
     {
         hideContextMenuRequester.OnRequestContextMenuHide += OnHideContextMenuRequested;
     }
     if (sectionBase is ISectionUpdateSceneDataRequester updateSceneDataRequester)
     {
         updateSceneDataRequester.OnRequestUpdateSceneData += OnUpdateSceneDataRequested;
     }
     if (sectionBase is ISectionUpdateSceneContributorsRequester updateSceneContributorsRequester)
     {
         updateSceneContributorsRequester.OnRequestUpdateSceneContributors += OnUpdateSceneContributorsRequested;
     }
     if (sectionBase is ISectionUpdateSceneAdminsRequester updateSceneAdminsRequester)
     {
         updateSceneAdminsRequester.OnRequestUpdateSceneAdmins += OnUpdateSceneAdminsRequested;
     }
     if (sectionBase is ISectionUpdateSceneBannedUsersRequester updateSceneBannedUsersRequester)
     {
         updateSceneBannedUsersRequester.OnRequestUpdateSceneBannedUsers += OnUpdateSceneBannedUsersRequested;
     }
     if (sectionBase is ISectionOpenURLRequester openURLRequester)
     {
         openURLRequester.OnRequestOpenUrl += OnOpenUrlRequested;
     }
     if (sectionBase is ISectionGotoCoordsRequester goToRequester)
     {
         goToRequester.OnRequestGoToCoords += OnGoToCoordsRequested;
     }
     if (sectionBase is ISectionEditSceneAtCoordsRequester editSceneRequester)
     {
         editSceneRequester.OnRequestEditSceneAtCoords += OnEditSceneAtCoordsRequested;
     }
 }
        SectionBase ISectionFactory.GetSectionController(SectionsController.SectionId id)
        {
            SectionBase result = null;

            switch (id)
            {
            case SectionsController.SectionId.SCENES_MAIN:
                result = sectionScenesMain;
                break;

            case SectionsController.SectionId.SCENES_DEPLOYED:
                break;

            case SectionsController.SectionId.SCENES_PROJECT:
                result = sectionScenesProjects;
                break;

            case SectionsController.SectionId.LAND:
                break;
            }

            return(result);
        }
Exemple #31
0
 private static bool ReadSection(SectionBase sectionBase, int sectionSize, BinaryReader br)
 {
     return sectionBase.ReadSection(br, sectionSize);
 }
Exemple #32
0
        private bool WriteSection(SectionType type, SectionBase section, BinaryWriter bw)
        {
            //Write section type
            bw.Write((byte)type);

            //Reserve space for section length
            long sectLenPos = bw.BaseStream.Position;
            bw.Write(int.MinValue);

            //Write the section
            bool opCompleted = section.WriteSection(bw);

            //Check if something was wrong
            int sectionSize = (int) (bw.BaseStream.Position - sectLenPos - sizeof (int));
            if (!opCompleted || sectionSize == 0)
            {
                return false;
            }

            //Update section size
            bw.BaseStream.Seek(sectLenPos, SeekOrigin.Begin);
            bw.Write(sectionSize);
            bw.BaseStream.Seek(0, SeekOrigin.End);

            return true;
        }