示例#1
0
        public object Get(string Property)
        {
            Exception = null;

            CacheItemProperty pi = _ct.Property(Property);

            object res = null;

            if (_ct.Exception == null)
            {
                res = pi.Get(Handle, null);
                if (pi.Exception == null)
                {
                    if (res.GetType().IsArray)
                    {
                        object[,] p = null;
                        ParameterCleaner.Build2DOutput(string.Empty, res, out p);
                        res = p;
                    }
                }
                else
                {
                    Exception = pi.Exception;
                }
            }
            else
            {
                Exception = _ct.Exception;
            }

            return(res);
        }
示例#2
0
        public CacheItemProperty Property(string PropertyName)
        {
            Exception = null;

            CacheItemProperty pi = extractCIP(PropertyName);

            if (pi == null)
            {
                Exception = getE("Property", ExcelName, PropertyName);
            }

            return(pi);
        }
示例#3
0
        public void Set(string Property, object o)
        {
            Exception = null;

            CacheItemProperty pi = _ct.Property(Property);

            if (_ct.Exception == null)
            {
                pi.Set(Handle, o, null);
                Exception = pi.Exception;
            }
            else
            {
                Exception = _ct.Exception;
            }
        }
示例#4
0
        private void loadAllProps()
        {
            if (!_allProp)
            {
                PropertyInfo[] pi = CU.ExcelRegisteredProperties(ItemType);
                if (pi.GetLength(0) != _prop.Count)
                {
                    foreach (PropertyInfo m in pi)
                    {
                        CacheItemProperty c = new CacheItemProperty(m);
                        if (!_prop.ContainsKey(c.ExcelName))
                        {
                            _prop.Add(c.ExcelName, c);
                        }
                    }
                }

                _allProp = true;
            }
        }
示例#5
0
        // private
        #region extract property/method info
        private CacheItemProperty extractCIP(string name)
        {
            CacheItemProperty p = null;

            if (!_prop.ContainsKey(name))
            {
                IEnumerable <PropertyInfo> pi = CU.ExcelRegisteredProperties(ItemType)
                                                .Where(w => new CacheItemProperty(w).ExcelName == name);

                if (pi.Count() > 0)
                {
                    p = new CacheItemProperty(pi.First());
                    _prop.Add(name, p);
                }
            }
            else
            {
                p = _prop[name];
            }

            return(p);
        }
示例#6
0
        public override bool Equals(object obj)
        {
            CacheItemProperty m = obj as CacheItemProperty;

            return(this.ToString().Equals(m.ToString()));
        }