Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tag"/> class.
        /// </summary>
        public Tag()
        {
            Type     = TagType.Tag;
            Area     = string.Empty;
            Childs   = new List <Tag>();
            IsActive = true;
            MetaData = new TagMetaData
            {
                Comment     = string.Empty,
                UnitForUser = string.Empty
            };

            ValueHasChanged = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tag" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="dataType">Type of the data.</param>
        /// <param name="adsPort">Optional ads port (Beckhoff only).</param>
        public Tag(string name, string scope, string dataType, int adsPort = 0, string area = "")
        {
            Type     = TagType.Tag;
            Name     = name;
            Scope    = scope;
            DataType = dataType;
            AdsPort  = adsPort;
            Area     = area;
            Childs   = new List <Tag>();
            IsActive = true;
            MetaData = new TagMetaData
            {
                Comment     = string.Empty,
                UnitForUser = string.Empty
            };

            ValueHasChanged = false;
        }
Ejemplo n.º 3
0
        public TagMetaData Parse(string rawString)
        {
            if (rawString.IsNullOrEmpty())
            {
                return(new TagMetaData());
            }

            var ret = new TagMetaData
            {
                Comment            = GetComment(rawString),
                ReadPointer        = TryParsePointer(rawString),
                EnumerationMembers = TryParseEnum(rawString)
            };

            if (!ret.EnumerationMembers.IsNullOrEmpty())
            {
                ret.Minimum = ret.EnumerationMembers.Min(m => m.Value);
                ret.Maximum = ret.EnumerationMembers.Max(m => m.Value);
            }

            return(ret);
        }