Esempio n. 1
0
 public CellStatusViewModel(int identifier, EFieldType fieldType, EPieceType pieceType, EPieceColor pieceColor)
 {
     _identifier = identifier;
     _fieldType  = fieldType;
     _pieceType  = pieceType;
     _pieceColor = pieceColor;
 }
Esempio n. 2
0
 public FixedColumn(IRawFile storage, EFieldType fieldType, string propertyName = null)
 {
     _storage     = storage;
     _fieldType   = fieldType;
     _sizeBytes   = fieldType.GetSize();
     PropertyName = propertyName;
 }
Esempio n. 3
0
        private static ColumnSource CreateSolumnSource <T>(EFieldType type, string name, T value, int order)
        {
            ColumnMetadata colMeta;

            switch (type)
            {
            case EFieldType.Byte:
            case EFieldType.Bool:
            case EFieldType.Int16:
            case EFieldType.Int32:
            case EFieldType.Int64:
            case EFieldType.Double:
            case EFieldType.DateTime:
            case EFieldType.DateTimeEpochMs:
                colMeta = ColumnMetadata.FromFixedField(new ColumnSerializerMetadata(type, name, null), order, order);
                break;

            case EFieldType.Symbol:
            case EFieldType.String:
                colMeta = ColumnMetadata.FromStringField(new ColumnSerializerMetadata(type, name, null), 10, 10, order, order);
                break;

            case EFieldType.Binary:
                colMeta = ColumnMetadata.FromBinaryField(new ColumnSerializerMetadata(type, name, null), 10, 10, order, order);
                break;

            default:
                throw new ArgumentOutOfRangeException("type");
            }
            return(new ColumnSource(colMeta, ColumnsStub.CreateColumn(value, type, order, name), order));
        }
Esempio n. 4
0
 public CaomaoExcelFieldData(string name, string type, string fieldValue, object ins, DataSet excel, Assembly assembly)
 {
     this.fieldName  = name;
     this.instance   = ins;
     this.excel      = excel;
     this.assembly   = assembly;
     this.eFieldType = this.GetTypeFromString(type);
     this.fieldValue = fieldValue;
 }
 public RecordSerializerMetadata(EFieldType type, string propertyName,
                                 bool nullable, int columnId, int size = 0)
 {
     ColumnType   = type;
     PropertyName = propertyName;
     Size         = size;
     Nullable     = nullable;
     ColumnId     = columnId;
 }
 public ColumnSerializerMetadata(EFieldType fieldType, string propertyName,
                                 string fieldName, bool nullable = true, int size = 0)
 {
     _columnDataType = JournalColumnRegistry.Instance.GetSerializer(fieldType);
     ColumnType      = _columnDataType.ColumnType;
     PropertyName    = propertyName;
     Size            = size;
     Nullable        = nullable;
     FieldName       = fieldName;
     DataType        = _columnDataType.Clazz;
 }
Esempio n. 7
0
        public void ApplyFrom(DataTable table)
        {
            DataColumn cm = FieldHelper == null ? table.Columns[FieldName] : FieldHelper.GetDataColumn(FieldName);

            if (cm.DataType == typeof(int))
            {
                FieldType = EFieldType.Int;
            }
            else if (cm.DataType == typeof(Int16))
            {
                FieldType = EFieldType.Int16;
            }
            else if (cm.DataType == typeof(Single))
            {
                FieldType = EFieldType.Single;
            }
            else if (cm.DataType == typeof(double))
            {
                FieldType = EFieldType.Double;
            }
            else if (cm.DataType == typeof(decimal))
            {
                FieldType = EFieldType.Decimal;
            }
            else if (cm.DataType == typeof(string))
            {
                FieldType = EFieldType.String;
            }
            else if (cm.DataType == typeof(DateTime))
            {
                FieldType = EFieldType.Date;
            }
            else if (cm.DataType == typeof(bool))
            {
                FieldType = EFieldType.Bool;
            }
            else
            {
                throw new Exception("Bad field type.");
            }

            if (cm.DataType == typeof(string))
            {
                MaxLength = cm.MaxLength;
            }
            else
            {
                MaxLength = 0;
            }

            AllowNull = cm.AllowDBNull;
        }
Esempio n. 8
0
        public static IRawFile RawFile <T>(EFieldType eFieldType, T value)
        {
            var rdrMock = new Mock <IRawFile>();

            rdrMock.Setup(s => s.ReadBool(It.IsAny <long>())).Returns(() => (bool)(object)value);
            rdrMock.Setup(s => s.ReadByte(It.IsAny <long>())).Returns(() => (byte)(object)value);
            rdrMock.Setup(s => s.ReadInt32(It.IsAny <long>())).Returns(() => (int)(object)value);
            rdrMock.Setup(s => s.ReadInt64(It.IsAny <long>())).Returns(() => (long)(object)value);
            rdrMock.Setup(s => s.ReadInt16(It.IsAny <long>())).Returns(() => (short)(object)value);
            rdrMock.Setup(s => s.ReadDouble(It.IsAny <long>())).Returns(() => (double)(object)value);

            return(rdrMock.Object);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            EFieldType fieldType          = (EFieldType)value;
            var        resourceDictionary = new ResourceDictionary();

            resourceDictionary.Source = new Uri("ResourceDictionary.xaml", UriKind.RelativeOrAbsolute);
            switch (fieldType)
            {
            case EFieldType.Dark:
                return(resourceDictionary["ChessBoardDarkSquareColor"]);

            case EFieldType.Light:
                return(resourceDictionary["ChessBoardLightSquareColor"]);
            }
            throw new ArgumentException("Invalid input, could not convert");
        }
Esempio n. 10
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            EFieldType type = (EFieldType)value;

            switch (type)
            {
            case EFieldType.Black:
                return(new SolidColorBrush(Colors.CadetBlue));

            case EFieldType.White:
                return(new SolidColorBrush(Colors.White));

            default:
                throw new ArgumentException("Not supported field type.");
            }
        }
Esempio n. 11
0
 public CustomField(string name, string description, EFieldType type, Guid customFormId, bool mandatory, Guid tenantId)
 {
     Name         = name;
     Description  = description;
     Type         = type;
     CustomFormId = customFormId;
     SetTenantId(tenantId);
     Mandatory = mandatory;
     new Contract()
     .Requires()
     .IsNullOrEmpty(Name, "Name", "O Nome do componente não foi informado.")
     .HasMaxLen(Name, 255, "Name", "O Nome deve ter no máximo 255 caracteres")
     .IsNull(Type, "Type", "O tipo do campo deve ser informado.")
     ;
     Options = new List <CustomFieldOption>();
 }
        public MethodInfo GetSetMethod()
        {
            if (ColumnType == EFieldType.String ||
                ColumnType == EFieldType.Symbol ||
                ColumnType == EFieldType.Binary)
            {
                return(typeof(IRefTypeColumn).GetMethod("SetValue"));
            }
            EFieldType fieldType = ColumnType;

            // DateTimeEpochMs means DateTime field but stored as Epoch Ms but the column is DateTime.
            if (fieldType == EFieldType.DateTimeEpochMs)
            {
                fieldType = EFieldType.DateTime;
            }
            return(typeof(IFixedWidthColumn).GetMethod("Set" + fieldType));
        }
Esempio n. 13
0
        public string Should_Detect_All_Nullable_ColumnTypes(EFieldType fType)
        {
            var ojbType = new
            {
                Bl    = (bool?)true,
                Bt    = (byte?)3,
                Int   = (int?)33,
                Lng   = (long?)430L,
                Dbl   = (double?)34.56,
                Int16 = (Int16?)987
            };

            PocoSerializerFactory             fact = CreatePocoSerializerFactory();
            IList <IColumnSerializerMetadata> cols = fact.Initialize(ojbType.GetType()).ToList();

            return(cols.Single(c => c.ColumnType == fType).PropertyName);
        }
        private void generateCellViewModels(int rows, int cols)
        {
            int id = 0;

            for (int row = 0; row < rows; row++)
            {
                List <ICellStatusViewModel> colList = new List <ICellStatusViewModel>();
                _cells.Add(colList);
                for (int col = 0; col < cols; col++)
                {
                    EFieldType  fieldType  = ((row % 2) + col) % 2 == 0 ? EFieldType.Light : EFieldType.Dark;
                    EPieceType  pieceType  = getPieceType(row, col);
                    EPieceColor pieceColor = getPieceColor(row);
                    colList.Add(new CellStatusViewModel(id, fieldType, pieceType, pieceColor));
                    id++;
                }
            }
        }
Esempio n. 15
0
        public string Should_Detect_All_Column_Types(EFieldType fType)
        {
            var ojbType = new
            {
                Bl    = true,
                Str   = "string",
                Bt    = (byte)3,
                Int   = 33,
                Lng   = 430L,
                Dbl   = 34.56,
                Int16 = (Int16)987
            };

            PocoSerializerFactory             fact = CreatePocoSerializerFactory();
            IList <IColumnSerializerMetadata> cols = fact.Initialize(ojbType.GetType()).ToList();

            return(cols.Single(c => c.ColumnType == fType).PropertyName);
        }
Esempio n. 16
0
        public IColumnDataType GetSerializer(EFieldType fieldType)
        {
            switch (fieldType)
            {
            case EFieldType.Byte:
                return(BYTE);

            case EFieldType.Bool:
                return(BOOL);

            case EFieldType.Int16:
                return(INT16);

            case EFieldType.Int32:
                return(INT32);

            case EFieldType.Int64:
                return(INT64);

            case EFieldType.Double:
                return(DOUBLE);

            case EFieldType.String:
                return(STRING);

            case EFieldType.BitSet:
                return(BITSET);

            case EFieldType.Symbol:
                return(SYMBOL);

            case EFieldType.Binary:
                return(BINARY);

            case EFieldType.DateTime:
                return(DATE_TIME);

            case EFieldType.DateTimeEpochMs:
                return(DATE_TIME_EPOCH_MS);

            default:
                return(_byFieldType[fieldType]);
            }
        }
Esempio n. 17
0
        public DatabaseFieldDescriptor(ref BufferedBinaryReader reader, ParserOptions parserOptions)
        {
            Encoding       = parserOptions.Encoding ?? Encoding.ASCII;
            NumericCulture = parserOptions.InvariantNumbers ? CultureInfo.InvariantCulture : parserOptions.Culture ?? CultureInfo.InvariantCulture;
            DateCulture    = parserOptions.InvariantDates ? CultureInfo.InvariantCulture : parserOptions.Culture ?? CultureInfo.InvariantCulture;

            FieldName      = reader.ReadBytes(11);
            FieldType      = (EFieldType)reader.ReadByte();
            Reserved01     = reader.ReadBytes(4);
            FieldLength    = reader.ReadByte();
            FieldPrecision = reader.ReadByte();
#pragma warning disable 618
            FieldFlags = (EFieldFlags)reader.ReadByte();
#pragma warning restore 618
            Reserved02 = reader.ReadByte();
            WorkAreaId = reader.ReadByte();
            Reserved03 = reader.ReadBytes(10);
            TableFlags = (ETableFlags)reader.ReadByte();
        }
Esempio n. 18
0
        private DIDATuple NewTuple(string[] command)
        {
            List <object> argumentsList = new List <object>();

            int numberOfArguments = command.Length;

            // Start argumentIndex at 1 instead of 0 so the DIDATuple doesn't include the type of command (write, read, take - or other if behaviour was erroneous).
            for (int argumentIndex = 1; argumentIndex < numberOfArguments; argumentIndex++)
            {
                EFieldType fieldType = FieldType.ProcessArgumentType(command[argumentIndex]);

                if (fieldType == EFieldType.NullObject)
                {
                    argumentsList.Add(null);
                }
                else if (fieldType == EFieldType.ObjectConstructor)
                {
                    argumentsList.Add(NewObject(command[argumentIndex]));
                }
                else if (fieldType == EFieldType.ObjectType)
                {
                    argumentsList.Add(NewType(command[argumentIndex]));
                }
                else if (fieldType == EFieldType.Str)
                {
                    if (command[0].Equals("add") && command[argumentIndex].Contains("*"))
                    {
                        throw new ArgumentException("Write primitives can't have wild carded strings.");
                    }
                    else
                    {
                        argumentsList.Add(command[argumentIndex]);
                    }
                }
                else
                {
                    throw new ArgumentException($"Command argument: {command[argumentIndex]} could not be translated. Make sure the input is valid.");
                }
            }

            return(new DIDATuple(argumentsList));
        }
Esempio n. 19
0
        public static bool HasOptions(EFieldType type)
        {
            var verify = false;

            switch (type)
            {
            case EFieldType.ComboBox:
                verify = true;
                break;

            case EFieldType.Radio:
                verify = true;
                break;

            default:
                verify = false;
                break;
            }
            return(verify);
        }
Esempio n. 20
0
        public static string EFieldTypeToString(EFieldType eFieldType)
        {
            string str = string.Empty;

            switch(eFieldType)
            {
                case EFieldType.eFieldText:
                    str = "Text";
                    break;
                case EFieldType.eFieldImage:
                    str = "Image";
                    break;
                case EFieldType.eFieldPath:
                    str = "Path";
                    break;
                default:
                    break;
            }

            return str;
        }
Esempio n. 21
0
    // ========================================================================== //

    /* protected - [Override & Unity API]       */

    private void OnGUI()
    {
        GUIStyle pLabelStyle_Header = new GUIStyle();

        pLabelStyle_Header.normal.textColor = Color.green;

        EditorGUILayout.LabelField("Player & Editor Prefs Editor", pLabelStyle_Header);
        EditorGUILayout.LabelField("Author: RomejanicDev // Editor: Strix");
        EditorGUILayout.Separator();

        _eCurrentZone = (ECurrentZone)EditorGUILayout.EnumPopup("Current Zone", _eCurrentZone);
        if (_pWrapper == null || _pWrapper.eZone != _eCurrentZone)
        {
            switch (_eCurrentZone)
            {
            case ECurrentZone.PlayerPrefs: _pWrapper = new PlayerPrefsWrapper(); break;

            case ECurrentZone.EditorPrefs: _pWrapper = new EditorPrefsWrapper(); break;

            default:
                return;
            }
        }

        EditorGUILayout.HelpBox(_pWrapper.GetSaveDataList().ToString(), MessageType.None);
        EditorGUILayout.Separator();


        _eFieldType  = (EFieldType)EditorGUILayout.EnumPopup("Key Type", _eFieldType);
        _strKey      = EditorGUILayout.TextField("Pref Key", _strKey);
        _strSetValue = EditorGUILayout.TextField("Pref Save Value", _strSetValue);
        EditorGUILayout.LabelField("Pref Get Value", _strGetValue);


        GUILayout.BeginHorizontal();
        {
            if (GUILayout.Button($"Set Key {GetCurrentZone()}"))
            {
                if (_eFieldType == EFieldType.Integer)
                {
                    if (int.TryParse(_strSetValue, out int iResult) == false)
                    {
                        _strError = "Invalid input \"" + _strSetValue + "\"";
                        return;
                    }
                    _pWrapper.SetInt(_strKey, iResult);
                    _strLog = $"Set {_strKey} - {iResult}";
                }
                else if (_eFieldType == EFieldType.Float)
                {
                    if (float.TryParse(_strSetValue, out float fResult) == false)
                    {
                        _strError = "Invalid input \"" + _strSetValue + "\"";
                        return;
                    }
                    _pWrapper.SetFloat(_strKey, fResult);
                    _strLog = $"Set {_strKey} - {fResult}";
                }
                else
                {
                    _pWrapper.SetString(_strKey, _strSetValue);
                    _strLog = $"Set {_strKey} - {_strSetValue}";
                }

                _pWrapper.Save();
                _strError = null;
            }

            if (GUILayout.Button($"Get Key {GetCurrentZone()}"))
            {
                if (_eFieldType == EFieldType.Integer)
                {
                    _strGetValue = _pWrapper.GetInt(_strKey).ToString();
                }
                else if (_eFieldType == EFieldType.Float)
                {
                    _strGetValue = _pWrapper.GetFloat(_strKey).ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    _strGetValue = _pWrapper.GetString(_strKey);
                }

                _strLog = $"Get {_strKey} - {_strGetValue}";
            }
        }
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        {
            if (GUILayout.Button($"Delete Key {GetCurrentZone()}"))
            {
                _pWrapper.DeleteKey(_strKey);
                _pWrapper.Save();
            }

            if (GUILayout.Button($"Delete All Keys {GetCurrentZone()}"))
            {
                _pWrapper.DeleteAll();
                _pWrapper.Save();
            }
        }
        GUILayout.EndHorizontal();


        PrintLog();
    }
Esempio n. 22
0
 public FieldInformation(string fieldName, EFieldType eFieldType)
 {
     FieldName = fieldName;
     FieldType = eFieldType;
     Alignment = EAlignment.eLeft;
 }
 public CellStatusViewModel(int row, int col, EFieldType fieldType)
 {
     _fieldType = fieldType;
     _colIndex  = col;
     _rowIndex  = row;
 }
Esempio n. 24
0
 internal FixedColumnDataType(EFieldType fieldType, Type clazz)
 {
     ColumnType     = fieldType;
     Clazz          = clazz;
     ColumnTypeName = fieldType.ToString();
 }
        /*
         * .method public hidebysig static void  WriteItem(object obj,
         *                                              valuetype [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.ByteArray bitset,
         *                                              class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.IFixedWidthColumn[] fixedCols,
         *                                              int64 rowid,
         *                                              class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.IStringColumn[] stringColumns,
         *                                              class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Tx.ITransactionContext readContext) cil managed
         * {
         * // Code size       126 (0x7e)
         * .maxstack  4
         * .locals init ([0] class Apaf.NFSdb.Tests.Columns.ThriftModel.Quote q)
         * IL_0000:  ldarg.0
         * IL_0001:  castclass  Apaf.NFSdb.Tests.Columns.ThriftModel.Quote
         * IL_0006:  stloc.0
         * IL_0007:  ldarga.s   bitset
         * IL_0009:  ldc.i4.0
         * IL_000a:  ldloc.0
         * IL_000b:  ldflda     valuetype Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::__isset
         * IL_0010:  ldfld      bool Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset::timestamp
         * IL_0015:  ldc.i4.0
         * IL_0016:  ceq
         * IL_0018:  call       instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.ByteArray::Set(int32,
         *                                                                                                bool)
         * IL_001d:  ldarg.2
         * IL_001e:  ldc.i4.0
         * IL_001f:  ldelem.ref
         * IL_0020:  ldarg.3
         * IL_0021:  ldloc.0
         * IL_0022:  callvirt   instance int64 Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::get_Timestamp()
         * IL_0027:  ldarg.s    readContext
         * IL_0029:  callvirt   instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.IFixedWidthColumn::SetInt64(int64,
         *                                                                                                             int64,
         *                                                                                                             class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Tx.ITransactionContext)
         * IL_002e:  ldarga.s   bitset
         * IL_0030:  ldc.i4.1
         * IL_0031:  ldloc.0
         * IL_0032:  ldflda     valuetype Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::__isset
         * IL_0037:  ldfld      bool Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset::bid
         * IL_003c:  ldc.i4.0
         * IL_003d:  ceq
         * IL_003f:  call       instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.ByteArray::Set(int32,
         *                                                                                                bool)
         * IL_0044:  ldarg.2
         * IL_0045:  ldc.i4.1
         * IL_0046:  ldelem.ref
         * IL_0047:  ldarg.3
         * IL_0048:  ldloc.0
         * IL_0049:  callvirt   instance float64 Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::get_Bid()
         * IL_004e:  ldarg.s    readContext
         * IL_0050:  callvirt   instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.IFixedWidthColumn::SetDouble(int64,
         *                                                                                                              float64,
         *                                                                                                              class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Tx.ITransactionContext)
         * IL_0055:  ldarga.s   bitset
         * IL_0057:  ldc.i4.2
         * IL_0058:  ldloc.0
         * IL_0059:  ldflda     valuetype Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::__isset
         * IL_005e:  ldfld      bool Apaf.NFSdb.Tests.Columns.ThriftModel.Quote/Isset::bid
         * IL_0063:  ldc.i4.0
         * IL_0064:  ceq
         * IL_0066:  call       instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.ByteArray::Set(int32,
         *                                                                                                bool)
         * IL_006b:  ldarg.s    stringColumns
         * IL_006d:  ldc.i4.0
         * IL_006e:  ldelem.ref
         * IL_006f:  ldarg.3
         * IL_0070:  ldloc.0
         * IL_0071:  callvirt   instance string Apaf.NFSdb.Tests.Columns.ThriftModel.Quote::get_Mode()
         * IL_0076:  ldarg.s    readContext
         * IL_0078:  callvirt   instance void [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Column.IStringColumn::SetValue(int64,
         *                                                                                                          string,
         *                                                                                                          class [Apaf.NFSdb.Core]Apaf.NFSdb.Core.Tx.ITransactionContext)
         * IL_007d:  ret
         * } // end of method ExpressionTests::WriteItem
         *
         */

        private Action <object, ByteArray, IFixedWidthColumn[], long, IRefTypeColumn[], PartitionTxData> GenerateWriteMethod(IList <ColumnSource> columns)
        {
            var methodSet  = typeof(ByteArray).GetMethod("Set");
            var issetType  = _objectType.GetNestedType("Isset");
            var issetField = _objectType.GetField("__isset");
            var argTypes   = new[]
            {
                typeof(object), typeof(ByteArray), typeof(IFixedWidthColumn[]),
                typeof(long), typeof(IRefTypeColumn[]), typeof(PartitionTxData)
            };
            var methodName     = "WriteFromColumns" + _objectType.Name + METHODS_LABEL;
            var existingMethod = _objectType.GetMethod(methodName);

            if (existingMethod != null)
            {
                return((Action <object, ByteArray, IFixedWidthColumn[], long, IRefTypeColumn[], PartitionTxData>)
                       Delegate.CreateDelegate(
                           typeof(Action <object, ByteArray, IFixedWidthColumn[], long, IRefTypeColumn[], PartitionTxData>), existingMethod));
            }

            var         method = new DynamicMethod(methodName, null, argTypes, _objectType);
            ILGenerator il     = method.GetILGenerator();

            il.DeclareLocal(_objectType);
            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Castclass, _objectType);
            il.Emit(OpCodes.Stloc_0);
            int fci = 0;
            int sci = 0;

            for (int i = 0; i < columns.Count; i++)
            {
                var        column     = columns[i].Metadata;
                var        columnMeta = (IClassColumnSerializerMetadata)column.SerializerMetadata;
                EFieldType fieldType  = columnMeta.ColumnType;
                switch (fieldType)
                {
                case EFieldType.Byte:
                case EFieldType.Bool:
                case EFieldType.Int16:
                case EFieldType.Int32:
                case EFieldType.Int64:
                case EFieldType.Double:
                    il.Emit(OpCodes.Ldarga_S, (byte)1);
                    il.Emit(OpCodes.Ldc_I4, column.NullIndex);
                    il.Emit(OpCodes.Ldloc_0);
                    il.Emit(OpCodes.Ldflda, issetField);
                    il.Emit(OpCodes.Ldfld, GetIssetFieldInfo(issetType, columnMeta));
                    il.Emit(OpCodes.Ldc_I4_0);
                    il.Emit(OpCodes.Ceq);
                    il.Emit(OpCodes.Call, methodSet);

                    il.Emit(OpCodes.Ldarg_2);
                    il.Emit(OpCodes.Ldc_I4, fci);
                    il.Emit(OpCodes.Ldelem_Ref);
                    il.Emit(OpCodes.Ldarg_3);
                    il.Emit(OpCodes.Ldloc_0);
                    il.Emit(OpCodes.Call, _objectType.GetProperty(columnMeta.PropertyName).GetGetMethod());
                    il.Emit(OpCodes.Callvirt, columnMeta.GetSetMethod());

                    fci++;
                    break;

                case EFieldType.String:
                case EFieldType.Symbol:
                    il.Emit(OpCodes.Ldarga_S, (byte)1);
                    il.Emit(OpCodes.Ldc_I4, column.NullIndex);
                    il.Emit(OpCodes.Ldloc_0);
                    il.Emit(OpCodes.Ldflda, issetField);
                    il.Emit(OpCodes.Ldfld, GetIssetFieldInfo(issetType, columnMeta));
                    il.Emit(OpCodes.Ldc_I4_0);
                    il.Emit(OpCodes.Ceq);
                    il.Emit(OpCodes.Call, methodSet);

                    il.Emit(OpCodes.Ldarg_S, (byte)4);
                    il.Emit(OpCodes.Ldc_I4, sci);
                    il.Emit(OpCodes.Ldelem_Ref);
                    il.Emit(OpCodes.Ldarg_3);
                    il.Emit(OpCodes.Ldloc_0);
                    il.Emit(OpCodes.Call, _objectType.GetProperty(columnMeta.PropertyName).GetGetMethod());
                    il.Emit(OpCodes.Ldarg_S, (byte)5);
                    il.Emit(OpCodes.Callvirt, columnMeta.GetSetMethod());

                    sci++;
                    break;

                case EFieldType.BitSet:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            il.Emit(OpCodes.Ret);

            return((Action <object, ByteArray, IFixedWidthColumn[], long, IRefTypeColumn[], PartitionTxData>)
                   method.CreateDelegate(
                       typeof(Action <object, ByteArray, IFixedWidthColumn[], long, IRefTypeColumn[], PartitionTxData>)));
        }
Esempio n. 26
0
        private FixedColumn CreateCol <T>(EFieldType eFieldType, T value)
        {
            var mockStorage = RawFileStub.RawFile(eFieldType, value);

            return(new FixedColumn(mockStorage, eFieldType));
        }
Esempio n. 27
0
 private FixedColumn CreateCol(EFieldType eFieldType)
 {
     _mockStorage = RawFileStub.InMemoryFile();
     return(new FixedColumn(_mockStorage.Object, eFieldType));
 }
Esempio n. 28
0
 private EField(string field, EFieldType type)
 {
     this.field = field;
     this.type  = type;
 }
Esempio n. 29
0
 public static IColumn CreateColumn <T>(T value, EFieldType fieldType, int fieldID, string propertyName = null)
 {
     return(new ColumnStubImpl <T>(value, fieldType, propertyName));
 }
Esempio n. 30
0
 public static bool IsFixedSize(this EFieldType fieldType)
 {
     return(JournalColumnRegistry.Instance.GetSerializer(fieldType).IsFixedSize());
 }
Esempio n. 31
0
 internal static int GetSize(this EFieldType fieldType)
 {
     return(JournalColumnRegistry.Instance.GetSerializer(fieldType).Size);
 }
Esempio n. 32
0
 public ColumnStubImpl(T value, EFieldType ft, string name = null)
 {
     _value       = value;
     FieldType    = ft;
     PropertyName = name;
 }