public MetaText ToMetaText()
        {
            MetaText metaText = new MetaText(Text);

            metaText += " ";

            if (UnitBeforeValue)
            {
                metaText += Unit.ToString();
                if (UseSpaceForUnit)
                {
                    metaText += " ";
                }
                metaText += Value.ToString();
            }
            else
            {
                metaText += Value.ToString();
                if (UseSpaceForUnit)
                {
                    metaText += " ";
                }
                metaText += Unit.ToString();
            }

            return(metaText);
        }
 public MetaValued(MetaText text, T value, MetaText unit, bool unitSpace = true, bool unitFirst = false, int?id = null)
 {
     ID    = id;
     Text  = text;
     Value = value;
     if (unit.ToString().Any(char.IsDigit))
     {
         throw new ArgumentException("Единица измерения не должна содержать цифры!");
     }
     Unit            = unit;
     UseSpaceForUnit = unitSpace;
     UnitBeforeValue = unitFirst;
 }
Exemple #3
0
        public MetaText ToMetaText()
        {
            MetaText metaText = new MetaText();

            foreach (var pair in mainDict)
            {
                metaText.Append((MetaText)pair.Key);
                metaText.Append(middleSeparator);
                metaText.Append(pair.Value);
                metaText.Append(pairsSeparator);
            }

            if (aggregator != null)
            {
                metaText.Append(aggregator.Invoke(mainDict));
            }

            return(metaText);
        }
Exemple #4
0
 public void Append(MetaText part)
 {
     Append((IEnumerable <string>)part);
 }
Exemple #5
0
 public bool Equals(MetaText other)
 {
     return(other != null &&
            EqualityComparer <Queue <string> > .Default.Equals(parts, other.parts));
 }