Exemplo n.º 1
0
        public LSGSegment(Stream stream)
        {
            GraphElements = new List <BaseDataStructure>();

            while (true)
            {
                var elementHeader = new ElementHeader(stream);

                var objectTypeIdAsString = elementHeader.ObjectTypeID.ToString();

                //if (objectTypeIdAsString == ConstUtils.EndOfElementAsString) goto StartOfPropertyAtoms;
                if (objectTypeIdAsString == ConstUtils.EndOfElementAsString)
                {
                    break;
                }

#if DEBUG
                graphElementHeaders.Add(elementHeader);
#endif

                if (ConstUtils.ObjectTypeIdToType.ContainsKey(objectTypeIdAsString))
                {
                    GraphElements.Add((BaseDataStructure)Activator.CreateInstance(ConstUtils.ObjectTypeIdToType[objectTypeIdAsString].Item1, new object[] { stream }));
                }
                else
                {
                    throw new NotImplementedException(String.Format("Case not defined for Graph Element Object Type {0}", objectTypeIdAsString));
                }
            }

            //StartOfPropertyAtoms:
            PropertyAtomElements = new List <BasePropertyAtomElement>();

            while (true)
            {
                var elementHeader = new ElementHeader(stream);

                var objectTypeIdAsString = elementHeader.ObjectTypeID.ToString();

                //if (objectTypeIdAsString == ConstUtils.EndOfElementAsString) goto StartOfPropertyTable;
                if (objectTypeIdAsString == ConstUtils.EndOfElementAsString)
                {
                    break;
                }

#if DEBUG
                propertyAtomElementHeaders.Add(elementHeader);
#endif

                if (ConstUtils.ObjectTypeIdToType.ContainsKey(objectTypeIdAsString))
                {
                    PropertyAtomElements.Add((BasePropertyAtomElement)Activator.CreateInstance(ConstUtils.ObjectTypeIdToType[objectTypeIdAsString].Item1, new object[] { stream }));
                }
                else
                {
                    throw new NotImplementedException(String.Format("Case not defined for Atom Property Object Type {0}", objectTypeIdAsString));
                }
            }

            //StartOfPropertyTable:

            PropertyTable = new PropertyTable(stream);

#if DEBUG
            Debug.Assert(stream.Length == stream.Position, "End of stream not reached at the end of MetaDataSegment");
#endif

            stream.Dispose();
        }
Exemplo n.º 2
0
 public LSGSegment(List <BaseDataStructure> graphElements, List <BasePropertyAtomElement> propertyAtomElements, PropertyTable propertyTable)
 {
     GraphElements        = graphElements;
     PropertyAtomElements = propertyAtomElements;
     PropertyTable        = propertyTable;
 }