GetFile() public method

public GetFile ( string sRemoteFile, string sLocalFile ) : void
sRemoteFile string
sLocalFile string
return void
Example #1
0
        public void GrabAttachments(string folderName, WordPressSite wpSite)
        {
            int iPost = this.PostID;

            List <WordPressPost> lstA = (from a in wpSite.Content
                                         where a.PostType == WordPressPost.WPPostType.Attachment &&
                                         a.ParentPostID == iPost
                                         select a).Distinct().ToList();

            lstA.ToList().ForEach(q => q.ImportFileSlug = folderName + "/" + q.ImportFileSlug);
            lstA.ToList().ForEach(q => q.ImportFileSlug = q.ImportFileSlug.Replace("//", "/").Replace("//", "/"));

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                foreach (var img in lstA)
                {
                    img.ImportFileSlug = img.ImportFileSlug.Replace("//", "/").Replace("//", "/");

                    cmsHelper.GetFile(img.AttachmentURL, img.ImportFileSlug);
                    string sURL1    = img.AttachmentURL.Substring(img.AttachmentURL.IndexOf("://") + 3);
                    string sURLLess = sURL1.Substring(sURL1.IndexOf("/"));

                    this.PostContent = this.PostContent.Replace(img.AttachmentURL, img.ImportFileSlug);
                }
            }
        }
Example #2
0
        public void GrabAttachments(string folderName, WordPressSite wpSite)
        {
            int iPost = this.PostID;

            List<WordPressPost> lstA = (from a in wpSite.Content
                                        where a.PostType == WordPressPost.WPPostType.Attachment
                                        && a.ParentPostID == iPost
                                        select a).Distinct().ToList();

            lstA.ToList().ForEach(q => q.ImportFileSlug = folderName + "/" + q.ImportFileSlug);
            lstA.ToList().ForEach(q => q.ImportFileSlug = q.ImportFileSlug.Replace("//", "/").Replace("//", "/"));

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                foreach (var img in lstA) {
                    img.ImportFileSlug = img.ImportFileSlug.Replace("//", "/").Replace("//", "/");

                    cmsHelper.GetFile(img.AttachmentURL, img.ImportFileSlug);
                    string sURL1 = img.AttachmentURL.Substring(img.AttachmentURL.IndexOf("://") + 3);
                    string sURLLess = sURL1.Substring(sURL1.IndexOf("/"));

                    this.PostContent = this.PostContent.Replace(img.AttachmentURL, img.ImportFileSlug);
                }
            }
        }