Exemple #1
0
        /// <summary>
        /// 根据service名称获取require引用代码
        /// </summary>
        /// <param name="service"></param>
        /// <returns>例如:Mysoft.Gtxt.GtFaMng.AppServices.GtFaAppService</returns>
        private string GetJs(string service)
        {
            // appService = require("Mysoft.Gtxt.GtFaMng.AppServices.GtFaAppService")
            string text = ExtUtil.FindCode(Dte.ActiveWindow, $@"\b{service}\s+=\s+require\([""|'].+?[""|']\)");

            string pattern = $@"(?<=\brequire\([""|']).+?(?=[""|']\))";
            string value   = Regex.Match(text, pattern, RegexOptions.IgnoreCase).Value;

            return(value.Trim());
        }