Ejemplo n.º 1
0
        /// <summary>
        /// Begins a grouping of statements with the provided logic type.
        /// </summary>
        public void BeginGroup(LogicTypes logicType)
        {
            var newGroup = new FilterBuilderGroup <TModel>(logicType, currentGroup);

            currentGroup.Add(newGroup);
            currentGroup = newGroup;
        }
Ejemplo n.º 2
0
        public AccountLogic(LogicTypes type)
        {
            switch (type)
            {
            case LogicTypes.ActualLogic: repo = new AccountRepository(DAL.ContextTypes.MSSQLContext); break;

            case LogicTypes.TestLogic: repo = new AccountRepository(DAL.ContextTypes.MemoryContext); break;
            }
        }
        /// <summary>
        /// Creates a new grouping of filter steps.
        /// </summary>
        /// <param name="logicType">Type of join logic to use.</param>
        /// <param name="parent">Parent of this group.</param>
        public FilterBuilderGroup(LogicTypes logicType, FilterBuilderGroup <TModel> parent)
        {
            if (logicType == LogicTypes.NOT)
            {
                throw new InvalidOperationException("Cannot group filters using 'not' logic.");
            }

            this.logicType = logicType;
            this.parent    = parent;
            this.steps     = new List <FilterBuilderStep <TModel> >();
        }
Ejemplo n.º 4
0
        public static LogicTypes Parse(string code)
        {
            LogicTypes type = LogicTypes.Undefined;

            if (code.Equals("and", StringComparison.OrdinalIgnoreCase))
            {
                type = LogicTypes.And;
            }
            else if (code.Equals("or", StringComparison.OrdinalIgnoreCase))
            {
                type = LogicTypes.Or;
            }
            return(type);
        }
Ejemplo n.º 5
0
        private void SetLogic(LogicTypes logic)
        {
            switch (logic)
            {
            case LogicTypes.AND:
                rbAnnd.Checked = true;
                break;

            case LogicTypes.OR:
                rbOR.Checked = true;
                break;

            case LogicTypes.ExclusiveOR:
                rbXOR.Checked = true;
                break;
            }
        }
Ejemplo n.º 6
0
            public static LogicTypes FromILogicable(ILogicable logicable)
            {
                var logicTypes = new LogicTypes();

                logicTypes.read  = new List <string>();
                logicTypes.write = new List <string>();

                foreach (LogicType logicType in Enum.GetValues(typeof(LogicType)))
                {
                    if (logicable.CanLogicRead(logicType))
                    {
                        logicTypes.read.Add(logicType.ToString());
                    }

                    if (logicable.CanLogicWrite(logicType))
                    {
                        logicTypes.write.Add(logicType.ToString());
                    }
                }

                return(logicTypes);
            }
Ejemplo n.º 7
0
            public static ThingPayload FromThing(Thing prefab)
            {
                var item = new ThingPayload();

                item.name = prefab.name;
                item.hash = prefab.GetPrefabHash;

                if (prefab is IQuantity quantity)
                {
                    item.stackSize = (int)quantity.GetMaxQuantity;
                }
                else
                {
                    item.stackSize = 1;
                }

                if (prefab is INutrition nutrition)
                {
                    item.nutrition = Nutrition.FromINutrition(nutrition);
                }

                if (prefab is Ice ice)
                {
                    item.meltable = Meltable.FromIce(ice);
                }

                if (prefab is ILogicable iLogicable)
                {
                    item.logicTypes = LogicTypes.FromILogicable(iLogicable);
                }

                // TODO: Paintable

                item.temperatureLimits = TemperatureLimits.FromThing(prefab);

                if (prefab.Slots.Count > 0)
                {
                    item.slots = SlotsFromThing(prefab);
                }

                if (prefab is Item thingItem)
                {
                    item.createdReagents = ReagentsFromItem(thingItem);
                }

                if (prefab is Ore ore)
                {
                    item.spawnedGases = SpawnedGasFromOre(ore);
                }

                if (prefab.HasModeState && prefab.ModeStrings != null)
                {
                    item.modes = new List <string>(prefab.ModeStrings);
                }

                if (prefab is IConstructionKit kit)
                {
                    item.constructs = ConstructsFromKit(kit);
                }

                item.flags = FlagsFromThing(prefab);

                return(item);
            }
Ejemplo n.º 8
0
 public LogicType(LogicTypes type = LogicTypes.Undefined, bool not = false)
 {
     Type = type;
     Not  = not;
 }
 public SearchField(string column, LogicTypes logic)
 {
     ColumnName = column;
     Logic      = logic;
 }
Ejemplo n.º 10
0
 public FilterExpressionBuilder(LogicTypes logicType = LogicTypes.AND)
 {
     currentGroup = new FilterBuilderGroup <TModel>(logicType, null);
     parameter    = Expression.Parameter(modelType, "model");
 }
Ejemplo n.º 11
0
 public LogicType(LogicTypes type, bool not = false)
 {
     Type = type;
     Not  = not;
 }