Beispiel #1
0
        protected override object DoVisit(SimpleFormat simpleFormat)
        {
            object argument = Visit(simpleFormat.Argument);
            object format   = Visit(simpleFormat.FormatString);

            if (argument == Error || format == Error)
            {
                return(null);
            }

            string formattedArgument = Format(argument, (string)format);

            int padding = simpleFormat.Width - formattedArgument.Length;

            if (padding > 0)
            {
                if (simpleFormat.LeftAlign)
                {
                    formatted.Append(formattedArgument);
                    formatted.Append(' ', padding);
                }
                else
                {
                    formatted.Append(' ', padding);
                    formatted.Append(formattedArgument);
                }
            }
            else
            {
                formatted.Append(formattedArgument);
            }

            return(null);
        }
Beispiel #2
0
        public string doSimpleToString(SimpleFormat vEn)
        {
            string _rec     = "";
            string _cmdName = vEn.v00_cmdName.ToString();
            string _format  = _faim3.dict_CmdFormats[_cmdName].Format;//[2];

            _rec = string.Format(_format, _cmdName, vEn.v01_AxisNum.ToString("X").PadLeft(2, '0'));
            return(_rec);
        }
Beispiel #3
0
 public object Visit(SimpleFormat simpleFormat)
 {
     return(DoVisit(Utilities.ThrowIfNull(simpleFormat, "simpleFormat")));
 }
Beispiel #4
0
 protected virtual object DoVisit(SimpleFormat simpleFormat)
 {
     return(Default(simpleFormat));
 }