Ejemplo n.º 1
0
        //private ExMethodInfo getExMethod(MethodInfo rmethod)
        //{
        //    //MethodInfo rmethod = method;
        //    /* 非 Abstract 的方法肯定从被映射的类中搜索 */
        //    if (rmethod.IsAbstract)
        //    {
        //        rmethod = searchMethodFromSharp(rmethod);
        //        ExMethodInfo exMethod = ZTypeUtil.CreatExMethodInfo(rmethod, this.SharpType);
        //        return exMethod;
        //    }
        //    else
        //    {
        //        ExMethodInfo exMethod = ZTypeUtil.CreatExMethodInfo(rmethod, this.ZMappingType);
        //        return exMethod;
        //    }
        //}

        private MethodInfo searchMethodFromSharp(MethodInfo method)
        {
            ParameterInfo[] paramArray = method.GetParameters();
            Type[]          types      = new Type[paramArray.Length];
            for (int i = 0; i < paramArray.Length; i++)
            {
                types[i] = paramArray[i].ParameterType;
            }
            MethodInfo rmethod = SharpType.GetMethod(method.Name, types);

            return(rmethod);
        }
        public override void DeserializeFromXML(XmlNode node)
        {
            base.DeserializeFromXML (node);
            double res = 0;
            if (node.Attributes["Curve"] != null)
            {
                if (double.TryParse(node.Attributes["Curve"].Value, NumberStyles.Float, nfi, out res))
                {
                    mCurve = res;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse Curve value");
            }
            if (node.Attributes["Pressure"] != null)
            {
                if (double.TryParse(node.Attributes["Pressure"].Value, NumberStyles.Float, nfi, out res))
                {
                    mPressure = res;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse Pressure value");
            }
            if (node.Attributes["NoiseGate"] != null)
            {
                if (double.TryParse(node.Attributes["NoiseGate"].Value, NumberStyles.Float, nfi, out res))
                {
                    mNoiseGate = res;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse NoiseGate value");
            }
            if (node.Attributes["Contrast"] != null)
            {
                if (double.TryParse(node.Attributes["Contrast"].Value, NumberStyles.Float, nfi, out res))
                {
                    mContrast = res;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse Contrast value");
            }
            if (node.Attributes["EdgePressure"] != null)
            {
                if (double.TryParse(node.Attributes["EdgePressure"].Value, NumberStyles.Float, nfi, out res))
                {
                    mEdgePressure = res;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse EdgePressure value");
            }
            if (node.Attributes["SharpType"] != null)
            {

                if (node.Attributes["SharpType"].Value == "sharp")
                {
                    mType = SharpType.Sharp;
                }
                else if (node.Attributes["SharpType"].Value == "soft")
                {
                    mType = SharpType.Soft;
                }
                else
                    throw new IncorrectNodeValueException("Can't parse SharpType value");
            }
            OnChanged();
        }
        public override void DeserializeFromXML(XmlNode node)
        {
            base.DeserializeFromXML(node);
            double res = 0;

            if (node.Attributes["Curve"] != null)
            {
                if (double.TryParse(node.Attributes["Curve"].Value, NumberStyles.Float, nfi, out res))
                {
                    mCurve = res;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse Curve value");
                }
            }
            if (node.Attributes["Pressure"] != null)
            {
                if (double.TryParse(node.Attributes["Pressure"].Value, NumberStyles.Float, nfi, out res))
                {
                    mPressure = res;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse Pressure value");
                }
            }
            if (node.Attributes["NoiseGate"] != null)
            {
                if (double.TryParse(node.Attributes["NoiseGate"].Value, NumberStyles.Float, nfi, out res))
                {
                    mNoiseGate = res;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse NoiseGate value");
                }
            }
            if (node.Attributes["Contrast"] != null)
            {
                if (double.TryParse(node.Attributes["Contrast"].Value, NumberStyles.Float, nfi, out res))
                {
                    mContrast = res;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse Contrast value");
                }
            }
            if (node.Attributes["EdgePressure"] != null)
            {
                if (double.TryParse(node.Attributes["EdgePressure"].Value, NumberStyles.Float, nfi, out res))
                {
                    mEdgePressure = res;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse EdgePressure value");
                }
            }
            if (node.Attributes["SharpType"] != null)
            {
                if (node.Attributes["SharpType"].Value == "sharp")
                {
                    mType = SharpType.Sharp;
                }
                else if (node.Attributes["SharpType"].Value == "soft")
                {
                    mType = SharpType.Soft;
                }
                else
                {
                    throw new IncorrectNodeValueException("Can't parse SharpType value");
                }
            }
            OnChanged();
        }