private static void packageGeneralFiles(DevelopmentInstallation installation, string folderPath, bool includeDatabaseUpdates)
        {
            // configuration files
            var configurationFolderPath = EwlStatics.CombinePaths(folderPath, InstallationConfiguration.ConfigurationFolderName);

            IoMethods.CopyFolder(installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath, configurationFolderPath, false);
            IoMethods.RecursivelyRemoveReadOnlyAttributeFromItem(configurationFolderPath);
            IoMethods.DeleteFolder(EwlStatics.CombinePaths(configurationFolderPath, InstallationConfiguration.InstallationConfigurationFolderName));
            IoMethods.DeleteFolder(EwlStatics.CombinePaths(configurationFolderPath, ConfigurationStatics.ProvidersFolderAndNamespaceName));
            if (!includeDatabaseUpdates)
            {
                IoMethods.DeleteFile(EwlStatics.CombinePaths(configurationFolderPath, ExistingInstallationLogic.SystemDatabaseUpdatesFileName));
            }
            IoMethods.DeleteFile(EwlStatics.CombinePaths(configurationFolderPath, InstallationConfiguration.SystemDevelopmentConfigurationFileName));
            IoMethods.DeleteFolder(EwlStatics.CombinePaths(configurationFolderPath, ".hg"));                          // EWL uses a nested repository for configuration.
            IoMethods.DeleteFile(EwlStatics.CombinePaths(configurationFolderPath, "Update All Dependent Logic.bat")); // EWL has this file.

            // other files
            var filesFolderInInstallationPath = EwlStatics.CombinePaths(
                InstallationFileStatics.GetGeneralFilesFolderPath(installation.GeneralLogic.Path, true),
                InstallationFileStatics.FilesFolderName);

            if (Directory.Exists(filesFolderInInstallationPath))
            {
                IoMethods.CopyFolder(filesFolderInInstallationPath, EwlStatics.CombinePaths(folderPath, InstallationFileStatics.FilesFolderName), false);
            }
        }
示例#2
0
        private void copyInWebProjectFiles(Installation installation, WebProject webProject)
        {
            var webProjectFilesFolderPath = StandardLibraryMethods.CombinePaths(AppTools.InstallationPath, AppStatics.WebProjectFilesFolderName);
            var webProjectPath            = StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, webProject.name);

            // Copy Ewf folder and customize namespaces in .aspx, .ascx, .master, and .cs files.
            var webProjectEwfFolderPath = StandardLibraryMethods.CombinePaths(webProjectPath, StaticFileHandler.EwfFolderName);

            IoMethods.DeleteFolder(webProjectEwfFolderPath);
            IoMethods.CopyFolder(StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, StaticFileHandler.EwfFolderName), webProjectEwfFolderPath, false);
            IoMethods.RecursivelyRemoveReadOnlyAttributeFromItem(webProjectEwfFolderPath);
            var matchingFiles = new List <string>();

            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.aspx", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.ascx", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.master", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.cs", SearchOption.AllDirectories));
            foreach (var filePath in matchingFiles)
            {
                File.WriteAllText(filePath, customizeNamespace(File.ReadAllText(filePath), webProject));
            }

            IoMethods.CopyFile(
                StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, AppStatics.StandardLibraryFilesFileName),
                StandardLibraryMethods.CombinePaths(webProjectPath, AppStatics.StandardLibraryFilesFileName));
            IoMethods.RecursivelyRemoveReadOnlyAttributeFromItem(StandardLibraryMethods.CombinePaths(webProjectPath, AppStatics.StandardLibraryFilesFileName));
        }
示例#3
0
        private void copyInWebProjectFiles(Installation installation, WebProject webProject)
        {
            var webProjectFilesFolderPath = EwlStatics.CombinePaths(ConfigurationStatics.InstallationPath, AppStatics.WebProjectFilesFolderName);
            var webProjectPath            = EwlStatics.CombinePaths(installation.GeneralLogic.Path, webProject.name);

            // Copy Ewf folder and customize namespaces in .aspx, .ascx, .master, and .cs files.
            var webProjectEwfFolderPath = EwlStatics.CombinePaths(webProjectPath, StaticFileHandler.EwfFolderName);

            IoMethods.DeleteFolder(webProjectEwfFolderPath);
            IoMethods.CopyFolder(EwlStatics.CombinePaths(webProjectFilesFolderPath, StaticFileHandler.EwfFolderName), webProjectEwfFolderPath, false);
            IoMethods.RecursivelyRemoveReadOnlyAttributeFromItem(webProjectEwfFolderPath);
            var matchingFiles = new List <string>();

            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.aspx", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.ascx", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.master", SearchOption.AllDirectories));
            matchingFiles.AddRange(Directory.GetFiles(webProjectEwfFolderPath, "*.cs", SearchOption.AllDirectories));
            foreach (var filePath in matchingFiles)
            {
                File.WriteAllText(filePath, customizeNamespace(File.ReadAllText(filePath), webProject));
            }

            IoMethods.CopyFile(
                EwlStatics.CombinePaths(webProjectFilesFolderPath, AppStatics.StandardLibraryFilesFileName),
                EwlStatics.CombinePaths(webProjectPath, AppStatics.StandardLibraryFilesFileName));
            IoMethods.RecursivelyRemoveReadOnlyAttributeFromItem(EwlStatics.CombinePaths(webProjectPath, AppStatics.StandardLibraryFilesFileName));

            // Add the Import element to the project file if it's not already present.
            var projectDocument = new XmlDocument {
                PreserveWhitespace = true
            };
            var projectDocumentPath = EwlStatics.CombinePaths(webProjectPath, "{0}.csproj".FormatWith(webProject.name));

            projectDocument.Load(projectDocumentPath);
            var          projectElement          = projectDocument["Project"];
            const string webProjectFilesFileName = "Standard Library Files.xml";
            var          namespaceManager        = new XmlNamespaceManager(projectDocument.NameTable);
            const string ns = "http://schemas.microsoft.com/developer/msbuild/2003";

            namespaceManager.AddNamespace("p", ns);
            if (projectElement.SelectSingleNode("p:Import[ @Project = \"{0}\" ]".FormatWith(webProjectFilesFileName), namespaceManager) == null)
            {
                var importElement = projectDocument.CreateElement("Import", ns);
                importElement.SetAttribute("Project", webProjectFilesFileName);
                projectElement.AppendChild(importElement);
                projectDocument.Save(projectDocumentPath);
            }
        }