コード例 #1
0
        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");
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public PublishSettingsModel(string filePath)
 {
     _settings = new PublishSettings(filePath);
 }
コード例 #6
0
        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;
        }