Beispiel #1
0
        public void Process(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return;
            }

            Match match = Regex.Match(data, Evaluator);

            string rawType  = match.Groups[1].Value;
            string name     = match.Groups[2].Value;
            string rawValue = match.Groups[3].Value;

            Type    type    = DataRef.ParseType(rawType);
            object  value   = DataRef.ParseValue(rawValue, type);
            DataRef dataRef = DataRefRepository.Get(name, type);

            dataRef.SetValue(value);
#if DEBUG
            var oldColor = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("{0}: {1}", dataRef.Name, value);
            Console.ForegroundColor = oldColor;
#endif
        }
        public void Process(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return;
            }

            Match match = Regex.Match(data, Evaluator);

            string rawType  = match.Groups[1].Value;
            string name     = match.Groups[2].Value;
            string rawValue = match.Groups[3].Value;

            Type    type    = DataRef.ParseType(rawType);
            object  value   = DataRef.ParseValue(rawValue, type);
            DataRef dataRef = DataRefRepository.Get(name, type);

            //if (dataRef == null)
            //{

            //    dataRef = DataRefRepository.Get(name, typeof(string));
            //    var dfdsf = "sdfdsf";
            //}



            dataRef.SetValue(value);
        }
Beispiel #3
0
        public DataRef <T> GetDataRef <T>(string dataRef)
        {
            if (string.IsNullOrWhiteSpace(dataRef))
            {
                throw new ArgumentNullException("dataRef");
            }

            if (!DataRefs.Contains(dataRef))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Can't get dataref value: dataref {0} isn't subscribed to", dataRef));
            }

            return(DataRefs.Get <T>(dataRef));
        }