public ActionResult Index(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { try { PublishSettings settings = new PublishSettings(file.InputStream); string fileName = settings.SiteName + ".publishSettings"; var path = Path.Combine(Environment.Instance.SiteReplicatorPath, fileName); file.SaveAs(path); Replicator.Instance.Repository.AddSite(path); // Trigger a deployment since we just added a new target site Replicator.Instance.TriggerDeployment(); } catch (IOException) { // todo: error handling } } return RedirectToAction("Index"); }
public Site(string profilePath) { _profilePath = profilePath; _settings = new PublishSettings(_profilePath); string rootPath = Path.GetDirectoryName(_profilePath); _sitePath = Path.Combine(rootPath, _settings.SiteName); if (!FileHelper.FileSystem.Directory.Exists(_sitePath)) { FileHelper.FileSystem.Directory.CreateDirectory(_sitePath); } }
private string SetDestBaseOptions( string publishSettingsPath, out DeploymentBaseOptions deploymentBaseOptions) { AzureSiteReplicator.Data.PublishSettings publishSettings = new AzureSiteReplicator.Data.PublishSettings(publishSettingsPath); deploymentBaseOptions = new DeploymentBaseOptions { ComputerName = publishSettings.ComputerName, UserName = publishSettings.Username, Password = publishSettings.Password, AuthenticationType = publishSettings.AuthenticationType }; if (publishSettings.AllowUntrusted) { ServicePointManager.ServerCertificateValidationCallback = AllowCertificateCallback; } deploymentBaseOptions.TraceLevel = TraceLevel.Verbose; return(publishSettings.SiteName); }
public PublishSettingsModel(string filePath) { _settings = new PublishSettings(filePath); }
private string SetDestBaseOptions( string publishSettingsPath, out DeploymentBaseOptions deploymentBaseOptions) { AzureSiteReplicator.Data.PublishSettings publishSettings = new AzureSiteReplicator.Data.PublishSettings(publishSettingsPath); deploymentBaseOptions = new DeploymentBaseOptions { ComputerName = publishSettings.ComputerName, UserName = publishSettings.Username, Password = publishSettings.Password, AuthenticationType = publishSettings.AuthenticationType }; if (publishSettings.AllowUntrusted) { ServicePointManager.ServerCertificateValidationCallback = AllowCertificateCallback; } deploymentBaseOptions.TraceLevel = TraceLevel.Verbose; return publishSettings.SiteName; }