Пример #1
0
        /// <inheritdoc />
        protected override bool DeserializeItem(XmlReader reader, Version version)
        {
            if (base.DeserializeItem(reader, version))
            {
                return(true);
            }

            switch (reader.Name)
            {
            case "ReferenceProfile":
                ReferenceProfile = FlushGapProfile.Deserialize(reader);
                return(true);

            case "MeasureProfile":
                MeasureProfile = FlushGapProfile.Deserialize(reader);
                return(true);

            case "Flush":
            {
                if (Enum.TryParse <FlushPointConnectionType>(reader.GetAttribute("ConnectionType"), out var connectionType))
                {
                    FlushConnectionType = connectionType;
                }

                FlushValue = Property.ObjectToNullableDouble(reader.ReadString(), CultureInfo.InvariantCulture) ?? 0.0;

                return(true);
            }

            case "Gap":
            {
                if (Enum.TryParse <FlushPointConnectionType>(reader.GetAttribute("ConnectionType"), out var connectionType))
                {
                    GapConnectionType = connectionType;
                }

                GapValue = Property.ObjectToNullableDouble(reader.ReadString(), CultureInfo.InvariantCulture) ?? 0.0;

                return(true);
            }
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// Reads the geometry information to the specified <see cref="XmlWriter" />.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>FlushGapProfile</returns>
        public static FlushGapProfile Deserialize(XmlReader reader)
        {
            var result = new FlushGapProfile();

            if (reader.IsEmptyElement)
            {
                return(result);
            }

            while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                case "Inlet":
                    result.Inlet = DeserializePoint(reader);
                    break;

                case "Outlet":
                    result.Outlet = DeserializePoint(reader);
                    break;

                case "Edge":
                    DeserializePoint(reader);                               //Not used anymore
                    break;

                case "Flush":
                    result.Flush = DeserializePoint(reader);
                    break;

                case "Gap":
                    result.Gap = DeserializePoint(reader);
                    break;
                }
            }

            return(result);
        }