Exemple #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 ComLib.Lang.Types.LVersion(val);

            return(new Token(TokenKind.LiteralOther, TokenTypes.LiteralVersion, text, lv));
        }
Exemple #2
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;
        }
Exemple #3
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 ComLib.Lang.Types.LVersion(val);
     return new Token(TokenKind.LiteralOther, TokenTypes.LiteralVersion, text, lv);
 }