Statement UpdateValue(Property property, Optional <string> maybeValue, ValueParser valueParser)
        {
            // TODO: we should ensure that the bytecode is evaluated in the declaring environment of the object, until then reference properties can't be set
            // It could be that it's actually false that AtomicValue can be reference type, but hard to know
            // I'll just avoid setting reference properties i guess
            // ..I can't know what is a reference property in the tool, i should probably trigger reify from the simulator in response to setting the property


            return(property.MatchWith(
                       (BindableProperty bp) =>
            {
                if (bp.BindableType.FullName == "Fuse.Drawing.Brush")
                {
                    var solidColorBrush = TypeName.Parse("Fuse.Drawing.StaticSolidColor");
                    var float4 = TypeName.Parse("float4");
                    return maybeValue
                    .Select(value => valueParser.Parse(value, float4, FileSourceInfo.Unknown))
                    .MatchWith(
                        some: v => UpdateValue(property, new Instantiate(solidColorBrush, v.GetExpression(_ctx))),
                        none: () => ResetProperty(property));
                }

                throw new ReifyRequired();
            },
                       (AtomicProperty p) => maybeValue
                       .Select(value => valueParser.Parse(value, property.Facet.DataType, FileSourceInfo.Unknown))
                       .MatchWith(
                           some: v => UpdateValue(property, v.GetExpression(_ctx)),
                           none: () => ResetProperty(property)),
                       (DelegateProperty dp) =>
            {
                throw new ReifyRequired();
            }));
        }
Esempio n. 2
0
        public void TestParse()
        {
            ValueParser <string> parser = new ValueParser <string>(s => "PARSED VALUE >>>" + s + "<<<", s => s);

            Assert.Equal("PARSED VALUE >>>SOME TEXT<<<", parser.Parse("SOME TEXT"));
            Assert.Equal("PARSED VALUE >>>OTHER STUFF<<<", parser.Parse("OTHER STUFF"));
        }
Esempio n. 3
0
        public void ShouldParseSimpleStatic()
        {
            var termValue = ValueParser.Parse("I am simple");

            termValue.CSharpStringFormatValue.ShouldEqual("I am simple");
            termValue.Parameters.Count.ShouldEqual(0);
        }
Esempio n. 4
0
        public void ParseBool()
        {
            var args = new ParserState(new[] { "true" });
            var p    = new ValueParser();

            Assert.That((bool)p.Parse(args, typeof(bool)) !);
        }
Esempio n. 5
0
        public OperationDetails AddHistory(string value, int sensorId)
        {
            var history = new History
            {
                Date     = DateTimeOffset.Now,
                SensorId = sensorId,
            };

            var sensor = unitOfWork.SensorRepo.GetById(sensorId).Result;

            if (sensor == null)
            {
                return(new OperationDetails(false, "Operation did not succeed!", ""));
            }

            dynamic valueModel;

            if (sensor.IsValid)
            {
                valueModel = ValueParser.Parse(value, sensor.SensorType.MeasurementType);
            }
            else
            {
                valueModel = ValueParser.Parse(value);
            }

            if (valueModel is int)
            {
                history.IntValue = valueModel;
            }
            else
            if (valueModel is double)
            {
                history.DoubleValue = valueModel;
            }
            else
            if (valueModel is bool)
            {
                history.BoolValue = valueModel;
            }
            else
            {
                history.StringValue = valueModel;
            }


            if (!CheckValue(history) || sensor.IsActive == false)
            {
                return(new OperationDetails(false, "Operation did not succeed!", ""));
            }

            unitOfWork.HistoryRepo.Insert(history);
            unitOfWork.Save();

            return(new OperationDetails(true, "Operation succeed", "", new Dictionary <string, object>()
            {
                { "id", history.Id }
            }));
        }
Esempio n. 6
0
        public void Parse_Success(LangCode code, DateTime updateDate, string content,
                                  double expectedNumber, DateTime expectedDate)
        {
            var message = new TextUpdateMessage()
            {
                LanguageCode   = code,
                Content        = content,
                UpdateDatetime = updateDate,
            };

            (Value value, string error) = _parser.Parse(message);

            Assert.NotNull(value);
            Assert.Null(error);
            Assert.Equal(value.Content, expectedNumber);
            EqualDateTimeToMinutes(value.ValueDate, expectedDate);
        }
Esempio n. 7
0
        public void ParseStringArray()
        {
            var data   = new[] { "a", "b", "c" };
            var args   = new ParserState(data);
            var p      = new ValueParser();
            var parsed = (string[])p.Parse(args, typeof(string[])) !;

            Assert.That(parsed.SequenceEqual(data));
        }
        public Models.SystemBlockHull Map(Component component)
        {
            Models.SystemBlockHull systemBlockHull = new Models.SystemBlockHull
            {
                Type  = ComponentType.SystemBlockHull,
                Id    = component.Id,
                Title = component.Title,
                Price = component.Price
            };

            Int32 width  = parser.Parse(component.Values, "width");
            Int32 height = parser.Parse(component.Values, "height");
            Int32 length = parser.Parse(component.Values, "length");

            systemBlockHull.AvailablePowerSupplySize = new Tuple <Int32, Int32, Int32>(width, height, length);

            return(systemBlockHull);
        }
Esempio n. 9
0
        public PowerSupply Map(Component component)
        {
            PowerSupply powerSupply = new PowerSupply
            {
                Type  = ComponentType.PowerSupply,
                Id    = component.Id,
                Title = component.Title,
                Price = component.Price
            };

            powerSupply.Power = parser.Parse(component.Values, "power");

            Int32 width  = parser.Parse(component.Values, "width");
            Int32 height = parser.Parse(component.Values, "height");
            Int32 length = parser.Parse(component.Values, "length");

            powerSupply.Size = new Tuple <Int32, Int32, Int32>(width, height, length);

            return(powerSupply);
        }
Esempio n. 10
0
        public void ShouldParseSimpleDynamicWithType()
        {
            var termValue = ValueParser.Parse("I am {age#int}");

            termValue.CSharpStringFormatValue.ShouldEqual("I am {0}");
            termValue.Parameters.Count.ShouldEqual(1);
            termValue.Parameters[0].Name.ShouldEqual("age");
            termValue.Parameters[0].Type.ShouldEqual("int");
            termValue.Parameters[0].Index.ShouldEqual(0);
            termValue.Parameters[0].Format.ShouldBeNull();
        }
Esempio n. 11
0
        public void ShouldParseSimpleDynamicTypeWithFormatting()
        {
            var termValue = ValueParser.Parse("My birthday is {birthday:dd/MM/yyyy#DateTime}");

            termValue.CSharpStringFormatValue.ShouldEqual("My birthday is {0:dd/MM/yyyy}");
            termValue.Parameters.Count.ShouldEqual(1);
            termValue.Parameters[0].Name.ShouldEqual("birthday");
            termValue.Parameters[0].Type.ShouldEqual("DateTime");
            termValue.Parameters[0].Index.ShouldEqual(0);
            termValue.Parameters[0].Format.ShouldEqual("dd/MM/yyyy");
        }
Esempio n. 12
0
 public void ParseValue(ValueParser parser)
 {
     if (!string.IsNullOrEmpty(Value))
     {
         Parsed = parser.Parse(Parameter.Type, Value);
     }
     else if (Parameter != null)
     {
         Parsed = Parameter.DefaultValue;
     }
 }
Esempio n. 13
0
            public void Should_Parse_Content_Recursivly()
            {
                // Given
                var commentParser = Substitute.For <ICommentParser>();
                var nodeParser    = new ValueParser();
                var node          = "<value>Hello World</value>".CreateXmlNode();

                // When
                nodeParser.Parse(commentParser, node);

                // Then
                commentParser.Received(1).Parse(Arg.Any <XmlNode>());
            }
Esempio n. 14
0
 public void ValueParsingError()
 {
     try
     {
         m_Parser.Parse <int>("a123");
         TestHelper.ExpectException <MissingValueParserException>();
     }
     catch (InvalidValueFormatException e)
     {
         Assert.AreEqual(typeof(int), e.ExpectedType);
         Assert.AreEqual("a123", e.RawValue);
     }
 }
Esempio n. 15
0
        public bool SetProperty(string propertyName, object value,
                                PropertyNameSource propertyNameSource = PropertyNameSource.Default)
        {
            if (string.IsNullOrEmpty(propertyName))
            {
                return(false);
            }

            var parsedProperty = _valueParser.Parse(value);

            if (!parsedProperty.IsValid)
            {
                return(false);
            }

            string bindingProp;

            if (_specialPropsBindings.TryGetValue(propertyName.ToLower(), out bindingProp))
            {
                SpecialProps[bindingProp] = parsedProperty.Value;
            }
            else
            {
                switch (_messagePropetiesRules)
                {
                case MessagePropetiesRules.None:
                    break;

                case MessagePropetiesRules.NumericsOnly:
                    if (!_valueParser.IsNumeric(parsedProperty.Value))
                    {
                        return(false);
                    }
                    break;

                case MessagePropetiesRules.ListsOnly:
                    if (!_valueParser.IsEnumerable(parsedProperty.Value))
                    {
                        return(false);
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                Props[_nameFormatter.Format(propertyName, propertyNameSource)] = parsedProperty.Value;
            }

            return(true);
        }
Esempio n. 16
0
        public Processor Map(Component component)
        {
            Processor processor = new Processor
            {
                Type  = ComponentType.Processor,
                Id    = component.Id,
                Title = component.Title,
                Price = component.Price
            };

            processor.NeededPower = parser.Parse(component.Values, "needed_power");

            return(processor);
        }
        public MemoryCard Map(Component component)
        {
            MemoryCard memoryCard = new MemoryCard
            {
                Type  = ComponentType.MemoryCard,
                Id    = component.Id,
                Title = component.Title,
                Price = component.Price
            };

            memoryCard.NeededPower = parser.Parse(component.Values, "needed_power");

            return(memoryCard);
        }
Esempio n. 18
0
        public async Task ShowMessage(Guid token, string value)
        {
            var sensor        = unitOfWork.SensorRepo.GetByToken(token);
            var notifications = await unitOfWork.NotificationRepo.GetBySensorId(sensor.Id);

            if (notifications.Any())
            {
                foreach (var notification in notifications)
                {
                    var incomingValue = ValueParser.Parse(value);
                    var ruleValue     = ValueParser.Parse(notification.Value);
                    if (incomingValue.CompareTo(ruleValue) == (int)notification.Rule)
                    {
                        string toasttype = notification.NotificationType.ToString().ToLower();
                        string message   = notification.Message;
                        message = message.Replace("$Value$", value + sensor.SensorType.MeasurementName);
                        message = message.Replace("$SensorName$", sensor.Name);

                        await messageHub.Clients.User(sensor.User.UserName)
                        .SendAsync("ShowToastMessage", toasttype, message);
                    }
                }
            }
        }
Esempio n. 19
0
        public IEnumerable <AssetInstruction>?RunPatch(IEnumerable <PropertyData> propData, string inputValue)
        {
            var parsed = ValueParser.Parse(inputValue);

            return(RunPatch(propData, parsed));
        }
Esempio n. 20
0
        public static (string result, BluetoothCompanyIdentifier.CommonManufacturerType manufacturerType) Parse(BluetoothLEAdvertisementDataSection section, sbyte txPower, string indent)
        {
            string        str = "??";
            byte          b   = section.DataType;
            DataTypeValue dtv = ConvertDataTypeValue(b); // get the enum value

            BluetoothCompanyIdentifier.CommonManufacturerType manufacturerType = BluetoothCompanyIdentifier.CommonManufacturerType.Other;
            try
            {
                var printAsHex = false;
                switch (dtv)
                {
                case DataTypeValue.ManufacturerData:
                    (str, manufacturerType) = BluetoothCompanyIdentifier.ParseManufacturerData(section, txPower);
                    break;

                case DataTypeValue.Flags:
                    str = ParseFlags(section);
                    break;

                case DataTypeValue.ShortenedLocalName:
                {
                    var buffer = section.Data.ToArray();
                    var allNul = true;
                    foreach (var namebyte in buffer)
                    {
                        if (namebyte != 0)
                        {
                            allNul = false;
                        }
                    }
                    if (allNul)
                    {
                        str = "";
                    }
                    else
                    {
                        printAsHex = true;
                    }
                }
                break;

                case DataTypeValue.TxPowerLevel:
                    var db = ParseTxPowerLevel(section);
                    str = $"{db}";
                    break;

                default:
                    printAsHex = true;
                    break;
                }
                if (printAsHex)
                {
                    var result = ValueParser.Parse(section.Data, "BYTES|HEX");
                    str = $"section {dtv.ToString()} data={result.AsString}\n";
                }
            }
            catch (Exception)
            {
                var result = ValueParser.Parse(section.Data, "BYTES|HEX");
                str = $"error section {section.DataType} data={result.AsString}\n";
            }
            if (!string.IsNullOrWhiteSpace(str))
            {
                str = indent + str;
            }
            return(str, manufacturerType);
        }
Esempio n. 21
0
        public void Parse_String_Parsed()
        {
            var val = _vp.Parse("str");

            Assert.That(val.Value, Is.EqualTo("str"));
            Assert.That(val.IsValid, Is.True);
        }
Esempio n. 22
0
        public void TestParse__NullThrows()
        {
            ValueParser <string> parser = new ValueParser <string>(s => "PARSED VALUE >>>" + s + "<<<", s => s);

            Assert.Throws <ArgumentNullException>(() => parser.Parse(null));
        }
Esempio n. 23
0
 public void ParseValue(string value, CardValue expected)
 {
     ValueParser p = new ValueParser();
     Assert.AreEqual(expected, p.Parse(value) );
 }
Esempio n. 24
0
            static public bool Run(string script, Loop caller = null)
            {
                if (StatusMonitor.waiting && !script.StartsWith("*"))
                {
                    StatusMonitor.pausedScr.Add(script);
                    return(true);
                }

                DbgOutput.Write(script);

                List <string> cachecopy;
                string        _script = script.Trim().TrimStart('*');

                if (_script == "" || _script.StartsWith("#"))
                {
                    return(true);
                }

                if (_script.StartsWith("@"))
                {
                    new Loop(_script.Trim('@'));
                    return(true);
                }

                if (_script.Contains("?"))
                {
                    if (!_script.Split('?')[0].Contains(":")) // this is added because sometimes the argument for a command contains ?
                    {
                        if (!ConditionParser.Parse(_script.Split('?')[0]))
                        {
                            return(true);
                        }
                        else
                        {
                            _script = script.Split('?')[1];
                        }
                    }
                }

                if (_script.Contains(";"))
                {
                    RunFromList(new List <string>(_script.Split(';')));
                    return(true);
                }


                if (_script.Contains("=") && !_script.Contains("?") && !_script.Contains(":"))
                {
                    //local variable
                    if (_script.StartsWith("$"))
                    {
                        if (localVars.ContainsKey(_script.Split('=')[0].Trim()))
                        {
                            localVars[_script.Split('=')[0].Trim()] = ValueParser.Parse(_script.Substring(_script.IndexOf('=') + 1, _script.Length - _script.IndexOf('=') - 1).Trim());
                        }
                        else
                        {
                            localVars.Add(_script.Split('=')[0].Trim(), ValueParser.Parse(_script.Substring(_script.IndexOf('=') + 1, _script.Length - _script.IndexOf('=') - 1).Trim()));
                        }
                    }
                    else if (Configuration.usrDef.ContainsKey(_script.Split('=')[0].Trim()))
                    {
                        Configuration.usrDef[_script.Split('=')[0].Trim()] = ValueParser.Parse(_script.Substring(_script.IndexOf('=') + 1, _script.Length - _script.IndexOf('=') - 1).Trim());
                    }
                    else
                    {
                        Configuration.usrDef.Add(_script.Split('=')[0].Trim(), ValueParser.Parse(_script.Substring(_script.IndexOf('=') + 1, _script.Length - _script.IndexOf('=') - 1).Trim()));
                    }
                    return(true);
                }


                Script scr = new Script(_script);

                switch (scr.Command.Trim())
                {
                case "":

                    break;

                case "WAIT":
                    if (caller != null)
                    {
                        System.Threading.Thread.Sleep(Convert.ToInt32(scr.Args));
                    }
                    else
                    {
                        StatusMonitor.waiting  = true;
                        StatusMonitor.waittime = Convert.ToInt32(scr.Args);
                    }
                    break;

                case "WAITFORRESP":
                    StatusMonitor.CurrentStatus = "WAITFORRESP";
                    break;

                case "END":
                    return(false);

                case "BREAK":
                    if (caller != null)
                    {
                        caller.Break();
                    }
                    break;

                case "SHOWFRM":
                    if (!parent.Visible)
                    {
                        frm.ShowForm();
                    }
                    break;

                case "HIDEFRM":
                    if (parent.Visible)
                    {
                        frm.HideForm();
                        StatusMonitor.CurrentStatus = "HIDDEN";
                    }
                    break;

                case "CLOSEFRM":
                    frm.CloseForm();
                    break;

                case "RESTART":
                    Application.Restart();
                    break;

                case "EXEC":
                    if (scr.Args.Contains("$"))
                    {
                        if (scr.Args.Split('$')[0].Trim().EndsWith(".exe") && !scr.Args.Trim().StartsWith("*"))
                        {
                            IOChannel Eng = new IOChannel(scr.Args.Split('$')[0].Trim(), scr.Args.Split('$')[0].Trim(), scr.Args.Split('$')[1].Trim());
                            Eng.Start();
                        }
                        else
                        {
                            Process.Start(scr.Args.Split('$')[0].Trim().Trim('*'), scr.Args.Split('$')[1].Trim());
                        }
                    }
                    else
                    {
                        if (scr.Args.Trim().EndsWith(".exe") && !scr.Args.Trim().StartsWith("*"))
                        {
                            IOChannel Eng = new IOChannel(scr.Args.Trim(), scr.Args.Trim(), "");
                            Eng.Start();
                        }
                        else
                        {
                            Process.Start(scr.Args.Trim().Trim('*'));
                        }
                    }
                    break;
                //case "LOCK":
                //    StatusMonitor.LockedStatus.Push(StatusMonitor.CurrentStatus);
                //    break;
                //case "JOIN":
                //    if (StatusMonitor.LockedStatus.Count != 0)
                //    {
                //        StatusMonitor.CurrentStatus = StatusMonitor.LockedStatus.Pop();
                //        if (StatusMonitor.CurrentStatus != "WAITFORRESP")
                //        {
                //            StatusMonitor.waitingforresp = false;

                //            cachecopy = new List<string>(cache);
                //            foreach (string line in cachecopy)
                //            {
                //                DbgOutput.Write(line);
                //            }
                //            RunFromList(cachecopy);
                //            foreach (string line in cachecopy)
                //            {
                //                cache.Remove(line);
                //            }

                //        }
                //    }
                //    break;
                case "IMG":
                    StatusMonitor.currentAniFrames.Clear();
                    frm.PutImg(scr.Args.Trim());
                    break;

                case "_IMG":     //internal use only, for putting animation frames
                    frm.PutImg(scr.Args.Trim());
                    break;

                case "ANIMATE":
                    StatusMonitor.currentAniFrames.Clear();
                    StatusMonitor.currentFrame = 0;
                    foreach (string path in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Media\img\" + scr.Args.Trim().Trim('\\') + @"\", "*.png", SearchOption.TopDirectoryOnly))
                    {
                        StatusMonitor.currentAniFrames.Add(path.Replace(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Media\img\", ""));
                    }
                    break;

                case "MSG":
                    Notifier.ShowMsg(scr.Args);
                    break;

                case "POSX":
                    frm.PosX(Convert.ToInt32(scr.Args.Trim()));
                    break;

                case "POSY":
                    frm.PosY(Convert.ToInt32(scr.Args.Trim()));
                    break;

                case "ACTIVATE":
                    frm.Activate();
                    break;

                case "ERROR":
                    Notifier.ErrorMsg(scr.Args);
                    break;

                case "SCRIPT":
                    if (scr.Args.Contains("."))
                    {
                        RunFromFile(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Scripts\" + scr.Args.Split('.')[0].Trim(), scr.Args.Split('.')[1]);
                    }
                    else
                    {
                        RunFromFile(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Scripts\" + scr.Args.Trim());
                    }
                    break;

                case "STATUS":
                    StatusMonitor.CurrentStatus = scr.Args.Trim();
                    if (StatusMonitor.CurrentStatus != "WAITFORRESP")
                    {
                        cachecopy = new List <string>(cache);
                        foreach (string line in cachecopy)
                        {
                            DbgOutput.Write(line);
                            cache.Remove(line);
                        }
                        RunFromList(cachecopy);
                    }
                    break;

                case "SOUND":
                    SoundPlayer.Play(scr.Args.Trim());
                    break;

                default:
                    try
                    {
                        IOChannel Eng = new IOChannel(scr.Command.Trim(), Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Routines\" + scr.Command.Trim() + ".exe", scr.Args);
                        Eng.Start();
                    }
                    catch
                    {
                        Notifier.ErrorMsg("Unable to " + scr.Command.Trim() + " " + scr.Args.Trim() + ". \nMake sure all necessary files are under \"Routines\".");
                    }
                    break;
                }

                return(true);
            }
Esempio n. 25
0
            static public bool Parse(string cond)
            {
                DbgOutput.Write("PARSING COND:" + cond);

                if (cond == "TRUE")
                {
                    return(true);
                }
                if (cond == "FALSE")
                {
                    return(false);
                }

                if (Configuration.usrDef.ContainsKey(cond))
                {
                    return(Convert.ToBoolean(Configuration.usrDef[cond]));
                }

                if (cond.StartsWith("~") && cond.IndexOfAny(op) == -1) //Negation
                {
                    return(!Parse(cond.Trim('~')));
                }

                if (cond.IndexOfAny(op) == -1)                                  //if there are no operators, then the condition is a status check
                {
                    if (ValueParser.Parse(cond) == StatusMonitor.CurrentStatus) //Status condition
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    if (cond.IndexOf('(') != -1)
                    {
                        tmp = cond.Substring(cond.LastIndexOf("("), cond.IndexOf(")") - cond.LastIndexOf("(") + 1);
                        return(Parse(cond.Replace(tmp, Parse(tmp.Trim(brac)).ToString().ToUpper())));
                    }

                    if (cond.IndexOf('&') != -1)
                    {
                        return(Parse(cond.Split('&')[0].Trim()) && Parse(cond.Replace(cond.Split('&')[0] + "&", "")));
                    }
                    if (cond.IndexOf('|') != -1)
                    {
                        return(Parse(cond.Split('|')[0].Trim()) || Parse(cond.Replace(cond.Split('|')[0] + "|", "")));
                    }
                    if (cond.IndexOf('=') != -1)
                    {
                        parsed = cond.Split('=');

                        if (parsed[0].Trim() == parsed[1].Trim())
                        {
                            return(true);
                        }

                        //check user-defined variables
                        if (Configuration.usrDef.ContainsKey(parsed[0].Trim()))
                        {
                            return(ValueParser.Parse(parsed[1]).Trim() == Configuration.usrDef[parsed[0]]);
                        }

                        //check time variables
                        switch (parsed[0].Trim())
                        {
                        case "Y":
                            return(DateTime.Now.Year == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "M":
                            return(DateTime.Now.Month == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "D":
                            return(DateTime.Now.Day == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "h":
                            return(DateTime.Now.Hour == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "m":
                            return(DateTime.Now.Minute == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "s":
                            return(DateTime.Now.Second == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "d":
                            return(Convert.ToInt32(DateTime.Now.DayOfWeek) == Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        default:
                            return(false);
                        }
                    }
                    if (cond.IndexOf('>') != -1)
                    {
                        parsed = cond.Split('>');


                        //if (Convert.ToInt32(parsed[0].Trim()) > Convert.ToInt32(parsed[1].Trim()))
                        //{
                        //    return true;
                        //}


                        //check user-defined variables
                        if (Configuration.usrDef.ContainsKey(parsed[0].Trim()))
                        {
                            return(Convert.ToInt32(Configuration.usrDef[parsed[0]].Trim()) > Convert.ToInt32(ValueParser.Parse(parsed[1]).Trim()));
                        }

                        switch (parsed[0].Trim())
                        {
                        case "Y":
                            return(DateTime.Now.Year > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "M":
                            return(DateTime.Now.Month > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "D":
                            return(DateTime.Now.Day > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "h":
                            return(DateTime.Now.Hour > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "m":
                            return(DateTime.Now.Minute > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "s":
                            return(DateTime.Now.Second > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "d":
                            return(Convert.ToInt32(DateTime.Now.DayOfWeek) > Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        default:
                            return(false);
                        }
                    }
                    if (cond.IndexOf('<') != -1)
                    {
                        parsed = cond.Split('<');

                        //if (Convert.ToInt32(parsed[0].Trim()) < Convert.ToInt32(parsed[1].Trim()))
                        //{
                        //    return true;
                        //}

                        //check user-defined variables
                        if (Configuration.usrDef.ContainsKey(parsed[0].Trim()))
                        {
                            return(Convert.ToInt32(Configuration.usrDef[parsed[0]]) < Convert.ToInt32(ValueParser.Parse(parsed[1]).Trim()));
                        }

                        switch (parsed[0].Trim())
                        {
                        case "Y":
                            return(DateTime.Now.Year < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "M":
                            return(DateTime.Now.Month < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "D":
                            return(DateTime.Now.Day < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "h":
                            return(DateTime.Now.Hour < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "m":
                            return(DateTime.Now.Minute < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "s":
                            return(DateTime.Now.Second < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        case "d":
                            return(Convert.ToInt32(DateTime.Now.DayOfWeek) < Convert.ToInt32(ValueParser.Parse(parsed[1])));

                        default:
                            return(false);
                        }
                    }
                }


                return(false);
            }