Exemplo n.º 1
0
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerPropertyEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, AllowStyles styles, string dependedProperty, string dependingProperty, ValueTypes filterType = ValueTypes.All, double min = double.MinValue, double max = double.MaxValue)
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerPropertyEnumEditor), null, filterType)
 {
     _styles = styles;
     _dependedProperty = dependedProperty;
     _dependingProperty = dependingProperty;
     _minValue = min;
     _maxValue = max;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance of this class with the required category and sub category.
        /// </summary>
        /// <param name="category">Selected category</param>
        /// <param name="subCategory">Selected sub category</param>
        /// <history>
        /// [Curtis_Beard]	   10/31/2014	ADD: exclusions update
        /// </history>
        public FilterType(Categories category, SubCategories subCategory)
        {
            cat = category;
             subcat = subCategory;

             switch (subcat)
             {
            case SubCategories.Name:
            case SubCategories.Path:
               valuetype = ValueTypes.String;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.Equals, ValueOptions.Contains, ValueOptions.StartsWith, ValueOptions.EndsWith };
               supportsIgnoreCase = true;
               supportsMulitpleItems = true;
               break;

            case SubCategories.Hidden:
            case SubCategories.System:
            case SubCategories.ReadOnly:
            case SubCategories.Binary:
               valuetype = ValueTypes.Null;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.None };
               supportsIgnoreCase = false;
               supportsMulitpleItems = false;
               break;

            case SubCategories.DateModified:
            case SubCategories.DateCreated:
               valuetype = ValueTypes.DateTime;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.Equals, ValueOptions.NotEquals, ValueOptions.GreaterThan, ValueOptions.GreaterThanEquals, ValueOptions.LessThan, ValueOptions.LessThanEquals };
               supportsIgnoreCase = false;
               supportsMulitpleItems = true;
               break;

            case SubCategories.Extension:
               valuetype = ValueTypes.String;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.None };
               supportsIgnoreCase = false;
               supportsMulitpleItems = true;
               break;

            case SubCategories.Size:
               valuetype = ValueTypes.Size;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.Equals, ValueOptions.NotEquals, ValueOptions.GreaterThan, ValueOptions.GreaterThanEquals, ValueOptions.LessThan, ValueOptions.LessThanEquals };
               supportsIgnoreCase = false;
               supportsMulitpleItems = true;
               break;

            case SubCategories.MinimumHitCount:
               valuetype = ValueTypes.Long;
               supportedValueOptions = new List<ValueOptions>() { ValueOptions.None };
               supportsIgnoreCase = false;
               supportsMulitpleItems = false;
               break;
             }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Builds a <seealso cref="EventValueDescription"/> with a name and a type.
 /// <p/>
 /// If the type is <seealso cref="EventValueType#INT"/> or <seealso cref="EventValueType#LONG"/>, the
 /// <seealso cref="#mValueType"/> is set to <seealso cref="ValueType#BYTES"/> by default. It set to
 /// <seealso cref="ValueType#NOT_APPLICABLE"/> for all other <seealso cref="EventValueType"/> values. </summary>
 /// <param name="name"> </param>
 /// <param name="type"> </param>
 internal EventValueDescription(string name, EventContainer.EventValueTypes type)
 {
     mName = name;
     mEventValueType = type;
     if (mEventValueType == EventContainer.EventValueTypes.INT || mEventValueType == EventContainer.EventValueTypes.LONG)
     {
         mValueType = ValueTypes.BYTES;
     }
     else
     {
         mValueType = ValueTypes.NOT_APPLICABLE;
     }
 }
Exemplo n.º 4
0
 public static ValueType HighestValue(ValueTypes a, ValueTypes b)
 {
     throw new NotImplementedException();
     switch (a) {
         case ValueTypes.ARRAY:
             return ValueTypes.NULL;
         case ValueTypes.BOOLEAN:
             return ValueTypes.NULL;
         case ValueTypes.BYTE:
             return ValueTypes.NULL;
         case ValueTypes.CODE_BLOCK:
             return ValueTypes.NULL;
         case ValueTypes.DATETIME:
             return ValueTypes.NULL;
         case ValueTypes.DECIMAL:
             return ValueTypes.NULL;
         case ValueTypes.DOUBLE:
             return ValueTypes.NULL;
         case ValueTypes.EMPTY:
             return ValueTypes.NULL;
         case ValueTypes.FLOAT:
             return ValueTypes.NULL;
         case ValueTypes.GUID:
             return ValueTypes.NULL;
         case ValueTypes.INT_16:
             return ValueTypes.NULL;
         case ValueTypes.INT_32:
             return ValueTypes.NULL;
         case ValueTypes.INT_64:
             return ValueTypes.NULL;
         case ValueTypes.NULL:
             return ValueTypes.NULL;
         case ValueTypes.REFERENCE:
             return ValueTypes.NULL;
         case ValueTypes.STRING:
             return ValueTypes.NULL;
         case ValueTypes.OBJECT:
             return ValueTypes.NULL;
         case ValueTypes.UINT_16:
             return ValueTypes.NULL;
         case ValueTypes.UINT_32:
             return ValueTypes.NULL;
         case ValueTypes.UINT_64:
             return ValueTypes.NULL;
     }
 }
Exemplo n.º 5
0
        public object GetValue(string fieldName, ValueTypes valueType = ValueTypes.Default)
        {
            object o = false;

            //int fieldDefinitionIndex = 0;
            foreach (Template.Field f in pageCollection.ActiveTemplate.Fields.Where(x => x.Name == fieldName))
            {
                o = getValue(f /*, fieldDefinitionIndex*/, valueType);
                if (o != null)
                {
                    return(o);
                }
                //fieldDefinitionIndex++;
            }
            if (o == null)
            {
                return(null);
            }
            throw new Exception("These is no field[name=" + fieldName + "]");
        }
        protected IPropertyType CreatePropertyTypeExtension(PropertyInfo pi, DBMeta dbmeta)
        {
            if (IsRelationProperty(pi, dbmeta))
            {
                return(null);
            }
            String        columnName = GetPropertyTypeColumnName(pi);
            IValueType    valueType  = ValueTypes.GetValueType(pi.PropertyType);
            IPropertyType pt         = new PropertyTypeImpl(pi, valueType, columnName);

            if (dbmeta.HasPrimaryKey && dbmeta.HasColumn(pt.ColumnName))
            {
                if (dbmeta.FindColumnInfo(pt.ColumnName).IsPrimary)
                {
                    pt.IsPrimaryKey = true;
                }
            }
            pt.IsPersistent = IsPersistentProperty(pi, dbmeta);
            return(pt);
        }
Exemplo n.º 7
0
        private void GetValues(SqlCommand command)
        {
            using (var objReader = command.ExecuteReader())
            {
                if (objReader != null)
                {
                    if (objReader.HasRows)
                    {
                        while (objReader.Read())
                        {
                            ValueTypes enumValueType = (ValueTypes)Enum.Parse(typeof(ValueTypes), objReader["TYPE"].ToString());
                            switch (enumValueType)
                            {
                            case ValueTypes.vtAangemeldOneDayToDate:
                                ucDashboard1.InVandaag = float.Parse(objReader["AANTAL"].ToString());
                                break;

                            case ValueTypes.vtAfgemeldOneDayToDate:
                                ucDashboard1.UitVandaag = float.Parse(objReader["AANTAL"].ToString());
                                break;

                            case ValueTypes.vtAangemeldOneWeekToDate:
                                ucDashboard1.InWeek = float.Parse(objReader["AANTAL"].ToString());
                                break;

                            case ValueTypes.vtAfgemeldOneWeekToDate:
                                ucDashboard1.UitWeek = float.Parse(objReader["AANTAL"].ToString());
                                break;

                            case ValueTypes.vtOpenstaandTotaal:
                                ucDashboard1.Totaal = float.Parse(objReader["AANTAL"].ToString());
                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        void ParseProperties(XmlElement element, object obj)
        {
            XmlAttributeCollection attributes = element.Attributes;
            Type type = obj.GetType();

            PropertyInfo[] properties = type.GetProperties();

            // loop for each attribute defined in the given element and attempt to
            // set the value of a property whose name is equals to the element name.
            foreach (XmlAttribute att in attributes)
            {
                string property_name  = att.Name;
                string property_value = att.Value;

                // If desired remove the "-" character from the attribute name.
                if (remove_hyphen_from_attribute_names_)
                {
                    property_name = property_name.Replace("-", "");
                }

                PropertyInfo property;
                if (TryGetProperty(properties, property_name, out property) &&
                    property.CanWrite)
                {
                    Type property_type = property.PropertyType;
                    if (property_type.Name == "String")
                    {
                        property.SetValue(obj, property_value, null);
                    }
                    else if (property_type.IsValueType)
                    {
                        // try to convert the attribute value to the type of the property
                        System.ValueType value;
                        if (ValueTypes.TryParse(property_type, property_value, out value))
                        {
                            property.SetValue(obj, value, null);
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        internal Parameter(string name,
                           string[] aliases,
                           ValueTypes valueType,
                           string environmentPrefix,
                           string environmentVarName,
                           bool isRequired,
                           object defaultValue)
        {
            this.Name           = name.Trim();
            this.Aliases        = aliases;
            this.ValueType      = valueType;
            _environmentPrefix  = environmentPrefix;
            _environmentVarName = environmentVarName;
            this.IsRequired     = isRequired;
            this.DefaultValue   = defaultValue;

            if (this.Name == "*" && this.ValueType == ValueTypes.None)
            {
                throw new InvalidOperationException("Catch-all parameter '*' must specify a value type!");
            }
        }
        public FilterQuery(string fieldName, object fieldValue, FilterQueryTypes queryType)
        {
            FieldName = fieldName;
            FieldValue = fieldValue;
            QueryType = queryType;
            ValueType = ValueTypes.String;
            if (fieldValue.GetType() == typeof(bool))
            {
                ValueType = ValueTypes.Bool;
            }

            if (IsNumeric(fieldValue.ToString()))
            {
                ValueType = ValueTypes.Numeric;
            }

            if (fieldValue.GetType() == typeof(DateTimeOffset))
            {
                ValueType = ValueTypes.DateTimeOffset;
            }
        }
        public FilterQuery(string fieldName, object fieldValue, FilterQueryTypes queryType)
        {
            FieldName  = fieldName;
            FieldValue = fieldValue;
            QueryType  = queryType;
            ValueType  = ValueTypes.String;
            if (fieldValue.GetType() == typeof(bool))
            {
                ValueType = ValueTypes.Bool;
            }

            if (IsNumeric(fieldValue.ToString()))
            {
                ValueType = ValueTypes.Numeric;
            }

            if (fieldValue.GetType() == typeof(DateTimeOffset))
            {
                ValueType = ValueTypes.DateTimeOffset;
            }
        }
Exemplo n.º 12
0
 // ===============================================================================
 //                                                                    Common Logic
 //                                                                    ============
 // -------------------------------------------------
 //                                     Args Handling
 //                                     -------------
 protected virtual void BindArgs(IDbCommand command, Object[] args, Type[] argTypes)
 {
     if (_loggingMessageSqlArgs == null)
     {
         _loggingMessageSqlArgs = args;
     }                                                                      // Save arguments for logging.
     if (args == null)
     {
         return;
     }
     string[] argNames = _commandFactory.GetArgNames(command, args);
     for (int i = 0; i < args.Length; ++i)
     {
         IValueType valueType = ValueTypes.GetValueType(argTypes[i]);
         try {
             valueType.BindValue(command, argNames[i], args[i]);
         } catch (Exception e) {
             HandleDbException(e, command);
         }
     }
 }
Exemplo n.º 13
0
        public void SetupCastSettings(object obj)
        {
            if (obj != null && obj is Behaviac.Design.Nodes.Node)
            {
                Behaviac.Design.Nodes.Node assignNode = obj as Behaviac.Design.Nodes.Node;

                if (assignNode != null)
                {
                    bool bCasting = assignNode.IsCasting;

                    if (bCasting)
                    {
                        DesignerPropertyInfo leftPropInfo = DesignerProperty.GetDesignerProperty(assignNode.GetType(), "Opl");
                        VariableDef          opl          = (VariableDef)leftPropInfo.GetValue(assignNode);

                        Type leftType = opl.ValueType;

                        // if number
                        if (Plugin.IsIntergerNumberType(leftType) || Plugin.IsFloatType(leftType))
                        {
                            this.ValueType = ValueTypes.Int | ValueTypes.Float;

                            this.FilterType = null;
                        }
                        else if (Plugin.IsRefType(leftType))
                        {
                            //ref type/pointer type
                            this.ValueType = ValueTypes.RefType;

                            this.FilterType = leftType;
                        }
                        else
                        {
                            //
                        }
                    }
                }
            }
        }
    /// <inheritdoc />
    public override LabelConfiguration FromConfigurationEditor(
        IDictionary <string, object?>?editorValues,
        LabelConfiguration?configuration)
    {
        var newConfiguration = new LabelConfiguration();

        // get the value type
        // not simply deserializing Json because we want to validate the valueType
        if (editorValues is not null && editorValues.TryGetValue(
                Constants.PropertyEditors.ConfigurationKeys.DataValueType,
                out var valueTypeObj) &&
            valueTypeObj is string stringValue)
        {
            // validate
            if (!string.IsNullOrWhiteSpace(stringValue) && ValueTypes.IsValue(stringValue))
            {
                newConfiguration.ValueType = stringValue;
            }
        }

        return(newConfiguration);
    }
Exemplo n.º 15
0
        private void SetToDefault()
        {
            SelectedValueType     = ValueTypes.FirstOrDefault();
            SelectedCashFlow      = CashFlows.FirstOrDefault();
            SelectedCashFlowGroup = CashFlowGroups.FirstOrDefault();
            SelectedIncome        = null;
            SelectedSaving        = null;
            UserValue             = null;
            UserText             = string.Empty;
            SelectedEquation     = null;
            SelectedOperatorType = CalculatorOperatorType.None;

            var  lastItem = Model.Items.LastOrDefault();
            bool isLastItemNotOperator = (lastItem != null) && (lastItem.ValueType != CalculatorValueType.Operator);

            IsLastElement = (Model.Items.Count > 2) && (isLastItemNotOperator);

            if (IsOperatorElementVisible)
            {
                IsAddOperatorSelected = true;
            }
        }
Exemplo n.º 16
0
        private void RefreshUI()
        {
            _suppressEvents = true;
            if (Model.CurrentItem == null)
            {
                Model.CreateDefaultCurrentItem();
                SetToDefault();
            }
            else if (!Model.Items.Contains(Model.CurrentItem))
            {
                SetToDefault();
            }
            else
            {
                var  currentItem        = Model.CurrentItem;
                bool isOperatorType     = currentItem.ValueType == CalculatorValueType.Operator;
                bool isNoneOperatorType = currentItem.OperatorType == CalculatorOperatorType.None;
                IsLastElement         = isOperatorType && isNoneOperatorType;
                SelectedOperatorType  = currentItem.OperatorType;
                SelectedValueType     = ValueTypes.FirstOrDefault(x => x.Value == currentItem.ValueType);
                SelectedCashFlow      = CashFlows.FirstOrDefault(x => x.Id == currentItem.ForeignId);
                SelectedCashFlowGroup = CashFlowGroups.FirstOrDefault(x => x.Id == currentItem.ForeignId);
                SelectedIncome        = Incomes.FirstOrDefault(x => x.Id == currentItem.ForeignId);
                SelectedSaving        = Savings.FirstOrDefault(x => x.Id == currentItem.ForeignId);
                UserValue             = currentItem.Value;
                UserText         = currentItem.Text;
                SelectedEquation = Equations.FirstOrDefault(x => x.Id == currentItem.ForeignId);
            }

            NotifyOfPropertyChange(() => IsNoneOperatorSelected);
            NotifyOfPropertyChange(() => IsOperatorElementVisible);
            NotifyOfPropertyChange(() => IsAddOperatorSelected);
            NotifyOfPropertyChange(() => IsSubstractOperatorSelected);
            NotifyOfPropertyChange(() => IsMultiplyOperatorSelected);
            NotifyOfPropertyChange(() => IsDivideOperatorSelected);

            Title           = string.Format("Składowe równania ({0}/{1})", Model.CurrentPageNumber, Model.TotalPagesNumber);
            _suppressEvents = false;
        }
        /// <summary>
        /// A method used to format the database value to a value that can be used by the editor
        /// </summary>
        /// <param name="property"></param>
        /// <param name="dataTypeService"></param>
        /// <param name="culture"></param>
        /// <param name="segment"></param>
        /// <returns></returns>
        /// <remarks>
        /// The object returned will always be a string and if the database type is not a valid string type an exception is thrown
        /// </remarks>
        public override object ToEditor(Property property, IDataTypeService dataTypeService, string culture = null, string segment = null)
        {
            var val = property.GetValue(culture, segment);

            if (val == null)
            {
                return(string.Empty);
            }

            switch (ValueTypes.ToStorageType(ValueType))
            {
            case ValueStorageType.Ntext:
            case ValueStorageType.Nvarchar:
                return(val.ToString());

            case ValueStorageType.Integer:
            case ValueStorageType.Decimal:
            case ValueStorageType.Date:
            default:
                throw new InvalidOperationException("The " + typeof(TextOnlyValueEditor) + " can only be used with string based property editors");
            }
        }
Exemplo n.º 18
0
        private bool IsSymbolValid(string mask, string str, ValueTypes typ)
        {
            switch (typ)
            {
            case ValueTypes.Text:
                return(true);

            case ValueTypes.Integer:
                if (str == NumberFormatInfo.CurrentInfo.NegativeSign)
                {
                    return(true);
                }
                break;

            case ValueTypes.Double:
                if (str == NumberFormatInfo.CurrentInfo.NumberDecimalSeparator ||
                    str == NumberFormatInfo.CurrentInfo.NegativeSign)
                {
                    return(true);
                }
                break;
            }

            if (typ.Equals(ValueTypes.Integer) || typ.Equals(ValueTypes.Double))
            {
                foreach (char ch in str)
                {
                    if (!Char.IsDigit(ch))
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 19
0
        void SetValue(object value)
        {
            this.value = value;
            isArray    = value is Array;

            if (value == null)
            {
                if (valueType != ValueTypes.Null || valueType != ValueTypes.Object)
                {
                    value = GetDefaultValue(valueType, isArray);
                }
            }
            else
            {
                if (value is UnityEngine.Object[] || value is UnityEngine.Object)
                {
                    valueType = ValueTypes.Object;
                }
                else
                {
                    valueType = ToValueType(value.GetType());
                }
            }
        }
Exemplo n.º 20
0
	public static void CopyAroundAndModifyField(ValueTypes.S s)
	{
		ValueTypes.S s2 = s;
		s2.Field += 10;
		s = s2;
	}
Exemplo n.º 21
0
	public static void Copy4(ref ValueTypes.S p, out ValueTypes.S o)
	{
		o = p;
	}
Exemplo n.º 22
0
 public static void Copy4b(ref ValueTypes.S p, out ValueTypes.S o)
 {
     // test passing through by-ref arguments
     ValueTypes.Copy4(ref p, out o);
 }
Exemplo n.º 23
0
 private bool Equals(CacheKey other)
 {
     return(ValueTypes.SequenceEqual(other.ValueTypes) &&
            (IndexMap?.SequenceEqual(other.IndexMap) ?? true));
 }
Exemplo n.º 24
0
        public virtual void SetAdapterLists(int BaseObjectIndex, string key, string property, ValueTypes type, string lable, int defaultLaoutID = Resource.Layout.CommonLabelTextViewer, Type defaultActivity = null)
        {
            string propertyList = BusinessObjects[BaseObjectIndex].parm.PropertyList;

            if (string.IsNullOrEmpty(propertyList))
            {
                propertyList = "" + property;
            }
            else
            {
                propertyList += "," + property;
            }
            if (!string.IsNullOrEmpty(property))
            {
                BusinessObjects[BaseObjectIndex].parm.PropertyList = propertyList;
            }
            AdapterListTemplate.Add(new AdapterList(key, property, "", lable, type, defaultLaoutID, defaultActivity)
            {
                ObjIndex = BaseObjectIndex
            });
        }
Exemplo n.º 25
0
 public static ValueTypes.S InitObj1()
 {
     ValueTypes.S result = default(ValueTypes.S);
     ValueTypes.MakeArray();
     return(result);
 }
Exemplo n.º 26
0
	public static ValueTypes.S Copy2(ref ValueTypes.S p)
	{
		return p;
	}
Exemplo n.º 27
0
 public static bool IsNumber(ValueTypes type) { var typeBits = (int)type & 0x03; return (typeBits == 0x01) || (typeBits == 0x02); }
Exemplo n.º 28
0
 public static bool IsFunction(ValueTypes type) { return type == ValueTypes.Function; }
Exemplo n.º 29
0
 public static bool IsString(ValueTypes type) { return type == ValueTypes.String; }
Exemplo n.º 30
0
 public static bool IsBoolean(ValueTypes type) { return type == ValueTypes.Boolean; }
Exemplo n.º 31
0
 public static bool IsNull(ValueTypes type) { return type == ValueTypes.Null; }
Exemplo n.º 32
0
 public static bool IsUndefined(ValueTypes type) { return type == ValueTypes.Undefined; }
Exemplo n.º 33
0
        /// <summary>
        /// Builds a <seealso cref="EventValueDescription"/> with a name and a type, and a <seealso cref="ValueType"/>.
        /// <p/> </summary>
        /// <param name="name"> </param>
        /// <param name="type"> </param>
        /// <param name="valueType"> </param>
        /// <exception cref="InvalidValueTypeException"> if type and valuetype are not compatible.
        ///  </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: EventValueDescription(String name, com.android.ddmlib.log.EventContainer.EventValueType type, ValueType valueType) throws InvalidValueTypeException
        internal EventValueDescription(string name, EventContainer.EventValueTypes type, ValueTypes valueType)
        {
            mName           = name;
            mEventValueType = type;
            mValueType      = valueType;
            mValueType.checkType(mEventValueType);
        }
Exemplo n.º 34
0
		private static void Test(ValueTypes.S byVal)
		{
		}
Exemplo n.º 35
0
	public static void InitObj3(out ValueTypes.S p)
	{
		p = default(ValueTypes.S);
	}
Exemplo n.º 36
0
 public static bool IsObject(ValueTypes type) { var typeBits = (int)type & 0x03; return typeBits == 0x03; }
Exemplo n.º 37
0
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerMethodEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, MethodType methodType, ValueTypes methodReturnType = ValueTypes.All, string linkedToProperty = "")
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerMethodComboEnumEditor), linkedToProperty) {
     _methodType = methodType;
     _methodReturnType = methodReturnType;
 }
Exemplo n.º 38
0
 public static bool IsPrimitive(ValueTypes type) { var typeBits = (int)type & 0x03; return typeBits != 0x03; }
Exemplo n.º 39
0
        public static bool IsCompatibleType(ValueTypes valueType, Type filterType, Type typeToFilter, bool bArrayType)
        {
            Debug.Check(typeToFilter != null);

            if (filterType == null || (filterType.Name == "System_Object" && !Plugin.IsArrayType(typeToFilter)))
                return true;

            if (valueType != ValueTypes.All)
            {
                if ((valueType & ValueTypes.Int) == ValueTypes.Int && Plugin.IsIntergerType(typeToFilter) ||
                    (valueType & ValueTypes.Float) == ValueTypes.Float && Plugin.IsFloatType(typeToFilter))
                    return true;
            }

            bool bCompatible = false;

            if (bArrayType && Plugin.IsArrayType(typeToFilter))
            {
                //list of the same type
                Type typeToFilterElement = typeToFilter.GetGenericArguments()[0];

                if (Plugin.IsCompatibleType(valueType, typeToFilterElement, filterType, false))
                {
                    bCompatible = true;
                }
            }
            else if (filterType == typeToFilter)
            {
                bCompatible = true;
            }
            else
            {
                bCompatible = Plugin.IsAgentDerived(typeToFilter.Name, filterType.Name);
            }

            return bCompatible;
        }
Exemplo n.º 40
0
 public static bool IsDefined(ValueTypes type) { var typeBits = (int)type & 0x07; return typeBits != 0; }
Exemplo n.º 41
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 public Value(ValueTypes type)
 {
     this.mType = type;
 }
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerRightValueEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, AllowStyles styles, MethodType methodType, string dependedProperty, string dependingProperty, ValueTypes filterType = ValueTypes.All)
     : base(displayName, description, category, displayMode, displayOrder, flags, styles, dependedProperty, dependingProperty, filterType)
 {
     _methodType = methodType;
 }
Exemplo n.º 43
0
        private void cmdBegin_Click(object sender, EventArgs e)
        {
            Enabled = false;
            lstOffsets.DataSource = null;

            uint baseAddress = ((ModuleInfo)cboModule.SelectedItem).BaseAddress;
            uint size        = ((ModuleInfo)cboModule.SelectedItem).Size;

            ValueTypes type        = (ValueTypes)cboType.SelectedItem;
            object     searchValue = txtValue.Text;

            switch (type)
            {
            case ValueTypes.Byte:
                searchValue = Convert.ToByte((string)searchValue);
                break;

            case ValueTypes.Int16:
                searchValue = Convert.ToInt16((string)searchValue);
                break;

            case ValueTypes.Int32:
                searchValue = Convert.ToInt32((string)searchValue);
                break;

            case ValueTypes.Float:
                searchValue = Convert.ToSingle((string)searchValue);
                break;
            }

            const uint BlockSize  = 512;
            uint       blockCount = size / BlockSize;
            uint       offset     = 0;

            //for (int i = 0; i < blockCount; i++)
            {
                BinaryReader br = new BinaryReader(new MemoryStream(XBoxIO.XBox.GetMemory(baseAddress + offset, size)));

                //probar.Value = (int)((i * 100) / (blockCount * 100));
                Application.DoEvents();

                while (br.BaseStream.Position < br.BaseStream.Length)//offset < size)
                {
                    probar.Value = (int)(((float)br.BaseStream.Position / (float)br.BaseStream.Length) * 100.0f);

                    switch (type)
                    {
                    case ValueTypes.Byte:
                    {
                        byte data = br.ReadByte();
                        if (data == (byte)searchValue)
                        {
                            MemoryInfo.Add(new MemoryInfoItem(offset));
                        }
                        offset += sizeof(byte);
                        break;
                    }

                    case ValueTypes.Int16:
                    {
                        Int16 data = br.ReadInt16();
                        if (data == (Int16)searchValue)
                        {
                            MemoryInfo.Add(new MemoryInfoItem(offset));
                        }
                        offset += sizeof(Int16);
                        break;
                    }

                    case ValueTypes.Int32:
                    {
                        Int32 data = br.ReadInt32();;
                        if (data == (Int32)searchValue)
                        {
                            MemoryInfo.Add(new MemoryInfoItem(offset));
                        }
                        offset += sizeof(Int32);
                        break;
                    }

                    case ValueTypes.Float:
                    {
                        float data = br.ReadSingle();
                        if (data == (float)searchValue)
                        {
                            MemoryInfo.Add(new MemoryInfoItem(offset));
                        }
                        offset += sizeof(float);
                        break;
                    }
                    }
                }

                br.Close();

                //WaitForSeconds(10.0f);
            }
            lstOffsets.DataSource = MemoryInfo;
            probar.Value          = 0;
            Enabled = true;
        }
Exemplo n.º 44
0
		public Declaration(ValueTypes type, string identifier)
		{
			_type = type;
			_identifier = identifier;
		}
Exemplo n.º 45
0
	public static void Copy3(ValueTypes.S p, out ValueTypes.S o)
	{
		o = p;
	}
Exemplo n.º 46
0
 public Macro(MacroType type, int value)
     : this(type)
 {
     m_ValueInteger = value;
     m_ValueType = ValueTypes.Integer;
 }
Exemplo n.º 47
0
	public static void Copy4b(ref ValueTypes.S p, out ValueTypes.S o)
	{
		// test passing through by-ref arguments
		ValueTypes.Copy4(ref p, out o);
	}
Exemplo n.º 48
0
 public Macro(MacroType type, string value)
     : this(type)
 {
     m_ValueString = value;
     m_ValueType = ValueTypes.String;
 }
Exemplo n.º 49
0
	public static ValueTypes.S OnlyChangeTheCopy(ValueTypes.S p)
	{
		ValueTypes.S s = p;
		s.SetField();
		return p;
	}
Exemplo n.º 50
0
        /// <summary>
        /// Creates an instance of this class with the required category and sub category.
        /// </summary>
        /// <param name="category">Selected category</param>
        /// <param name="subCategory">Selected sub category</param>
        /// <history>
        /// [Curtis_Beard]	   10/31/2014	ADD: exclusions update
        /// </history>
        public FilterType(Categories category, SubCategories subCategory)
        {
            cat    = category;
            subcat = subCategory;

            switch (subcat)
            {
            case SubCategories.Name:
            case SubCategories.Path:
                valuetype             = ValueTypes.String;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.Equals, ValueOptions.Contains, ValueOptions.StartsWith, ValueOptions.EndsWith
                };
                supportsIgnoreCase    = true;
                supportsMulitpleItems = true;
                break;

            case SubCategories.Hidden:
            case SubCategories.System:
            case SubCategories.ReadOnly:
            case SubCategories.Binary:
                valuetype             = ValueTypes.Null;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.None
                };
                supportsIgnoreCase    = false;
                supportsMulitpleItems = false;
                break;

            case SubCategories.DateModified:
            case SubCategories.DateCreated:
                valuetype             = ValueTypes.DateTime;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.Equals, ValueOptions.NotEquals, ValueOptions.GreaterThan, ValueOptions.GreaterThanEquals, ValueOptions.LessThan, ValueOptions.LessThanEquals
                };
                supportsIgnoreCase    = false;
                supportsMulitpleItems = true;
                break;

            case SubCategories.Extension:
                valuetype             = ValueTypes.String;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.None
                };
                supportsIgnoreCase    = false;
                supportsMulitpleItems = true;
                break;

            case SubCategories.Size:
                valuetype             = ValueTypes.Size;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.Equals, ValueOptions.NotEquals, ValueOptions.GreaterThan, ValueOptions.GreaterThanEquals, ValueOptions.LessThan, ValueOptions.LessThanEquals
                };
                supportsIgnoreCase    = false;
                supportsMulitpleItems = true;
                break;

            case SubCategories.MinimumHitCount:
                valuetype             = ValueTypes.Long;
                supportedValueOptions = new List <ValueOptions>()
                {
                    ValueOptions.None
                };
                supportsIgnoreCase    = false;
                supportsMulitpleItems = false;
                break;
            }
        }
Exemplo n.º 51
0
		private static void Test(ref ValueTypes.S byRef)
		{
		}
Exemplo n.º 52
0
 /// <summary>
 /// Creates a new designer attribute.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 /// <param name="editorType">The type of the editor used in the property grid.</param>
 /// <param name="linkedToProperty">The restrictions of this property are defined by another property.</param>
 protected DesignerProperty(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, Type editorType, string linkedToProperty, ValueTypes filterType = ValueTypes.All)
 {
     _displayName      = displayName;
     _description      = description;
     _category         = category;
     _displayMode      = displayMode;
     _displayOrder     = displayOrder;
     _flags            = flags;
     _editorType       = editorType;
     _linkedToProperty = linkedToProperty;
     _valueType        = filterType;
     _filterType       = Plugin.GetTypeFromValue(filterType);
 }
Exemplo n.º 53
0
	public static ValueTypes.S Copy1(ValueTypes.S p)
	{
		return p;
	}
Exemplo n.º 54
0
 public Macro(MacroType type, int value)
     : this(type)
 {
     m_ValueInteger = value;
     m_ValueType    = ValueTypes.Integer;
 }
Exemplo n.º 55
0
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerRightValueEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, AllowStyles styles, MethodType methodType, string dependedProperty, string dependingProperty, ValueTypes filterType = ValueTypes.All)
     : base(displayName, description, category, displayMode, displayOrder, flags, styles, dependedProperty, dependingProperty, filterType)
 {
     _methodType = methodType;
 }
Exemplo n.º 56
0
 public Macro(MacroType type, string value)
     : this(type)
 {
     m_ValueString = value;
     m_ValueType   = ValueTypes.String;
 }
Exemplo n.º 57
0
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerMethodEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, MethodType methodType, ValueTypes methodReturnType = ValueTypes.All, string linkedToProperty = "")
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerMethodComboEnumEditor), linkedToProperty)
 {
     _methodType       = methodType;
     _methodReturnType = methodReturnType;
 }
Exemplo n.º 58
0
        internal static void Write()
        {
            List <string> mappingsList = ValueTypes.Aggregate(new List <string>(), (list, next) =>
            {
                list.Add(File.ReadAllText(string.Format(CultureInfo.InvariantCulture, "{0}\\InputMapperProfilesTemplate.txt", Directory.GetCurrentDirectory()))
                         .Replace("#TYPE#", next));
                return(list);
            });

            mappingsList = ValueTypes.Aggregate(mappingsList, (list, next) =>
            {
                list.Add(File.ReadAllText(string.Format(CultureInfo.InvariantCulture, "{0}\\InputMapperProfilesTemplate.txt", Directory.GetCurrentDirectory()))
                         .Replace("#TYPE#", string.Concat(next, "?")));
                return(list);
            });

            mappingsList = OtherTypes.Aggregate(mappingsList, (list, next) =>
            {
                list.Add(File.ReadAllText(string.Format(CultureInfo.InvariantCulture, "{0}\\InputMapperProfilesTemplate.txt", Directory.GetCurrentDirectory()))
                         .Replace("#TYPE#", next));
                return(list);
            });

            string mappings = string.Join(string.Concat(Environment.NewLine, Environment.NewLine), mappingsList);

            string text = File.ReadAllText(string.Format(CultureInfo.InvariantCulture, "{0}\\InputVariablesMappingProfileFileTemplate.txt", Directory.GetCurrentDirectory()))
                          .Replace("#Mappings#", mappings);

            List <string> includesViewToParametersList = ValueTypes.Aggregate(new List <string>(), (list, next) =>
            {
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<{0}>, InputQuestionParameters<{0}>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<{0}?>, InputQuestionParameters<{0}?>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IEnumerable<{0}>>, InputQuestionParameters<IEnumerable<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IEnumerable<{0}?>>, InputQuestionParameters<IEnumerable<{0}?>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<ICollection<{0}>>, InputQuestionParameters<ICollection<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<ICollection<{0}?>>, InputQuestionParameters<ICollection<{0}?>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IList<{0}>>, InputQuestionParameters<IList<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IList<{0}?>>, InputQuestionParameters<IList<{0}?>>>()", next));
                return(list);
            });

            includesViewToParametersList = OtherTypes.Aggregate(includesViewToParametersList, (list, next) =>
            {
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<{0}>, InputQuestionParameters<{0}>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IEnumerable<{0}>>, InputQuestionParameters<IEnumerable<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<ICollection<{0}>>, InputQuestionParameters<ICollection<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputView<IList<{0}>>, InputQuestionParameters<IList<{0}>>>()", next));
                return(list);
            });

            List <string> includesParametersToViewList = ValueTypes.Aggregate(new List <string>(), (list, next) =>
            {
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<{0}>, InputView<{0}>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<{0}?>, InputView<{0}?>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IEnumerable<{0}>>, InputView<IEnumerable<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IEnumerable<{0}?>>, InputView<IEnumerable<{0}?>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<ICollection<{0}>>, InputView<ICollection<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<ICollection<{0}?>>, InputView<ICollection<{0}?>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IList<{0}>>, InputView<IList<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IList<{0}?>>, InputView<IList<{0}?>>>()", next));
                return(list);
            });

            includesParametersToViewList = OtherTypes.Aggregate(includesParametersToViewList, (list, next) =>
            {
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<{0}>, InputView<{0}>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IEnumerable<{0}>>, InputView<IEnumerable<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<ICollection<{0}>>, InputView<ICollection<{0}>>>()", next));
                list.Add(string.Format(CultureInfo.CurrentCulture, "\t\t\t\t.Include<InputQuestionParameters<IList<{0}>>, InputView<IList<{0}>>>()", next));
                return(list);
            });

            text = text.Replace("#ViewToParameterIncludes#", string.Join(Environment.NewLine, includesViewToParametersList));

            text = text.Replace("#ParameterToViewIncludes#", string.Join(Environment.NewLine, includesParametersToViewList));

            using (StreamWriter sr = new StreamWriter($@"{Constants.BASEPATH}\CheckMySymptoms.AutoMapperProfiles\InputVariablesMappingProfile.cs", false, Encoding.UTF8))
            {
                sr.Write(text);
            }
        }
Exemplo n.º 59
0
        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor oplEditor = GetEditor(_obj, "Opl");
                Debug.Check(oplEditor != null);

                if (oplEditor == sender)
                {
                    VariableDef opl = (VariableDef)GetProperty(_obj, "Opl");

                    if (opl != null)
                    {
                        RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                        if (opr != null)
                        {
                            if (opl.ValueType != opr.ValueType)
                            {
                                DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                                Debug.Check(oprEditor != null);
                                if (oprEditor != null)
                                {
                                    oprEditor.Clear();
                                }
                            }
                        }
                    }
                }
                else
                {
                    DesignerPropertyEditor oplEditorCast = GetEditor(_obj, "CastRight");
                    Debug.Check(oplEditorCast != null);

                    if (oplEditorCast == sender)
                    {
                        PluginBehaviac.Nodes.Assignment assignNode = _obj as PluginBehaviac.Nodes.Assignment;

                        if (assignNode != null)
                        {
                            RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                            if (opr != null)
                            {
                                DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                                Debug.Check(oprEditor != null);

                                // oprEditor.ValueType might be overwritten in SetupCastSettings if casting
                                // so that here to backup it first so that it can be restored later if not casting
                                if (assignNode.IsCasting)
                                {
                                    _valueTypesBackup = oprEditor.ValueType;
                                }
                                else
                                {
                                    oprEditor.ValueType = _valueTypesBackup;
                                }

                                oprEditor.Clear();
                                oprEditor.FilterType = null;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 60
0
        public static Type GetTypeFromValue(ValueTypes value)
        {
            switch (value) {
                case ValueTypes.Bool    :
                    return typeof(bool);

                case ValueTypes.Int     :
                    return typeof(int);

                case ValueTypes.Float   :
                    return typeof(float);
            }

            return null;
        }