_Core/Lang/Plugins/Parser/EnvPlugin.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;


namespace ComLib.Lang.Extensions
{

    /* *************************************************************************
    <doc:example>	
    // Env plugin allows direct access to environment variables via the "env" object.
    
    // Example 1: Access to user variables only via the ".user" property of env.
    result = env.user.path;
    
    // Example 2: Access to system variables via the ".sys" property of env.
    result = env.sys.path;
    
    // Example 3: Access to environment variable without specifying sys or user.
    result = env.path;
    result = env.SystemRoot;
    </doc:example>
    ***************************************************************************/
    
    /// <summary>
    /// Token specifically for referencing environment variables.
    /// </summary>
    public class EnvToken : Token
    {
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="name"></param>
        public EnvToken(string scope, string name)
        {
            VarName = name;
            Scope = scope;

            if (!string.IsNullOrEmpty(scope))
                this._text = "env." + scope + "." + name;
            else
                this._text = "env." + name;            
        }


        /// <summary>
        /// Either sys or user
        /// </summary>
        public string Scope;


        /// <summary>
        /// The variable name.
        /// </summary>
        public string VarName;
    }

后面还有 154 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。