Beispiel #1
0
        public override void UpdateProperties(ICode code)
        {
            IndicatorBase indicatorBase = code as IndicatorBase;
            bool          flag          = indicatorBase == null;

            if (!flag)
            {
                Type type  = base.GetType();
                Type type2 = code.GetType();
                try
                {
                    PropertyInfo[] properties = type.GetProperties();
                    for (int i = 0; i < properties.Length; i++)
                    {
                        PropertyInfo prop  = properties[i];
                        bool         flag2 = this._ignoreUpdateProperties.Any((string p) => p.Equals(prop.Name, StringComparison.OrdinalIgnoreCase));
                        if (!flag2)
                        {
                            object value = type2.GetProperty(prop.Name).GetValue(code, null);
                            bool   flag3 = value != null && prop.GetSetMethod() != null;
                            if (flag3)
                            {
                                bool flag4 = value is ValueType;
                                if (flag4)
                                {
                                    prop.SetValue(this, value, null);
                                }
                                else
                                {
                                    bool flag5 = value is ICloneable;
                                    if (flag5)
                                    {
                                        prop.SetValue(this, ((ICloneable)value).Clone(), null);
                                    }
                                }
                            }
                        }
                    }
                    for (int j = 0; j < Math.Min(indicatorBase.Series.Count, this.Series.Count); j++)
                    {
                        this.Series[j].UpdateProperties(indicatorBase.Series[j]);
                    }
                }
                catch (Exception exception)
                {
                    this.Logger.ErrorException("UpdateProperties", exception);
                }
            }
        }