public DynamicObject(string input, LogicObject logic)
 {
     string[] values = input.Split(',');
     for (int i = 0; i < values.Length; i++)
     {
         string[] value = values[i].Split(':');
         if (value[0] == "id")
         {
             this.Id = value[1];
         }
         else if (logic.Instance.FirstOrDefault(x => x.Name == value[0]).IsInteger)
         {
             this.IntValues[value[0]] = int.Parse(value[1]);
         }
         else
         {
             this.StringValues[value[0]] = value[1];
         }
     }
 }
Beispiel #2
0
        public void Run()
        {
            int                  N           = Inputs.Count;
            LogicObject          logicObject = new LogicObject(Ordered, Expression);
            List <DynamicObject> values      = new List <DynamicObject>();

            for (int i = 0; i < N; i++)
            {
                string ROW = Inputs[i];
                values.Add(new DynamicObject(ROW, logicObject));
            }
            IOrderedEnumerable <DynamicObject> result = GetOrders(values, logicObject.Instance.Dequeue());

            while (logicObject.Instance.Count > 0)
            {
                result = ThenOrders(result, logicObject.Instance.Dequeue());
            }
            foreach (DynamicObject dynamicObject in result)
            {
                Console.WriteLine(dynamicObject.Id);
            }
        }