Exemplo n.º 1
0
        public static void ReplaceEmbeddedByPhysical <T>(
            [NotNull] this VirtualFileSetList fileSets,
            [NotNull] string physicalPath)
        {
            Check.NotNull(fileSets, nameof(fileSets));
            Check.NotNullOrWhiteSpace(physicalPath, nameof(physicalPath));

            var assembly = typeof(T).Assembly;

            for (var i = 0; i < fileSets.Count; i++)
            {
                if (fileSets[i] is EmbeddedVirtualFileSetInfo embeddedVirtualFileSet &&
                    embeddedVirtualFileSet.Assembly == assembly)
                {
                    var thisPath = physicalPath;

                    if (!embeddedVirtualFileSet.BaseFolder.IsNullOrEmpty())
                    {
                        thisPath = Path.Combine(thisPath, embeddedVirtualFileSet.BaseFolder);
                    }

                    fileSets[i] = new PhysicalVirtualFileSetInfo(new PhysicalFileProvider(thisPath), thisPath);
                }
            }
        }
        public static void AddEmbedded <T>([NotNull] this VirtualFileSetList list, [CanBeNull] string baseNamespace = null, string baseFolderInProject = null)
        {
            Check.NotNull(list, nameof(list));

            list.Add(
                new EmbeddedFileSet(
                    typeof(T).Assembly,
                    baseNamespace,
                    baseFolderInProject
                    )
                );
        }
Exemplo n.º 3
0
        public static void AddPhysical(
            [NotNull] this VirtualFileSetList list,
            [NotNull] string root,
            ExclusionFilters exclusionFilters = ExclusionFilters.Sensitive)
        {
            Check.NotNull(list, nameof(list));
            Check.NotNullOrWhiteSpace(root, nameof(root));

            var fileProvider = new PhysicalFileProvider(root, exclusionFilters);

            list.Add(new PhysicalVirtualFileSetInfo(fileProvider, root));
        }
Exemplo n.º 4
0
        public static void AddEmbedded <T>(
            [NotNull] this VirtualFileSetList list,
            [CanBeNull] string baseNamespace = null,
            [CanBeNull] string baseFolder    = null)
        {
            Check.NotNull(list, nameof(list));

            var assembly     = typeof(T).Assembly;
            var fileProvider = CreateFileProvider(
                assembly,
                baseNamespace,
                baseFolder
                );

            list.Add(new EmbeddedVirtualFileSetInfo(fileProvider, assembly, baseFolder));
        }
        public static void ReplaceEmbeddedByPhysical <T>([NotNull] this VirtualFileSetList list, [NotNull] string pyhsicalPath)
        {
            Check.NotNull(list, nameof(list));
            Check.NotNull(pyhsicalPath, nameof(pyhsicalPath));

            var assembly         = typeof(T).Assembly;
            var embeddedFileSets = list.OfType <EmbeddedFileSet>().Where(fs => fs.Assembly == assembly).ToList();

            foreach (var embeddedFileSet in embeddedFileSets)
            {
                list.Remove(embeddedFileSet);

                if (!embeddedFileSet.BaseFolderInProject.IsNullOrEmpty())
                {
                    pyhsicalPath = Path.Combine(pyhsicalPath, embeddedFileSet.BaseFolderInProject);
                }

                list.PhysicalPaths.Add(pyhsicalPath);
            }
        }