Esempio n. 1
0
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static new MaskParameter FromProto(RawProto rp)
        {
            MaskParameter p = new MaskParameter(true);
            string        strVal;

            RawProto rpOption = rp.FindChild("option");

            if (rpOption != null)
            {
                ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption));
            }

            if ((strVal = rp.FindValue("boundary_left")) != null)
            {
                p.boundary_left = int.Parse(strVal);
            }

            if ((strVal = rp.FindValue("boundary_right")) != null)
            {
                p.boundary_right = int.Parse(strVal);
            }

            if ((strVal = rp.FindValue("boundary_top")) != null)
            {
                p.boundary_top = int.Parse(strVal);
            }

            if ((strVal = rp.FindValue("boundary_bottom")) != null)
            {
                p.boundary_bottom = int.Parse(strVal);
            }

            return(p);
        }
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static new DataLabelMappingParameter FromProto(RawProto rp)
        {
            DataLabelMappingParameter p = new DataLabelMappingParameter(true);

            RawProto rpOption = rp.FindChild("option");

            if (rpOption != null)
            {
                ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption));
            }

            p.m_rgMapping = LabelMappingCollection.Parse(rp.FindArray <string>("mapping"));

            return(p);
        }