示例#1
0
 private static void Add(PARAMDEF.Field key, FieldMetaData meta)
 {
     _FieldMetas.Add(key, meta);
 }
示例#2
0
        public static object PerformOperation(PARAM.Cell cell, string op, string opparam)
        {
            try
            {
                if (op.Equals("ref"))
                {
                    if (cell.Value.GetType() == typeof(int))
                    {
                        foreach (string reftype in FieldMetaData.Get(cell.Def).RefTypes)
                        {
                            PARAM p = ParamBank.Params[reftype];
                            if (p == null)
                            {
                                continue;
                            }
                            foreach (PARAM.Row r in p.Rows)
                            {
                                if (r.Name == null)
                                {
                                    continue;
                                }
                                if (r.Name.Equals(opparam))
                                {
                                    return((int)r.ID);
                                }
                            }
                        }
                    }
                }
                if (op.Equals("="))
                {
                    if (cell.Value.GetType() == typeof(bool))
                    {
                        return(bool.Parse(opparam));
                    }
                    else if (cell.Value.GetType() == typeof(string))
                    {
                        return(opparam);
                    }
                }

                if (cell.Value.GetType() == typeof(long))
                {
                    return(PerformBasicOperation <long>(cell, op, double.Parse(opparam)));
                }
                if (cell.Value.GetType() == typeof(ulong))
                {
                    return(PerformBasicOperation <ulong>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(int))
                {
                    return(PerformBasicOperation <int>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(uint))
                {
                    return(PerformBasicOperation <uint>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(short))
                {
                    return(PerformBasicOperation <short>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(ushort))
                {
                    return(PerformBasicOperation <ushort>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(sbyte))
                {
                    return(PerformBasicOperation <sbyte>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(byte))
                {
                    return(PerformBasicOperation <byte>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(float))
                {
                    return(PerformBasicOperation <float>(cell, op, double.Parse(opparam)));
                }
                else if (cell.Value.GetType() == typeof(double))
                {
                    return(PerformBasicOperation <double>(cell, op, double.Parse(opparam)));
                }
            }
            catch
            {
            }
            return(null);
        }