コード例 #1
0
        private string getFieldBaseStringData_Optional(string fieldName, RecordData recordDataIn)
        {
            FieldBase fb = null;

            try
            {
                fb = _recordInfoIn.GetFieldByName(fieldName, true);
            }
            catch
            {
                // For optional fields, return empty string
                return("");
            }

            return(fb.GetAsString(recordDataIn));
        }
コード例 #2
0
ファイル: Compont.cs プロジェクト: antops/TBT
        public void update()
        {
            // 调后台生成场
            TBTfront.Ant ant = new TBTfront.Ant();
            List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();

            list_data.Add(this);
            this.field = new TBTfront.FieldBase();
            ant.clacField(list_data, this.field, this.field);
            // 调后台生成光线
            List <TBTfront.RayLineCluster> rayline_list = new List <TBTfront.RayLineCluster>();
            CalcOption opt = new CalcOption();

            ant.clacLight(list_data, this.rayline_cluster, rayline_list, opt);
            this.rayline_cluster = rayline_list[1];
        }
コード例 #3
0
        private void populateRecordInfoOut()
        {
            _recordInfoOut = new AlteryxRecordInfoNet.RecordInfo();

            // Copy the fieldbase structure of the incoming record
            uint countFields = _recordInfoIn.NumFields();

            for (int i = 0; i < countFields; ++i)
            {
                FieldBase fbIn = _recordInfoIn[i];
                _recordInfoOut.AddField(fbIn.GetFieldName(), fbIn.FieldType, (int)fbIn.Size, fbIn.Scale, fbIn.GetSource(), fbIn.GetDescription());
            }

            // Add the output column at the end
            _recordInfoOut.AddField(_outputField, FieldType.E_FT_String, Constants.OUTPUTFIELDSIZE, 0, "", "");
        }
コード例 #4
0
        /// <summary>
        /// Return a list of the inbound field names from record info in.
        /// </summary>
        /// <returns></returns>
        private IEnumerable <string> getFieldNames()
        {
            List <string> fieldNames  = new List <string>();
            uint          countFields = _recordInfoIn.NumFields();

            for (int i = 0; i < countFields; ++i)
            {
                FieldBase fb = _recordInfoIn[i];
                if (fb != null)
                {
                    string fieldName = fb.GetFieldName();
                }
            }

            return(fieldNames);
        }
コード例 #5
0
ファイル: MapManager.cs プロジェクト: afami1682/LastRecord
    // 参照渡しで受け取ったフィールデータを更新
    public void LoadData(int mapId)
    {
        FieldBase fieldBase = new FieldBase();

        switch (mapId)
        {
        case 1:
            MapData1 mapData1 = gameObject.AddComponent <MapData1>();
            fieldBase = mapData1.getData();
            break;

        default:
            Debug.Log("マップデータが読み込まれてません");
            break;
        }

        // フィールドデータの読み込み
        field        = new Field();
        field.name   = fieldBase.name;
        field.width  = fieldBase.width;
        field.height = fieldBase.height;
        field.cells  = new CellInfo[field.height, field.width];

        // 各セルデータの追加
        for (int y = 0; y < field.height; y++)
        {
            for (int x = 0; x < field.width; x++)
            {
                switch (fieldBase.cells[y, x])
                {
                // name, category, moveCost, defenseBonus, avoidanceBonus, recoveryBonus;
                case 0:
                default:
                    field.cells[y, x] = new CellInfo("平地", 0, 1, 0, 0, 0);
                    break;

                case 1:
                    field.cells[y, x] = new CellInfo("草むら", 0, 2, 10, 0, 0);
                    break;

                case 2:
                    field.cells[y, x] = new CellInfo("壁", 1, 1, 5, 1, 0);
                    break;
                }
            }
        }
    }
コード例 #6
0
        private List <string> getArguments(RecordData recordDataIn)
        {
            string[] arrSelectedCols = new string[0];

            bool bAllColsSelected =
                String.Equals(_selectedCols, Constants.DEFAULTSELECTEDCOLS, StringComparison.OrdinalIgnoreCase);

            if (_selectedCols != Constants.ZEROSELECTEDCOLS && !bAllColsSelected)
            {
                arrSelectedCols = _selectedCols.Split(',');
            }

            List <string> items = new List <string>();

            // loop through the inbound records, build a string
            uint countFields = _recordInfoIn.NumFields();

            for (int i = 0; i < countFields; ++i)
            {
                FieldBase fbIn         = _recordInfoIn[i];
                string    fbColumnName = fbIn.GetFieldName();
                string    fbData       = "";

                // Do not include the executable in the arguments
                if (!(String.Equals(fbColumnName, _exePathField, StringComparison.OrdinalIgnoreCase)))
                {
                    // If the fbColumnName matches a selected column name, include it as a parameter
                    if (bAllColsSelected || arrSelectedCols.Contains(fbColumnName))
                    {
                        try
                        {
                            fbData = fbIn.GetAsString(recordDataIn) ?? "";
                        }
                        catch (NullReferenceException)
                        {
                            // If there is no data, catch and write out an empty string
                            fbData = "";
                        }

                        items.Add(fbData);
                    }
                }
            }

            return(items);
        }
コード例 #7
0
        private void MapToFieldUsingMappingExpressions(Application application, FieldBase field)
        {
            if (Mappings == null)
            {
                return;
            }

            var f = (TField)field;

            foreach (var mapping in Mappings)
            {
                var fieldExpression  = mapping.FieldExpression;
                var applicationValue = mapping.ApplicationExpression.Compile()(application);

                f.SetPropertyValue(fieldExpression, applicationValue);
            }
        }
コード例 #8
0
ファイル: RecordInfo.cs プロジェクト: htaox/EDIHelpers
        private void CreateAssingMethods()
        {
            if (mCreateHandler != null)
            {
                return;
            }

            DynamicMethod dm = new DynamicMethod("_CreateAndAssing_FH_RT_", MethodAttributes.Static | MethodAttributes.Public, CallingConventions.Standard, typeof(object), new Type[] { typeof(object[]) }, mRecordType, true);
            //dm.InitLocals = false;

            ILGenerator generator = dm.GetILGenerator();

            generator.DeclareLocal(mRecordType);
            //generator.DeclareLocal(typeof(object));
            generator.Emit(OpCodes.Newobj, mRecordConstructor);
            generator.Emit(OpCodes.Stloc_0);

            for (int i = 0; i < mFieldCount; i++)
            {
                FieldBase field = mFields[i];

                generator.Emit(OpCodes.Ldloc_0);
                generator.Emit(OpCodes.Ldarg_0);
                generator.Emit(OpCodes.Ldc_I4, i);
                generator.Emit(OpCodes.Ldelem_Ref);


                if (field.mFieldType.IsValueType)
                {
                    generator.Emit(OpCodes.Unbox_Any, field.mFieldType);
                }
                else
                {
                    generator.Emit(OpCodes.Castclass, field.mFieldType);
                }

                generator.Emit(OpCodes.Stfld, field.mFieldInfo);
                //generator.EmitCall();
            }

            // return the value
            generator.Emit(OpCodes.Ldloc_0);
            generator.Emit(OpCodes.Ret);

            mCreateHandler = (CreateAndAssignCallback)dm.CreateDelegate(typeof(CreateAndAssignCallback));
        }
コード例 #9
0
            private bool InitFunc(RecordInfo info)
            {
                this._inputFieldBase = info.GetFieldByName(this.ConfigObject.SortField, false);
                if (this._inputFieldBase == null)
                {
                    return(false);
                }

                this.Output?.Init(FieldDescription.CreateRecordInfo(info));

                // Create the Copier
                this._copier = this.RecordCopierFactory.CreateCopier(info, this.Output?.RecordInfo);

                this._data = new List <Tuple <string, Record> >();

                return(true);
            }
コード例 #10
0
            protected override void OnValueChanged(FieldBase element, int oldValue, int newValue)
            {
                base.OnValueChanged(element, oldValue, newValue);

                //this will trigger another event
                var v = newValue;

                if (v < 0)
                {
                    v = 0;
                }
                v = element.DataType.ValidateDataTypeMax(v);
                if (newValue != v)
                {
                    element.Length = element.DataType.ValidateDataTypeMax(v);
                }
            }
コード例 #11
0
        /// <summary>
        /// Check that once one field is optional all following fields are optional
        /// <para/>
        /// Check that arrays in the middle of a record are of fixed length
        /// </summary>
        /// <param name="resFields">List of fields to extract</param>
        private static void CheckForOptionalAndArrayProblems(List <FieldBase> resFields)
        {
            for (int i = 0; i < resFields.Count; i++)
            {
                var currentField = resFields[i];

                // Dont check the first field
                if (i < 1)
                {
                    continue;
                }

                FieldBase prevField = resFields[i - 1];

                // Check for optional problems.  Previous is optional but current is not
                if (prevField.IsOptional
                    &&
                    currentField.IsOptional == false
                    &&
                    currentField.InNewLine == false)
                {
                    throw new BadUsageException(Messages.Messages.Errors.ExpectingFieldOptional
                                                .FieldName(prevField.FieldInfo.Name)
                                                .Text);
                }

                // Check for an array array in the middle of a record that is not a fixed length
                if (prevField.IsArray)
                {
                    if (prevField.ArrayMinLength == Int32.MinValue)
                    {
                        throw new BadUsageException(Messages.Messages.Errors.MissingFieldArrayLenghtInNotLastField
                                                    .FieldName(prevField.FieldInfo.Name)
                                                    .Text);
                    }

                    if (prevField.ArrayMinLength != prevField.ArrayMaxLength)
                    {
                        throw new BadUsageException(Messages.Messages.Errors.SameMinMaxLengthForArrayNotLastField
                                                    .FieldName(prevField.FieldInfo.Name)
                                                    .Text);
                    }
                }
            }
        }
コード例 #12
0
        /// <summary>
        /// Read field value from a <see cref="RecordData"/> and then parse to a <see cref="TimeSpan"/>.
        /// </summary>
        /// <param name="field">FieldBase describing the field.</param>
        /// <param name="recordData">Row's record data to read.</param>
        /// <returns>Parsed TimeSpan or NULL.</returns>
        public static TimeSpan?GetAsTimeSpan(this FieldBase field, RecordData recordData)
        {
            var text = field.GetAsString(recordData);

            if (string.IsNullOrWhiteSpace(text))
            {
                return(null);
            }

            DateTime output;

            if (!DateTime.TryParse($"1900-01-01 {text}", out output))
            {
                return(null);
            }

            return(output.TimeOfDay);
        }
コード例 #13
0
 protected void valueChanged(ChangeEventArgs e, FieldBase field)
 {
     if (field.Key == "country")
     {
         var fld = Tab.Fields.Where(x => x.Key == "state").FirstOrDefault();
         if (fld != null)
         {
             if (e.Value.ToString() == "CA")
             {
                 fld.LookUp = "canadastates";
             }
             else
             {
                 fld.LookUp = "usastates";
             }
         }
     }
 }
コード例 #14
0
            private bool InitFunc(RecordInfo info)
            {
                this._nextValue = this.ConfigObject.CreateRandomFunc();

                var fieldDescription = this.ConfigObject.OutputType.OutputDescription(this.ConfigObject.OutputFieldName, 19);

                if (fieldDescription == null)
                {
                    return(false);
                }
                fieldDescription.Source      = nameof(RandomNumber);
                fieldDescription.Description = $"Random Number {this.ConfigObject.ToString().Replace($"{this.ConfigObject.OutputFieldName}=", "")}";

                this.Output?.Init(FieldDescription.CreateRecordInfo(info, fieldDescription));
                this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

                return(true);
            }
コード例 #15
0
        /// <summary>
        /// Read field value from a <see cref="RecordData"/> and then parse to a <see cref="DateTime"/>.
        /// </summary>
        /// <param name="field">FieldBase describing the field.</param>
        /// <param name="recordData">Row's record data to read.</param>
        /// <returns>Parsed DateTime or NULL.</returns>
        public static DateTime?GetAsDateTime(this FieldBase field, RecordData recordData)
        {
            var text = field.GetAsString(recordData);

            if (string.IsNullOrWhiteSpace(text))
            {
                return(null);
            }

            DateTime output;

            if (!DateTime.TryParse(text, out output))
            {
                return(null);
            }

            return(output);
        }
コード例 #16
0
            protected override void OnValueChanged(FieldBase element, DataTypeConstants oldValue, DataTypeConstants newValue)
            {
                try
                {
                    base.OnValueChanged(element, oldValue, newValue);

                    if (element.Entity != null && element.Entity.nHydrateModel != null)
                    {
                        if (!element.Entity.nHydrateModel.IsLoading)
                        {
                            element.Length = newValue.GetDefaultSize(element.Length);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
コード例 #17
0
ファイル: PacketsRegistry.cs プロジェクト: GitTraner/Daemon
        public void Register(string packetId, FieldBase declaration)
        {
            var flags = PacketsRegistry.GetPacketFlags(packetId);
            var id    = PacketsRegistry.ParsePacketId(packetId);

            var count = 0;

            foreach (var flag in flags)
            {
                count++;
                PacketsDeclaration[GetKey(flag, id)] = declaration;
            }

            if (count == 0)
            {
                PacketsDeclaration[GetKey('i', id)] = declaration;
                PacketsDeclaration[GetKey('o', id)] = declaration;
            }
        }
コード例 #18
0
        public void CreateParameter(params string[] FieldNames)
        {
            Dictionary <string, FieldBase> Item = CreateItemFields();

            foreach (string fieldname in FieldNames)
            {
                FieldBase Field = GetFieldByName(Item, fieldname);
                string    alias = GetFieldAlias(Item, fieldname);
                if (Field != null)
                {
                    switch (Field.FieldType)
                    {
                    case FieldType.Boolean:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new BooleanParameter(), true, true, true, true));
                        break;

                    case FieldType.Date:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new DateParameter(), true, true, true, true));
                        break;

                    case FieldType.Decimal:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new DecimalParameter(), true, true, true, true));
                        break;

                    case FieldType.Integer:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new IntegerParameter(), true, true, true, true));
                        break;

                    case FieldType.Long:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new LongParameter(), true, true, true, true));
                        break;

                    case FieldType.Text:
                        Parameters.Add(alias, new ParameterStruct(fieldname, new TextParameter(), true, true, true, true));
                        break;

                    default:
                        break;
                    }
                }
            }
        }
コード例 #19
0
 private void VisitInputField(
     ISet <string> visitedFields,
     FieldBase <IInputType> field,
     ObjectFieldNode fieldValue)
 {
     if (visitedFields.Add(field.Name))
     {
         if (fieldValue.Value is ObjectValueNode ov &&
             field.Type.NamedType() is InputObjectType it)
         {
             VisitObjectValue(it, ov);
         }
     }
     else
     {
         Errors.Add(new ValidationError(
                        $"Field `{field.Name}` is ambiguous.",
                        fieldValue));
     }
 }
コード例 #20
0
    public FieldBase getData()
    {
        FieldBase fieldBase = new FieldBase();

        fieldBase.name   = "マップ1";
        fieldBase.width  = 40;
        fieldBase.height = 30;
        fieldBase.cells  = new int[, ] {
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
        };
        return(fieldBase);
    }
コード例 #21
0
        private void pushRecord(
            Int32 xCoord, Int32 yCoord,
            Int32 rValue, Int32 gValue, Int32 bValue,
            Int32 alphaValue, RecordData recordDataIn)
        {
            Record recordOut = _recordInfoOut.CreateRecord();

            recordOut.Reset();

            _recordCopier.Copy(recordOut, recordDataIn);

            var outFieldCount        = _recordInfoOut.NumFields();
            int indexXCoordField     = (int)outFieldCount - 6;
            int indexYCoordField     = (int)outFieldCount - 5;
            int indexRValueField     = (int)outFieldCount - 4;
            int indexGValueField     = (int)outFieldCount - 3;
            int indexBValueField     = (int)outFieldCount - 2;
            int indexAlphaValueField = (int)outFieldCount - 1;

            // RValue Field
            FieldBase fieldBase = _recordInfoOut[indexXCoordField];

            fieldBase.SetFromInt32(recordOut, xCoord);
            // RValue Field
            fieldBase = _recordInfoOut[indexYCoordField];
            fieldBase.SetFromInt32(recordOut, yCoord);
            // RValue Field
            fieldBase = _recordInfoOut[indexRValueField];
            fieldBase.SetFromInt32(recordOut, rValue);
            // GValue Field
            fieldBase = _recordInfoOut[indexGValueField];
            fieldBase.SetFromInt32(recordOut, gValue);
            // RValue Field
            fieldBase = _recordInfoOut[indexBValueField];
            fieldBase.SetFromInt32(recordOut, bValue);
            // AlphaValue Field
            fieldBase = _recordInfoOut[indexAlphaValueField];
            fieldBase.SetFromInt32(recordOut, alphaValue);

            _outputHelper.PushRecord(recordOut.GetRecord());
        }
コード例 #22
0
            private bool InitFunc(RecordInfo info)
            {
                this._inputFieldBase = info.GetFieldByName(this.ConfigObject.InputFieldName, false);
                if (this._inputFieldBase == null)
                {
                    return(false);
                }

                this.Output.Init(
                    FieldDescription.CreateRecordInfo(
                        info,
                        new FieldDescription(this.ConfigObject.OutputFieldName, FieldType.E_FT_V_String)
                {
                    Size = 256, Source = nameof(HashCodeGenerator)
                }));
                this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName];

                this._hashAlgorithm = this.ConfigObject.GetAlgorithm();

                return(true);
            }
コード例 #23
0
        /// <summary>
        /// Efetua o select no banco de acordo com o filtro
        /// </summary>
        public List <GeneralDataProviderItem> SelectAllItems(bool retList)
        {
            DataSet ds = SelectAllItems();
            List <GeneralDataProviderItem> List = new List <GeneralDataProviderItem>();

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    GeneralDataProviderItem itm = BasePage.GetDataProviderItem(this);
                    foreach (string Key in Item.Fields.Keys)
                    {
                        FieldBase Field     = itm.Fields[Key];
                        string    FieldName = Field.Name;
                        string    format    = (itm.Fields[Key].FieldType == FieldType.Date ? Select.DateFormat : "");
                        itm.Fields[Key].SetValue(dr[FieldName], format);
                    }
                    List.Add(itm);
                }
            }
            return(List);
        }
コード例 #24
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            var field = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                FieldType.E_FT_V_String,
                256,
                source: nameof(HashCodeGeneratorEngine));

            this.Output.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, field));
            this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName];

            this._hashAlgorithm = this.GetAlgorithm();

            args.Success = true;
        }
コード例 #25
0
        private string GetDefaultValue(ITypeDescriptorContext context)
        {
            object instance;
            FlexDesignerHostServices services;

            if (!Util.EditableModelHelper.GetInstanceAndServices(context, out instance, out services))
            {
                return(s_Default);
            }
            FieldBase field = instance as FieldBase;

            if (field != null)
            {
                return(s_Default + " (" + field.ParentReport.ActualRightToLeft.ToString() + ")");
            }
            C1FlexReport report = instance as C1FlexReport;

            if (report != null)
            {
                return(s_Default + " (" + C1FlexReport.DefaultRightToLeft.ToString() + ")");
            }
            return(s_Default);
        }
コード例 #26
0
            private bool InitFunc(RecordInfo info)
            {
                this._inputReader = this.ConfigObject.InputPointReader(info);
                if (this._inputReader == null)
                {
                    return(false);
                }

                this.Output?.Init(FieldDescription.CreateRecordInfo(
                                      info,
                                      new FieldDescription(this.ConfigObject.OutputBinXFieldName, FieldType.E_FT_Double)
                {
                    Source = nameof(HexBin), Description = "X Co-ordinate of HexBin Centre"
                },
                                      new FieldDescription(this.ConfigObject.OutputBinYFieldName, FieldType.E_FT_Double)
                {
                    Source = nameof(HexBin), Description = "Y Co-ordinate of HexBin Centre"
                }));
                this._outputBinXFieldBase = this.Output?[this.ConfigObject.OutputBinXFieldName];
                this._outputBinYFieldBase = this.Output?[this.ConfigObject.OutputBinYFieldName];

                return(true);
            }
コード例 #27
0
        private void pushRecord(string path, string value, RecordData recordDataIn)
        {
            Record recordOut = _recordInfoOut.CreateRecord();

            recordOut.Reset();

            _recordCopier.Copy(recordOut, recordDataIn);

            var outFieldCount   = _recordInfoOut.NumFields();
            int indexPathField  = (int)outFieldCount - 2;
            int indexValueField = (int)outFieldCount - 1;

            // Path Field
            FieldBase fieldBase = _recordInfoOut[indexPathField];

            fieldBase.SetFromString(recordOut, path);

            // Value Field
            fieldBase = _recordInfoOut[indexValueField];
            fieldBase.SetFromString(recordOut, value);

            _outputHelper.PushRecord(recordOut.GetRecord());
        }
コード例 #28
0
        private void populateRecordInfoOut()
        {
            _recordInfoOut = new AlteryxRecordInfoNet.RecordInfo();

            // Copy the fieldbase structure of the incoming record
            uint countFields = _recordInfoIn.NumFields();

            for (int i = 0; i < countFields; ++i)
            {
                FieldBase fbIn             = _recordInfoIn[i];
                var       currentFieldName = fbIn.GetFieldName();

                // Do not include the source data (selectedField) in the output
                if (!String.Equals(currentFieldName, _selectedField, StringComparison.OrdinalIgnoreCase))
                {
                    _recordInfoOut.AddField(currentFieldName, fbIn.FieldType, (int)fbIn.Size, fbIn.Scale, fbIn.GetSource(), fbIn.GetDescription());
                }
            }

            // Add the output columns at the end
            _recordInfoOut.AddField("Path", FieldType.E_FT_V_WString, Constants.LARGEOUTPUTFIELDSIZE, 0, "", ""); // Empty strings are source and description
            _recordInfoOut.AddField("Value", FieldType.E_FT_V_WString, Constants.LARGEOUTPUTFIELDSIZE, 0, "", "");
        }
コード例 #29
0
        public bool II_Init(RecordInfo recordInfo)
        {
            _info         = new RecordInfo();
            _incomingInfo = recordInfo;
            _copier       = new RecordCopier(_info, _incomingInfo, false);
            for (var i = 0; i < _incomingInfo.NumFields(); i++)
            {
                _info.AddField(_incomingInfo[i]);
                _copier.Add(i, i);
            }
            _copier.DoneAdding();
            _info.AddField(_parent.NewField, FieldType.E_FT_Int64);
            _newField = _info.GetFieldByName(_parent.NewField, false);

            _fields = new FieldBase[_parent.Fields.Length];
            for (var i = 0; i < _fields.Length; i++)
            {
                _fields[i] = _incomingInfo.GetFieldByName(_parent.Fields[i], false);
            }

            _record = _info.CreateRecord();
            _parent.Output.Init(_info, "Output", null, _parent.Config);
            return(true);
        }
コード例 #30
0
            /// <summary>
            /// Create Formatter <see cref="Func{TResult}"/> Delegate
            /// </summary>
            /// <param name="inputFieldBase"></param>
            /// <returns></returns>
            public Func <RecordData, string> CreateFormatter(FieldBase inputFieldBase)
            {
                var format  = this.FormatString;
                var culture = CultureTypeConverter.GetCulture(this.Culture);

                if (string.IsNullOrWhiteSpace(format))
                {
                    return(inputFieldBase.GetAsString);
                }

                switch (inputFieldBase.FieldType)
                {
                case FieldType.E_FT_Bool:
                    return(r => inputFieldBase.GetAsBool(r)?.ToString(culture));

                case FieldType.E_FT_Byte:
                case FieldType.E_FT_Int16:
                case FieldType.E_FT_Int32:
                case FieldType.E_FT_Int64:
                    return(r => inputFieldBase.GetAsInt64(r)?.ToString(format, culture));

                case FieldType.E_FT_Float:
                case FieldType.E_FT_Double:
                case FieldType.E_FT_FixedDecimal:
                    return(r => inputFieldBase.GetAsDouble(r)?.ToString(format, culture));

                case FieldType.E_FT_Date:
                case FieldType.E_FT_DateTime:
                    return(r => inputFieldBase.GetAsDateTime(r)?.ToString(format, culture));

                case FieldType.E_FT_Time:
                    return(r => inputFieldBase.GetAsTimeSpan(r)?.ToString(format, culture));
                }

                return(null);
            }
コード例 #31
0
 virtual public void AddField(FieldBase field) {
     ifd[field.GetTag()] = field;
 }
コード例 #32
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, int oldValue, int newValue)
            {
                base.OnValueChanged(element, oldValue, newValue);

                //this will trigger another event
                if (newValue < 0) element.Scale = 0;
            }
コード例 #33
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, bool oldValue, bool newValue)
            {
                base.OnValueChanged(element, oldValue, newValue);

                try
                {
                    if (element.Entity != null && element.Entity.nHydrateModel != null && !element.Entity.nHydrateModel.IsLoading)
                    {
                        //Processes Index list
                        if (newValue) //element.IsIndexed //Must use real property since there is logic there
                        {
                            //Add an Asc single field index
                            var existing = element.Entity.Indexes.FirstOrDefault(x => x.IndexColumns.Count == 1 && x.IndexColumns.First().FieldID == element.Id && x.IndexColumns.First().Ascending && x.IndexType == IndexTypeConstants.IsIndexed);
                            if (existing == null)
                            {
                                using (var transaction = element.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                                {
                                    var newIndex = new Index(element.Partition);
                                    newIndex.ParentEntityID = element.Entity.Id;
                                    newIndex.IndexType = IndexTypeConstants.IsIndexed;
                                    newIndex.Clustered = false;
                                    element.Entity.Indexes.Add(newIndex);

                                    var newColumn = new IndexColumn(element.Partition);
                                    newColumn.FieldID = element.Id;
                                    newColumn.IsInternal = true;
                                    newIndex.IndexColumns.Add(newColumn);

                                    transaction.Commit();
                                }
                            }
                        }
                        else //Remove Index
                        {
                            var existingList = element.Entity.Indexes
                                .Where(x => x.IndexType == IndexTypeConstants.IsIndexed && x.IndexColumns.Count == 1 && x.IndexColumns.First().FieldID == element.Id && x.IndexType == IndexTypeConstants.IsIndexed)
                                .ToList();

                            using (var transaction = element.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                            {
                                while (existingList.Count > 0)
                                {
                                    var item = existingList.First();
                                    item.IndexType = IndexTypeConstants.User;
                                    element.Entity.Indexes.Remove(item);
                                    existingList.Remove(item);
                                }
                                transaction.Commit();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }

            }
コード例 #34
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, string oldValue, string newValue)
            {
                //If not laoding then parse the name for the data type
                var hasChanged = false;
                if (element.Entity != null && !element.Entity.nHydrateModel.IsLoading)
                {
                    if (!string.IsNullOrEmpty(newValue))
                    {
                        var arr = newValue.Split(':');
                        if (arr.Length == 2)
                        {
                            var typearr = arr[1].Split(' ');
                            var d = Extensions.GetDataTypeFromName(typearr[0]);
                            if (d != null)
                            {
                                if (typearr.Length == 2)
                                {
                                    int len;
                                    if (int.TryParse(typearr[1], out len))
                                    {
                                        element.DataType = d.Value;
                                        element.Length = len;
                                        newValue = arr[0];
                                        hasChanged = true;
                                    }
                                    else
                                    {
                                        throw new Exception("Unrecognized data type! Valid format is 'Name:Datatype length'");
                                    }
                                }
                                else
                                {
                                    element.DataType = d.Value;
                                    newValue = arr[0];
                                    hasChanged = true;
                                }

                            }
                            else
                            {
                                throw new Exception("Unrecognized data type! Valid format is 'Name:Datatype length'");
                            }
                        }
                    }
                }

                base.OnValueChanged(element, oldValue, newValue);

                //Reset after we set datatype
                if (hasChanged)
                    element.Name = newValue;
                else
                    base.OnValueChanged(element, oldValue, newValue);
            }
コード例 #35
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, bool oldValue, bool newValue)
            {
                base.OnValueChanged(element, oldValue, newValue);

                try
                {
                    //Do not process if we are already doing something
                    //if (element.Store.TransactionManager.CurrentTransaction != null)
                    //{
                    //  if (element.Store.TransactionManager.CurrentTransaction.HasPendingChanges) return;
                    //}

                    if (element.Entity != null && element.Entity.nHydrateModel != null && !element.Entity.nHydrateModel.IsLoading)
                    {
                        //Processes Index list
                        if (element.IsPrimaryKey) //Must use real property since there is logic there
                        {
                            //This is a PK so determine if there is a key for this and add this field to a new or the existing index
                            var existing = element.Entity.Indexes.FirstOrDefault(x => x.IndexType == IndexTypeConstants.PrimaryKey);
                            if (existing == null)
                            {
                                //The PK index does not exist so create one
                                using (var transaction = element.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                                {
                                    var newIndex = new Index(element.Partition);
                                    newIndex.ParentEntityID = element.Entity.Id;
                                    newIndex.Clustered = true;
                                    element.Entity.Indexes.Add(newIndex);

                                    var newColumn = new IndexColumn(element.Partition);
                                    newColumn.FieldID = element.Id;
                                    newIndex.IndexColumns.Add(newColumn);
                                    newColumn.IsInternal = true;

                                    newIndex.IndexType = IndexTypeConstants.PrimaryKey; //Do this last

                                    //If use modules then add the PK to all modules that contain this entity
                                    if (element.Entity.nHydrateModel.UseModules)
                                    {
                                        foreach (var module in element.Modules)
                                        {
                                            element.Entity.nHydrateModel.IndexModules.Add(new IndexModule(element.Entity.nHydrateModel.Partition) { IndexID = newIndex.Id, ModuleId = module.Id });
                                        }
                                    }

                                    transaction.Commit();
                                }
                            }
                            else
                            {
                                //The PK does exist so add this field to it
                                using (var transaction = element.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                                {
                                    if (existing.IndexColumns.Count(x => x.FieldID == element.Id) == 0)
                                    {
                                        existing.IndexType = IndexTypeConstants.User;
                                        var newColumn = new IndexColumn(element.Partition);
                                        newColumn.FieldID = element.Id;
                                        newColumn.IsInternal = true;
                                        existing.IndexColumns.Add(newColumn);

                                        //Just in case there are invalid fields
                                        existing.IndexColumns.Remove(x => x.GetField() == null);

                                        existing.IndexType = IndexTypeConstants.PrimaryKey; //Do this last
                                        transaction.Commit();
                                    }
                                }
                            }

                            //Remove the IsIndex ones if exist
                            Func<Index, bool> where = x => x.IndexType == IndexTypeConstants.IsIndexed &&
                                x.IndexColumns.Count == 1 &&
                                x.IndexColumns.First().FieldID == element.Id &&
                                x.IndexType == IndexTypeConstants.IsIndexed;

                            element.Entity.Indexes.Where(where).ToList().ForEach(x => x.IndexType = IndexTypeConstants.User);
                            element.Entity.Indexes.Remove(where);

                        }
                        else //Remove Index
                        {
                            var existing = element.Entity.Indexes.FirstOrDefault(x => x.IndexType == IndexTypeConstants.PrimaryKey);
                            if (existing != null)
                            {
                                using (var transaction = element.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                                {
                                    existing.IndexType = IndexTypeConstants.User;
                                    existing.IndexColumns.Remove(x => x.FieldID == element.Id);
                                    if (element.Entity.Fields.Count(x => x.IsPrimaryKey) == 0) //No more primary keys
                                        element.Entity.Indexes.Remove(existing);
                                    else
                                        existing.IndexType = IndexTypeConstants.PrimaryKey;

                                    //If use modules then add the PK to all modules that contain this entity
                                    if (element.Entity.nHydrateModel.UseModules && existing.FieldList.Count == 0)
                                    {
                                        foreach (var module in element.Modules)
                                        {
                                            element.Entity.nHydrateModel.IndexModules.Remove(x => (x.IndexID == existing.Id) && (x.ModuleId == module.Id));
                                        }
                                    }

                                    transaction.Commit();
                                }
                            }
                        }
                    }

                }
                catch (Exception ex)
                {
                    throw;
                }
            }
コード例 #36
0
 public bool MaybeAllowSetValue(FieldBase Field, out object NewValue)
 {
     NewValue = ((IField)Field).Value;
     return true;
 }
コード例 #37
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, DataTypeConstants oldValue, DataTypeConstants newValue)
            {
                try
                {
                    base.OnValueChanged(element, oldValue, newValue);

                    if (element.Entity != null && element.Entity.nHydrateModel != null)
                    {
                        if (!element.Entity.nHydrateModel.IsLoading)
                        {
                            element.Length = newValue.GetDefaultSize(element.Length);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
コード例 #38
0
ファイル: Field.cs プロジェクト: nHydrate/nHydrate
            protected override void OnValueChanged(FieldBase element, int oldValue, int newValue)
            {
                base.OnValueChanged(element, oldValue, newValue);

                //this will trigger another event
                var v = newValue;
                if (v < 0) v = 0;
                v = element.DataType.ValidateDataTypeMax(v);
                if (newValue != v)
                    element.Length = element.DataType.ValidateDataTypeMax(v);
            }