示例#1
0
 /// <summary>
 /// Registers the localization files.
 /// </summary>
 /// <param name="lanuage">The language code.</param>
 /// <param name="pathPrefix">The path prefix to be applied to all paths.</param>
 /// <param name="virtualPathFormats">The virtual path formats.</param>
 public void RegisterLocalization(string lanuage, String pathPrefix, params string[] virtualPathFormats)
 {
     foreach (var vpath in virtualPathFormats)
     {
         package.AddLocalization(lanuage, package.SearchServer(DextopUtil.CombinePaths(pathPrefix, String.Format(vpath, lanuage)), ".js", false));
     }
 }
示例#2
0
        /// <summary>
        /// Registers the files the specified path prefix.
        /// </summary>
        /// <param name="pathPrefix">The path prefix to be applied to all paths.</param>
        /// <param name="virtualPaths">The virtual path list.</param>
        public void Register(String pathPrefix, params string[] virtualPaths)
        {
            if (virtualPaths == null || virtualPaths.Length == 0)
            {
                virtualPaths = new[] { pathPrefix };
                pathPrefix   = "";
            }

            if (External)
            {
                package.AddFiles(virtualPaths.Select(vpath => DextopUtil.CombinePaths(pathPrefix, vpath)));
            }
            else
            {
                if (package.Module.Application.PreprocessingEnabled && !package.Module.Application.PreprocessorMode && Concate)
                {
                    return;
                }

                foreach (var vpath in virtualPaths)
                {
                    package.AddFiles(package.SearchServer(DextopUtil.CombinePaths(pathPrefix, vpath), ".js", true));
                }
            }
        }
示例#3
0
        /// <summary>
        /// Register standard assembly preprocessors such as remoting, model, grid and forms preprocessors.
        /// </summary>
        /// <param name="generatedFilesPath"></param>
        /// <param name="preprocessors"></param>
        protected void RegisterStandardAssemblyPreprocessors(string generatedFilesPath, Dictionary <string, IDextopAssemblyPreprocessor> preprocessors)
        {
            preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "remote.js"), new DextopRemotingPreprocessor()
            {
                TypeFilter = PreprocessingTypeFilter
            });

            if (!Application.PreprocessingEnabled || Application.PreprocessorMode)
            {
                preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "model.js"), new DextopModelPreprocessor()
                {
                    TypeFilter = PreprocessingTypeFilter
                });
                preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "headers.js"), new DextopGridHeaderPreprocessor()
                {
                    TypeFilter = PreprocessingTypeFilter
                });
                preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "forms.js"), new DextopFormPreprocessor()
                {
                    TypeFilter = PreprocessingTypeFilter
                });
                preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "enums.js"), new DextopEnumPreprocessor()
                {
                    TypeFilter = PreprocessingTypeFilter
                });
            }
        }
示例#4
0
 /// <summary>
 /// Registers standard data loaders
 /// </summary>
 /// <param name="generatedFilesPath">The generated files path.</param>
 /// <param name="loaders">The loaders.</param>
 protected void RegisterStandardFileLoaders(String generatedFilesPath, Dictionary <String, IDextopFileLoader> loaders)
 {
     if (Application.PreprocessingEnabled && !Application.PreprocessorMode)
     {
         loaders.Add(DextopUtil.CombinePaths(generatedFilesPath, "constructors.config"), new DextopRemotableConstructorLoader());
     }
 }
示例#5
0
 /// <summary>
 /// Register standard assembly preprocessors such as remoting, model, grid and forms preprocessors.
 /// </summary>
 /// <param name="generatedFilesPath"></param>
 /// <param name="preprocessors"></param>
 protected void RegisterStandardAssemblyPreprocessors(string generatedFilesPath, Dictionary <string, IDextopAssemblyPreprocessor> preprocessors)
 {
     preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "remote.js"), new DextopRemotingPreprocessor());
     preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "model.js"), new DextopModelPreprocessor());
     preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "headers.js"), new DextopGridHeaderPreprocessor());
     preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "forms.js"), new DextopFormPreprocessor());
     preprocessors.Add(DextopUtil.CombinePaths(generatedFilesPath, "enums.js"), new DextopEnumPreprocessor());
 }
示例#6
0
 internal IEnumerable <string> PrefixVirtualPath(IEnumerable <string> list)
 {
     foreach (var a in list)
     {
         var colonHack = a.Replace(":/", "");
         yield return(DextopUtil.CombinePaths(VirtualPath, colonHack));
     }
 }
示例#7
0
 /// <summary>
 /// Registers the files the specified path prefix.
 /// </summary>
 /// <param name="pathPrefix">The path prefix to be applied to all paths.</param>
 /// <param name="virtualPaths">The virtual path list.</param>
 public void Register(String pathPrefix, params string[] virtualPaths)
 {
     if (virtualPaths == null || virtualPaths.Length == 0)
     {
         virtualPaths = new[] { pathPrefix };
         pathPrefix   = "";
     }
     foreach (var vpath in virtualPaths)
     {
         package.AddFiles(package.SearchServer(DextopUtil.CombinePaths(pathPrefix, vpath), ".js", true));
     }
 }
示例#8
0
 /// <summary>
 /// Registers the localization files.
 /// </summary>
 /// <param name="language">The language code.</param>
 /// <param name="pathPrefix">The path prefix to be applied to all paths.</param>
 /// <param name="virtualPathFormats">The virtual path formats.</param>
 public void RegisterLocalization(string language, String pathPrefix, params string[] virtualPathFormats)
 {
     foreach (var vpath in virtualPathFormats)
     {
         if (External)
         {
             if (vpath.EndsWith("/"))
             {
                 throw new DextopException("Folders are not allowed on external modules.");
             }
             package.AddLocalization(language, new[] { DextopUtil.CombinePaths(pathPrefix, String.Format(vpath, language)) });
         }
         else
         {
             package.AddLocalization(language, package.SearchServer(DextopUtil.CombinePaths(pathPrefix, String.Format(vpath, language)), ".js", false));
         }
     }
 }
        /// <summary>
        /// Searches the server for resource files.
        /// </summary>
        /// <param name="virtualPath">The virtual path.</param>
        /// <param name="extension">The extension.</param>
        /// <param name="throwIfNotFound">if set to <c>true</c> [throw if not found].</param>
        /// <returns></returns>
        public IList <string> SearchServer(String virtualPath, string extension, bool throwIfNotFound)
        {
            var files = new List <String>();

            if (virtualPath.EndsWith(extension, StringComparison.InvariantCultureIgnoreCase))
            {
                var fpath = Module.MapPath(virtualPath);
                if (File.Exists(fpath))
                {
                    files.Add(virtualPath);
                }
                else if (throwIfNotFound)
                {
                    throw new InvalidDextopPackagePathException(DextopUtil.CombinePaths(Module.VirtualPath, virtualPath));
                }
            }
            else if (virtualPath.EndsWith("/"))
            {
                bool recursive = virtualPath.EndsWith("/*/") || virtualPath.EndsWith("//");
                if (recursive)
                {
                    virtualPath = virtualPath.TrimEnd('/', '*');
                }
                String location = Module.MapPath(virtualPath);
                var    list     = Directory.GetFiles(location, "*" + extension, recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
                foreach (var f in list)
                {
                    var p = DextopUtil.CombinePaths(virtualPath, f.Substring(location.Length).Replace('\\', '/'));
                    files.Add(p);
                }
            }
            else
            {
                throw new InvalidDextopPackagePathException(DextopUtil.CombinePaths(Module.VirtualPath, virtualPath));
            }
            return(files);
        }
示例#10
0
 internal IEnumerable <string> PrefixVirtualPath(IEnumerable <string> list)
 {
     return(list.Select(a => DextopUtil.CombinePaths(VirtualPath, a)));
 }