private static void DeployWhere(string where, string websiteTargetPath) { bool deploy = Convert.ToBoolean(where); if (deploy) { Directory.CreateDirectory(websiteTargetPath + "\\where"); FileManagement.CopyFile(".\\Where - Edit This One\\index.html", websiteTargetPath + "\\where\\index.html", true); } }
private static void RestoreConfigs(string websiteTargetPath, string serviceTargetPath, string crmServiceTargetPath, string configBackupPath) { Display.Header("Restoring configs"); Display.Output("Copy Client\\web.config"); FileManagement.CopyFile(configBackupPath + "\\Client\\web.config", websiteTargetPath + "\\web.config", true); Display.Output("Copy Service\\web.config"); FileManagement.CopyFile(configBackupPath + "\\Service\\web.config", serviceTargetPath + "\\web.config", true); Display.Output("Copy SMART_CRM_Webservice\\web.config"); FileManagement.CopyFile(configBackupPath + "\\SMART_CRM_Webservice\\web.config", crmServiceTargetPath + "\\web.config", true); Display.Output("Copy authorizationManager.xml"); FileManagement.CopyFile(configBackupPath + "\\authorizationManager.xml", websiteTargetPath + "\\App_Data\\authorizationManager.xml", true); }
public static void Backup(List <string> configs) { string websiteTargetPath = ListParser.Get("WEBSITE-TARGET-PATH=", configs); string serviceTargetPath = ListParser.Get("SERVICE-TARGET-PATH=", configs); string crmServiceTargetPath = ListParser.Get("CRM-SERVICE-TARGET-PATH=", configs); string configBackupPath = ListParser.Get("CONFIG-BACKUP-PATH=", configs); string sevenZip = ListParser.Get("ZIP=", configs); Display.Header("Backing up configs"); CreateConfigBackupFolders(configBackupPath); if (File.Exists(websiteTargetPath + "\\ClientBin\\OrderDetails.xap")) { Display.Output("Extract ServiceReferences.ClientConfig"); FileManagement.RenameFile(websiteTargetPath + "\\ClientBin\\OrderDetails.xap", websiteTargetPath + "\\ClientBin\\OrderDetails.zip"); File.Delete(websiteTargetPath + "\\ClientBin\\ServiceReferences.ClientConfig"); Execute.Command(sevenZip, "e -y " + websiteTargetPath + "\\ClientBin\\OrderDetails.zip ServiceReferences.ClientConfig"); Display.Output("Copy ServiceReferences.ClientConfig"); Directory.CreateDirectory(configBackupPath); FileManagement.CopyFile("ServiceReferences.ClientConfig", configBackupPath + "\\Client\\ServiceReferences.ClientConfig", true); File.Delete("ServiceReferences.ClientConfig"); } else { Display.Error("ERROR ServiceReferences.ClientConfig was NOT backed up.", false); Display.Error("You will have to check that the xap files have the correct configs.", false); Display.Error("If you are installing to empty folders (no previous install) this is normal", false); Display.Error("and you will probably need to create the correct configs manually."); } if (File.Exists(websiteTargetPath + "\\web.config")) { Display.Output("Copy Client\\web.config"); FileManagement.CopyFile(websiteTargetPath + "\\web.config", configBackupPath + "\\Client\\web.config", true); } else { Display.Error(websiteTargetPath + "\\web.config may need to be manually installed.", false); } if (File.Exists(serviceTargetPath + "\\web.config")) { Display.Output("Copy Service\\web.config"); FileManagement.CopyFile(serviceTargetPath + "\\web.config", configBackupPath + "\\Service\\web.config", true); } else { Display.Error(serviceTargetPath + "\\web.config may need to be manually installed.", false); } if (File.Exists(crmServiceTargetPath + "\\web.config")) { Display.Output("Copy SMART_CRM_Webservice\\web.config"); FileManagement.CopyFile(crmServiceTargetPath + "\\web.config", configBackupPath + "\\SMART_CRM_Webservice\\web.config", true); } else { Display.Error(crmServiceTargetPath + "\\web.config may need to be manually installed.", false); } if (File.Exists(websiteTargetPath + "\\App_Data\\authorizationManager.xml")) { Display.Output("Copy authorizationManager.xml"); FileManagement.CopyFile(websiteTargetPath + "\\App_Data\\authorizationManager.xml", configBackupPath + "\\authorizationManager.xml", true); } else { Display.Error(websiteTargetPath + "\\App_Data\\authorizationManager.xml may need to be manually installed.", false); } }