public void CopyFrom(TemporaryBlogSettings sourceSettings)
        {
            // simple members
            _id = sourceSettings._id;
            _switchToWeblog = sourceSettings._switchToWeblog;
            _isNewWeblog = sourceSettings._isNewWeblog;
            _savePassword = sourceSettings._savePassword;
            _isSpacesBlog = sourceSettings._isSpacesBlog;
            _isSharePointBlog = sourceSettings._isSharePointBlog;
            _hostBlogId = sourceSettings._hostBlogId;
            _blogName = sourceSettings._blogName;
            _homePageUrl = sourceSettings._homePageUrl;
            _manifestDownloadInfo = sourceSettings._manifestDownloadInfo;
            _providerId = sourceSettings._providerId;
            _serviceName = sourceSettings._serviceName;
            _clientType = sourceSettings._clientType;
            _postApiUrl = sourceSettings._postApiUrl;
            _lastPublishFailed = sourceSettings._lastPublishFailed;
            _fileUploadSupport = sourceSettings._fileUploadSupport;
            _instrumentationOptIn = sourceSettings._instrumentationOptIn;

            if (sourceSettings._availableImageEndpoints == null)
            {
                _availableImageEndpoints = null;
            }
            else
            {
                // Good thing BlogInfo is immutable!
                _availableImageEndpoints = (BlogInfo[])sourceSettings._availableImageEndpoints.Clone();
            }

            // credentials
            BlogCredentialsHelper.Copy(sourceSettings._credentials, _credentials);

            // template files
            _templateFiles = new BlogEditingTemplateFile[sourceSettings._templateFiles.Length];
            for (int i = 0; i < sourceSettings._templateFiles.Length; i++)
            {
                BlogEditingTemplateFile sourceFile = sourceSettings._templateFiles[i];
                _templateFiles[i] = new BlogEditingTemplateFile(sourceFile.TemplateType, sourceFile.TemplateFile);
            }

            // option overrides
            if (sourceSettings._optionOverrides != null)
            {
                _optionOverrides.Clear();
                foreach (DictionaryEntry entry in sourceSettings._optionOverrides)
                    _optionOverrides.Add(entry.Key, entry.Value);
            }

            // user option overrides
            if (sourceSettings._userOptionOverrides != null)
            {
                _userOptionOverrides.Clear();
                foreach (DictionaryEntry entry in sourceSettings._userOptionOverrides)
                    _userOptionOverrides.Add(entry.Key, entry.Value);
            }

            // homepage overrides
            if (sourceSettings._homepageOptionOverrides != null)
            {
                _homepageOptionOverrides.Clear();
                foreach (DictionaryEntry entry in sourceSettings._homepageOptionOverrides)
                    _homepageOptionOverrides.Add(entry.Key, entry.Value);
            }

            // categories
            if (sourceSettings._categories != null)
            {
                _categories = new BlogPostCategory[sourceSettings._categories.Length];
                for (int i = 0; i < sourceSettings._categories.Length; i++)
                {
                    BlogPostCategory sourceCategory = sourceSettings._categories[i];
                    _categories[i] = sourceCategory.Clone() as BlogPostCategory;
                }
            }
            else
            {
                _categories = null;
            }

            if (sourceSettings._keywords != null)
            {
                _keywords = new BlogPostKeyword[sourceSettings._keywords.Length];
                for (int i = 0; i < sourceSettings._keywords.Length; i++)
                {
                    BlogPostKeyword sourceKeyword = sourceSettings._keywords[i];
                    _keywords[i] = sourceKeyword.Clone() as BlogPostKeyword;
                }
            }
            else
            {
                _keywords = null;
            }

            // authors and pages
            _authors = sourceSettings._authors.Clone() as AuthorInfo[];
            _pages = sourceSettings._pages.Clone() as PageInfo[];

            // buttons
            if (sourceSettings._buttonDescriptions != null)
            {
                _buttonDescriptions = new BlogProviderButtonDescription[sourceSettings._buttonDescriptions.Length];
                for (int i = 0; i < sourceSettings._buttonDescriptions.Length; i++)
                    _buttonDescriptions[i] = sourceSettings._buttonDescriptions[i].Clone() as BlogProviderButtonDescription;
            }
            else
            {
                _buttonDescriptions = null;
            }

            // favicon
            _favIcon = sourceSettings._favIcon;

            // images
            _image = sourceSettings._image;
            _watermarkImage = sourceSettings._watermarkImage;

            // host blogs
            _hostBlogs = new BlogInfo[sourceSettings._hostBlogs.Length];
            for (int i = 0; i < sourceSettings._hostBlogs.Length; i++)
            {
                BlogInfo sourceBlog = sourceSettings._hostBlogs[i];
                _hostBlogs[i] = new BlogInfo(sourceBlog.Id, sourceBlog.Name, sourceBlog.HomepageUrl);
            }

            // file upload settings
            _fileUploadSettings = sourceSettings._fileUploadSettings.Clone() as TemporaryFileUploadSettings;

            _pluginSettings = new SettingsPersisterHelper(new MemorySettingsPersister());
            _pluginSettings.CopyFrom(sourceSettings._pluginSettings, true, true);
        }
 private void AppendManifestDownloadInfo(WriterEditingManifestDownloadInfo manifestDownloadInfo, StringBuilder settingsContents)
 {
     if (manifestDownloadInfo != null)
     {
         settingsContents.AppendFormat(CultureInfo.InvariantCulture,
             "ManifestUrl:{0}ManifestExpires:{1}ManifestLastModified:{2}ManifestEtag:{3}",
             manifestDownloadInfo.SourceUrl,
             manifestDownloadInfo.Expires,
             manifestDownloadInfo.LastModified,
             manifestDownloadInfo.ETag);
     }
 }
 public void ClearProvider()
 {
     _providerId = String.Empty;
     _serviceName = String.Empty;
     _postApiUrl = String.Empty;
     _clientType = String.Empty;
     _hostBlogId = String.Empty;
     _manifestDownloadInfo = null;
     _optionOverrides.Clear();
     _templateFiles = new BlogEditingTemplateFile[0];
     _homepageOptionOverrides.Clear();
     _buttonDescriptions = new BlogProviderButtonDescription[0];
     _categories = new BlogPostCategory[0];
 }
        /// <summary>
        /// SetContext using a weblog account
        /// </summary>
        public void SetContext(BlogAccount blogAccount, IBlogCredentialsAccessor credentials, string blogHomepageUrl, string blogTemplateDir, WriterEditingManifestDownloadInfo manifestDownloadInfo, bool probeForManifest, string providerId, IDictionary optionOverrides, IDictionary userOptionOverrides, IDictionary homepageOptionOverrides)
        {
            // note context set
            _contextSet = true;

            // create a blog client
            _blogAccount = blogAccount;
            _credentials = credentials;
            _blogClient = BlogClientManager.CreateClient(blogAccount.ClientType, blogAccount.PostApiUrl, credentials, providerId, optionOverrides, userOptionOverrides, homepageOptionOverrides);

            // set other context that we've got
            _blogHomepageUrl = blogHomepageUrl;
            _blogTemplateDir = blogTemplateDir;
            _manifestDownloadInfo = manifestDownloadInfo;
            _probeForManifest = probeForManifest;
        }