예제 #1
0
        public BaseException AddData(string key, object obj)
        {
            if (obj == null)
            {
                Data[key] = obj;
                return(this);
            }
            var type = obj.GetType();

            if (ObjectExplorer.IsDirectlyInterpretable(type))
            {
                Data[key] = obj;
            }
            else
            {
                ObjectData[key] = obj;
            }
            return(this);
        }
예제 #2
0
        private bool CheckValue(object value)
        {
            if (value == null)
            {
                // The value is not supposed to be NULL;
                return(false);
            }
            var type = value.GetType();

            if (ObjectExplorer.IsDirectlyInterpretable(type))
            {
                // it can only be directly converted using .ToString()
                return(true);
            }
            if (type == typeof(TranslatableElement))
            {
                // or a translation element
                return(true);
            }
            return(false);
        }
예제 #3
0
        private bool CheckParameters(object[] parameters)
        {
            if (parameters == null)
            {
                // Assign an empty list of parameters (e.g. new oject[]{}), instead of null
                return(false);
            }

            foreach (var parameter in parameters)
            {
                if (parameter == null)
                {
                    // OK: parameter can be null
                    continue;
                }
                if (!ObjectExplorer.IsDirectlyInterpretable(parameter.GetType()))
                {
                    // Use only simple objects as parameters (e.g. strings, ints etc...). They must be serializable!
                    return(false);
                }
            }
            return(true);
        }