예제 #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);
 }