Пример #1
0
        public static bool TryParse(string value, out Scale scale)
        {
            var result = false;

            try
            {
                IScanner scanner = new ScaleScanner(value);
                var      parser  = new ScaleParser(scanner);

                parser.Execute();

                result = parser.ParseOK;
                scale  = parser.result;
            }
            catch (Exception x)
            {
#if USE_LOG4NET
                log.Debug($"ScaleParser: problem while parsing: '{x}'");
#endif
                result = false;
                scale  = null;
            }
            return(result);
        }
Пример #2
0
 /// <summary>
 /// TryParse: parse a readable form of a scale
 /// </summary>
 /// <param name="value">Readable representation of a scale</param>
 /// <param name="scale">Reference to a Scale variable</param>
 /// <returns>True if the parse was successfull and an instance is available in scale, false otherwise.</returns>
 public static bool TryParse(string value, out Scale scale)
 {
     return(ScaleParser.TryParse(value, out scale));
 }