Exemplo n.º 1
0
 public CCOLElement(string naam, int instelling, CCOLElementTimeTypeEnum ttype, CCOLElementTypeEnum type, string description = null)
 {
     Dummy      = false;
     Naam       = naam;
     Define     = CCOLGeneratorSettingsProvider.Default.GetPrefix(type) + naam;
     Instelling = instelling;
     TType      = ttype;
     Type       = type;
     Commentaar = description;
 }
Exemplo n.º 2
0
 public CCOLElement(string naam, CCOLElementTypeEnum type, string description = null)
 {
     Dummy      = false;
     Naam       = naam;
     Define     = CCOLGeneratorSettingsProvider.Default.GetPrefix(type) + naam;
     Type       = type;
     Commentaar = description;
     TType      = Type switch
     {
         CCOLElementTypeEnum.Schakelaar => CCOLElementTimeTypeEnum.SCH_type,
         _ => CCOLElementTimeTypeEnum.None
     };
 }
Exemplo n.º 3
0
        public Generators.CCOL.CodeGeneration.CCOLElementTimeTypeEnum ConvertType(CCOLElementTypeEnum type)
        {
            switch (type)
            {
            case CCOLElementTypeEnum.TE_type:
                return(Generators.CCOL.CodeGeneration.CCOLElementTimeTypeEnum.TE_type);

            case CCOLElementTypeEnum.TS_type:
                return(Generators.CCOL.CodeGeneration.CCOLElementTimeTypeEnum.TS_type);

            case CCOLElementTypeEnum.TM_type:
                return(Generators.CCOL.CodeGeneration.CCOLElementTimeTypeEnum.TM_type);

            case CCOLElementTypeEnum.Geen:
            default:
                return(Generators.CCOL.CodeGeneration.CCOLElementTimeTypeEnum.None);
            }
        }
Exemplo n.º 4
0
        public CCOLElement(string naam, CCOLElementTypeEnum type, string description = null)
        {
            Dummy      = false;
            Naam       = naam;
            Define     = CCOLGeneratorSettingsProvider.Default.GetPrefix(type) + naam;
            Type       = type;
            Commentaar = description;
            switch (Type)
            {
            case CCOLElementTypeEnum.Schakelaar:
                TType = CCOLElementTimeTypeEnum.SCH_type;
                break;

            default:
                TType = CCOLElementTimeTypeEnum.None;
                break;
            }
        }
Exemplo n.º 5
0
 public override IEnumerable <CCOLElement> GetCCOLElements(CCOLElementTypeEnum type)
 {
     return(_MyElements.Where(x => x.Type == type));
 }
        public string GetElementDescription(string description, CCOLElementTypeEnum type, params string [] elementnames)
        {
            if (description == null)
            {
                return(null);
            }
            var descr = description;
            var i     = 1;

            foreach (var e in elementnames)
            {
                if (e == null)
                {
                    continue;
                }
                descr = descr.Replace("_E" + i + "_", e);
                ++i;
            }
            // Remove empty tags
            descr = Regex.Replace(descr, @"\s_E[0-9]_", "");
            var finalDescr = descr;

            if (!CCOLGeneratorSettingsProvider.Default.Settings.ReplaceRepeatingCommentsTextWithPeriods)
            {
                return(descr);
            }

            // Check last line
            if (_lastItemDescription.ContainsKey(type))
            {
                var re        = new Regex("[0-9]+");
                var re2       = new Regex(@"[a-zA-Z0-9\(\)]");
                var words     = descr.Split(' ');
                var lastWords = _lastItemDescription[type].Split(' ');
                var isSame    = true;
                if (words.Length == lastWords.Length)
                {
                    for (var j = 0; j < words.Length; j++)
                    {
                        if (!(words[j] == lastWords[j] || /*words[j].Length == lastWords[j].Length &&*/ re.IsMatch(words[j])))
                        {
                            isSame = false;
                            break;
                        }
                    }
                    if (isSame)
                    {
                        descr = "";
                        for (var j = 0; j < words.Length; j++)
                        {
                            if (descr != "")
                            {
                                descr += ".";
                            }
                            if (words[j] == lastWords[j])
                            {
                                descr += re2.Replace(words[j], ".");
                            }
                            else
                            {
                                descr += words[j];
                            }
                        }
                    }
                }
                _lastItemDescription[type] = finalDescr;
            }
            else
            {
                _lastItemDescription.Add(type, finalDescr);
            }

            return(descr);
        }
 public CCOLElement CreateElement(string name, int setting, CCOLElementTimeTypeEnum timeType, CCOLElementTypeEnum type, string description)
 {
     return(new CCOLElement(name, setting, timeType, type, GetElementDescription(description, type)));
 }
Exemplo n.º 8
0
 public virtual IEnumerable <CCOLElement> GetCCOLElements(CCOLElementTypeEnum type)
 {
     return(_myElements.Where(x => x.Type == type));
 }
Exemplo n.º 9
0
 public virtual IEnumerable <CCOLElement> GetCCOLElements(CCOLElementTypeEnum type)
 {
     throw new NotSupportedException();
 }