Beispiel #1
0
        public TypeReflector(Type type)
        {
            using (var log = new EnterExitLogger(s_log, Level.Info, "type = {0}", type)) {
                m_type          = type;
                m_fields        = new FieldDict();
                m_methods       = new MethodDict();
                m_staticMethods = new MethodDict();

                var fields = m_type.GetFields(MemberReflector.AllDeclared);
                foreach (var fi in fields)
                {
                    m_fields.Add(fi.Name, new FieldReflector(fi));
                }

                var methods = m_type.GetMethods(MemberReflector.PrivateInstanceDeclared);

                foreach (var mi in methods)
                {
                    m_methods.Add(BuildMethodSignature(mi), new MethodReflector(mi));
                }

                methods = m_type.GetMethods(MemberReflector.AllStaticDeclared);

                foreach (var mi in methods)
                {
                    m_staticMethods.Add(BuildMethodSignature(mi), new MethodReflector(mi));
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Get the index of the field corresponding to the column title fieldName
 /// </summary>
 /// <param name="fieldName">Column title.</param>
 /// <returns>Field index</returns>
 public int GetFieldIndex(string fieldName)
 {
     if (!FieldDict.ContainsKey(fieldName))
     {
         return(-1);
     }
     return(FieldDict[fieldName]);
 }
Beispiel #3
0
 public void Clear()
 {
     Array.Clear(this.ContentArray, 0, this.ContentArray.Length);
     FieldDict.Clear();
     this.CaretRowCol       = null;
     this.HowRead           = null;
     this.FieldNumOdom      = 0;
     this.CurrentFieldKey   = null;
     this.Children          = null;
     this.CurrentChildIndex = null;
     this.Parent            = null;
     this.StartRowCol       = null;
 }
Beispiel #4
0
        public void CreateField(FldDef fldDef)
        {
            IDynaField field = null;

            switch (fldDef.fld_type)
            {
            case 167:     //varchar
                field = new StringField(fldDef.fld_name, DbType.String, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 175:     //char[]->varchar
                field = new StringField(fldDef.fld_name, DbType.StringFixedLength, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 35:     //text
                field = new TextField(fldDef.fld_name, DbType.AnsiString, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 48:     //byte
                field = new ByteField(fldDef.fld_name, DbType.Byte, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 52:     //int16
                field = new Int16Field(fldDef.fld_name, DbType.Int16, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 56:     //int32
                field = new Int32Field(fldDef.fld_name, DbType.Int32, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 40:     //date
                field = new DateField(fldDef.fld_name, DbType.Date, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 61:     //datetime
                field = new DateField(fldDef.fld_name, DbType.DateTime, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;

            case 62:     //double
                field = new DoubleField(fldDef.fld_name, DbType.Double, fldDef.fld_size, fldDef.inp_mask, fldDef.out_mask);
                break;
            }
            if (field != null)
            {
                field.Value = fldDef.def_val;
                FieldDict.Add(fldDef.fld_name, field);
            }
        }
Beispiel #5
0
        public void ReadPropStream(Stream stream, string cmd)
        {
            string key;
            int    i_type;

            // read parameters
            StreamReader.Open(stream);
            while (StreamReader.Read())
            {
                i_type = StreamReader.TokenType();
                if (i_type == 4) // PropName
                {
                    key = StreamReader.Value() as string;
                    StreamReader.Read(); // read Value
                    if (FieldDict.ContainsKey(key))
                    {
                        FieldDict[key].Value = StreamReader.Value();
                    }
                }
            }
            StreamReader.Close();
        }