示例#1
0
        private static string GenerateProxy(IHubManager hubManager, IJavaScriptMinifier javaScriptMinifier, bool includeDocComments)
        {
            string script = _templateFromResource.Value;

            var hubs  = new StringBuilder();
            var first = true;

            foreach (var descriptor in hubManager.GetHubs().OrderBy(h => h.Name))
            {
                if (!first)
                {
                    hubs.AppendLine(";");
                    hubs.AppendLine();
                    hubs.Append("    ");
                }
                GenerateType(hubManager, hubs, descriptor, includeDocComments);
                first = false;
            }

            if (hubs.Length > 0)
            {
                hubs.Append(";");
            }

            script = script.Replace("/*hubs*/", hubs.ToString());

            return(javaScriptMinifier.Minify(script));
        }
示例#2
0
 public ScriptPipeline_Tests()
 {
     minifier = Mock.Of<IJavaScriptMinifier>();
     urlGenerator = Mock.Of<IUrlGenerator>();
     var container = new TinyIoCContainer();
     settings = new CassetteSettings();
     container.Register(minifier);
     container.Register(urlGenerator);
     container.Register(settings);
     pipeline = new ScriptPipeline(container, settings);
 }
示例#3
0
        public ScriptPipeline_Tests()
        {
            minifier     = Mock.Of <IJavaScriptMinifier>();
            urlGenerator = Mock.Of <IUrlGenerator>();
            var container = new TinyIoCContainer();

            settings = new CassetteSettings();
            container.Register(minifier);
            container.Register(urlGenerator);
            container.Register(settings);
            pipeline = new ScriptPipeline(container, settings);
        }
示例#4
0
 private string MinifyJavaScript(List <string> files, IJavaScriptMinifier minifier)
 {
     try
     {
         var inputJavaScript = new StringBuilder();
         foreach (var file in files)
         {
             inputJavaScript.Append(ReadFile(file) + "\n");
         }
         return(minifier.CompressContent(inputJavaScript.ToString()));
     }
     catch (Exception e)
     {
         throw new Exception(string.Format("Error processing: {0}", e.Message), e);
     }
 }
示例#5
0
 public MenusController(
     IMenusAppService menuAppService,
     IUserAppService userAppService,
     INavigationScriptManager navigationScriptManager,
     ITenantCache tenantCache,
     IRepository <User, long> userRepository,
     IJavaScriptMinifier javaScriptMinifier,
     ISessionAppService sessionAppService,
     TenantManager tenantManager,
     ITenantAppService tenantAppService,
     IUnitOfWorkManager unitOfWorkManager)
 {
     _menuAppService          = menuAppService;
     _userRepository          = userRepository;
     _navigationScriptManager = navigationScriptManager;
     _javaScriptMinifier      = javaScriptMinifier;
     _tenantAppService        = tenantAppService;
     _sessionAppService       = sessionAppService;
     _tenantManager           = tenantManager;
     _unitOfWorkManager       = unitOfWorkManager;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public AbpScriptsController(
     IMultiTenancyScriptManager multiTenancyScriptManager,
     ISettingScriptManager settingScriptManager,
     INavigationScriptManager navigationScriptManager,
     ILocalizationScriptManager localizationScriptManager,
     IAuthorizationScriptManager authorizationScriptManager,
     IFeaturesScriptManager featuresScriptManager,
     ISessionScriptManager sessionScriptManager,
     ITimingScriptManager timingScriptManager,
     ISecurityScriptManager securityScriptManager,
     IJavaScriptMinifier javaScriptMinifier)
 {
     _multiTenancyScriptManager  = multiTenancyScriptManager;
     _settingScriptManager       = settingScriptManager;
     _navigationScriptManager    = navigationScriptManager;
     _localizationScriptManager  = localizationScriptManager;
     _authorizationScriptManager = authorizationScriptManager;
     _featuresScriptManager      = featuresScriptManager;
     _sessionScriptManager       = sessionScriptManager;
     _timingScriptManager        = timingScriptManager;
     _securityScriptManager      = securityScriptManager;
     _javaScriptMinifier         = javaScriptMinifier;
 }
示例#7
0
 public AbpServiceProxiesController(IApiProxyScriptManager proxyScriptManager,
                                    IJavaScriptMinifier javaScriptMinifier)
 {
     _proxyScriptManager = proxyScriptManager;
     _javaScriptMinifier = javaScriptMinifier;
 }
示例#8
0
 public DefaultJavaScriptProxyGenerator(IHubManager manager, IJavaScriptMinifier javaScriptMinifier)
 {
     _manager            = manager;
     _javaScriptMinifier = javaScriptMinifier;
     _generatedTemplate  = new Lazy <string>(() => GenerateProxy(_manager, _javaScriptMinifier, includeDocComments: false));
 }
 public AbpServiceProxiesController(ScriptProxyManager scriptProxyManager,
                                    IJavaScriptMinifier javaScriptMinifier)
 {
     _scriptProxyManager = scriptProxyManager;
     _javaScriptMinifier = javaScriptMinifier;
 }
示例#10
0
 public DefaultJavaScriptProxyGenerator(IHubLocator hubLocator, IJavaScriptMinifier javascriptMinifier)
 {
     _hubLocator         = hubLocator;
     _javascriptMinifier = javascriptMinifier;
 }
 public RxJsProxyGenerator(IHubManager manager, IJavaScriptMinifier javaScriptMinifier)
 {
     _manager            = manager;
     _javaScriptMinifier = javaScriptMinifier ?? NullJavaScriptMinifier.Instance;
     _generatedTemplate  = new Lazy <string>(() => GenerateProxy(_manager, _javaScriptMinifier, includeDocComments: false));
 }
示例#12
0
 public DefaultJavaScriptProxyGenerator(IHubManager manager, IJavaScriptMinifier javaScriptMinifier)
 {
     _manager            = manager;
     _javaScriptMinifier = javaScriptMinifier ?? NullJavaScriptMinifier.Instance;
 }
示例#13
0
 private string MinifyJavaScript(List<string> files, IJavaScriptMinifier minifier)
 {
     try
     {
         var inputJavaScript = new StringBuilder();
         foreach (var file in files)
         {
             inputJavaScript.Append(ReadFile(file) + "\n");
         }
         return minifier.CompressContent(inputJavaScript.ToString());
     }
     catch (Exception e)
     {
         throw new Exception(string.Format("Error processing: {0}", e.Message), e);
     }
 }
示例#14
0
 public IJavaScriptBundleBuilder WithMinifier(IJavaScriptMinifier javaScriptMinifier)
 {
     this.javaScriptMinifier = javaScriptMinifier;
     return this;
 }
示例#15
0
 public IJavaScriptBundleBuilder WithMinifier(JavaScriptMinifiers javaScriptMinifier)
 {
     this.javaScriptMinifier = MapMinifierEnumToType(javaScriptMinifier);
     return this;
 }
示例#16
0
 public IJavaScriptBundleBuilder WithMinifier(IJavaScriptMinifier javaScriptMinifier)
 {
     this.javaScriptMinifier = javaScriptMinifier;
     return(this);
 }
示例#17
0
 public IJavaScriptBundleBuilder WithMinifier(JavaScriptMinifiers javaScriptMinifier)
 {
     this.javaScriptMinifier = MapMinifierEnumToType(javaScriptMinifier);
     return(this);
 }