Exemplo n.º 1
0
        private static void RewriteWebConfig(AutoRemovableDirectory tempFiles, ConfigReplacements replacements)
        {
            var webConfig      = tempFiles.ReadFile("Web.config");
            var configRewriter = new ConfigRewriter(new ConfigSources(new Dictionary <string, string>()));

            var rewrittenWebConfig = configRewriter.Rewrite(webConfig, replacements);

            tempFiles.WriteFile("Web.config", rewrittenWebConfig);
        }
Exemplo n.º 2
0
        private static void CopyFilesFromDir(AutoRemovableDirectory tempFiles, Uri rootUri, DirectoryInfo dir)
        {
            tempFiles.AddDirectory(ToRelativePath(rootUri, Commons.EnsureTrailingSlash(dir.FullName)));

            foreach (var file in dir.GetFiles())
            {
                var fileUri         = new Uri(file.FullName);
                var relativeFileUri = rootUri.MakeRelativeUri(fileUri);
                var relativePath    = Uri.UnescapeDataString(relativeFileUri.ToString());

                tempFiles.AddFile(relativePath, file.FullName);
            }
        }
Exemplo n.º 3
0
        public IStartedServerApp Start(ServerAppConfiguration appConfig)
        {
            var tempFiles = new AutoRemovableDirectory();
            var root      = new DirectoryInfo(sourcePath);
            var rootUri   = new Uri(Commons.EnsureTrailingSlash(sourcePath));

            CopyFilesFromDir(tempFiles, rootUri, root);

            foreach (var dir in root.GetDirectories("*.*", SearchOption.AllDirectories))
            {
                CopyFilesFromDir(tempFiles, rootUri, dir);
            }

            RewriteWebConfig(tempFiles, replacements);

            return(new DeployedServerApp(tempFiles));
        }
Exemplo n.º 4
0
 public DeployedServerApp(AutoRemovableDirectory dir)
 {
     this.directory    = dir;
     this.PhysicalPath = dir.BasePath;
 }