Microsoft.WindowsAzure.Commands.Utilities.CloudService.PublishContext.PublishContext C# (CSharp) Method

PublishContext() public method

public PublishContext ( ServiceSettings settings, string packagePath, string cloudConfigPath, string serviceName, string deploymentName, string rootPath ) : System
settings ServiceSettings
packagePath string
cloudConfigPath string
serviceName string
deploymentName string
rootPath string
return System
        public PublishContext(
            ServiceSettings settings,
            string packagePath,
            string cloudConfigPath,
            string serviceName,
            string deploymentName,
            string rootPath)
        {
            Validate.ValidateNullArgument(settings, Resources.InvalidServiceSettingMessage);
            Validate.ValidateStringIsNullOrEmpty(packagePath, "packagePath");
            Validate.ValidateFileFull(cloudConfigPath, Resources.ServiceConfiguration);
            Validate.ValidateStringIsNullOrEmpty(serviceName, "serviceName");
            
            this.ServiceSettings = settings;
            this.PackagePath = packagePath;
            this.CloudConfigPath = cloudConfigPath;
            this.RootPath = rootPath;
            this.ServiceName = serviceName;
            this.DeploymentName = string.IsNullOrEmpty(deploymentName) ? 
                char.ToLower(ServiceSettings.Slot[0]) + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff") 
                : deploymentName;

            if (!string.IsNullOrEmpty(settings.Subscription))
            {
                try
                {
                    ProfileClient client = new ProfileClient(new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
                    SubscriptionId =
                        client.Profile.Subscriptions.Values.Where(s => s.Name == settings.Subscription)
                            .Select(s => s.Id.ToString())
                            .First();
                }
                catch (Exception)
                {
                    throw new ArgumentException(string.Format(Resources.SubscriptionIdNotFoundMessage, settings.Subscription), "settings.Subscription");
                }
            }
            else
            {
                throw new ArgumentNullException("settings.Subscription", Resources.InvalidSubscriptionNameMessage);
            }
        }