Пример #1
0
        /// <summary>
        /// Creates a version literal token from the information supplied
        /// </summary>
        /// <param name="text">The text representing the version</param>
        /// <returns></returns>
        public static Token ToLiteralVersion(string text)
        {
            var val = Version.Parse(text);
            var lv  = new LVersion(val);

            return(new Token(TokenKind.LiteralOther, TokenTypes.LiteralVersion, text, lv));
        }
        /// <summary>
        /// Creates an analyzer of the given analyzer type.
        /// </summary>
        /// <returns>T type analyzer.</returns>
        public Analyzer GetAnalyzer()
        {
            var mkStopWords = new SortedSet <string>()
            {
            };

            var analyzer = new StopAnalyzer(LVersion.GetActiveVersion(), mkStopWords);

            return(analyzer);
        }
Пример #3
0
        /// <summary>
        /// Gets the version of the file specified.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static LVersion GetVersion(string path)
        {
            // ? This is a problem. Do not have the debug/source code information here.
            if (!System.IO.File.Exists(path))
            {
                throw new LangException("File not found", "File : " + path + " not found", string.Empty, 0, 0);
            }

            // Throw exception?
            var ext = Path.GetExtension(path);

            if (ext != "dll" && ext != "exe")
            {
                return(new LVersion(Version.Parse("0.0.0.0")));
            }

            var asm      = Assembly.LoadFrom(path);
            var version  = asm.GetName().Version;
            var lversion = new LVersion(version);

            return(lversion);
        }
        /// <summary>
        /// Creates an analyzer of the given analyzer type.
        /// </summary>
        /// <returns>T type analyzer.</returns>
        public StandardAnalyzer GetAnalyzer()
        {
            var analyzer = new StandardAnalyzer(LVersion.GetActiveVersion());

            return(analyzer);
        }