private Record createRecord(object[] record, string[] fieldList, bool includeIndex) { Record record2 = null; if (record == null) { return(record2); } int num = includeIndex ? 1 : 0; FwNs.Data.FyleDbNs.Fields fields = null; if (fieldList != null) { fields = new FwNs.Data.FyleDbNs.Fields(fieldList.Length + num); for (int i = 0; i < fieldList.Length; i++) { string fieldName = fieldList[i]; if (fields.ContainsKey(fieldName)) { throw new FileDbException(string.Format("Field name cannot be specified twice in list - {0}", fieldName), FileDbExceptionsEnum.FieldSpecifiedTwice); } fields.Add(this._db.Fields[fieldName]); } } else { fields = new FwNs.Data.FyleDbNs.Fields(this._db.Fields.Count + num); foreach (Field field in this._db.Fields) { fields.Add(field); } } if (includeIndex) { fields.Add(new Field("index", DataTypeEnum.Int, fields.Count)); } return(new Record(fields, record)); }
private T createT <T>(object[] record, string[] fieldList, bool includeIndex) where T : class, new() { T local = default(T); if (record != null) { int num = includeIndex ? 1 : 0; FwNs.Data.FyleDbNs.Fields fields = null; if (fieldList != null) { fields = new FwNs.Data.FyleDbNs.Fields(fieldList.Length + num); for (int j = 0; j < fieldList.Length; j++) { string fieldName = fieldList[j]; if (fields.ContainsKey(fieldName)) { throw new FileDbException(string.Format("Field name cannot be specified twice in list - {0}", fieldName), FileDbExceptionsEnum.FieldSpecifiedTwice); } fields.Add(this._db.Fields[fieldName]); } } else { fields = new FwNs.Data.FyleDbNs.Fields(this._db.Fields.Count + num); foreach (Field field in this._db.Fields) { fields.Add(field); } } if (includeIndex) { fields.Add(new Field("index", DataTypeEnum.Int, fields.Count)); } local = Activator.CreateInstance <T>(); PropertyInfo[] properties = typeof(T).GetProperties(~BindingFlags.Static); new Dictionary <string, PropertyInfo>(properties.Length); for (int i = 0; i < fields.Count; i++) {