コード例 #1
0
        public IExtensionData[] CalculateReferencedExtensionData(string content)
        {
            Hashtable datas = new Hashtable();

            ContentSourceManager.SmartContentPredicate predicate = new ContentSourceManager.SmartContentPredicate();
            SimpleHtmlParser p = new SimpleHtmlParser(content);

            for (Element el; null != (el = p.Next());)
            {
                if (predicate.IsMatch(el))
                {
                    BeginTag bt     = el as BeginTag;
                    Attr     idAttr = bt.GetAttribute("id");
                    if (idAttr != null) //Synchronized WP posts will strip ID attrs (bug 488143)
                    {
                        string smartContentSourceId;
                        string smartContentId;
                        string smartContentElementId = idAttr.Value;
                        ContentSourceManager.ParseContainingElementId(smartContentElementId, out smartContentSourceId, out smartContentId);
                        IExtensionData data = GetExtensionData(smartContentId);
                        if (data != null)
                        {
                            datas[smartContentId] = data;
                        }
                    }
                }
            }
            return((IExtensionData[])ArrayHelper.CollectionToArray(datas.Values, typeof(IExtensionData)));
        }
コード例 #2
0
        /// <summary>
        /// List the files in the specified directory.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public override string[] ListFiles(string path)
        {
            path = CombinePath(m_path, path);
            if (!path.EndsWith("/", StringComparison.OrdinalIgnoreCase))
            {
                path += "/";
            }
            ArrayList dirList = new ArrayList();

            //note: some FTP servers have problems listing directories with spaces in them,
            //so we need to change the directory and then do a simple listing instead
            if (pushDirectory(path))
            {
                try
                {
                    Win32_Find_Data[] findData = WinInet.FtpFind(m_hFtp, "*.*");
                    for (int i = 0; i < findData.Length; i++)
                    {
                        if ((findData[i].dwFileAttributes & (int)FileAttributes.Directory) == 0)
                        {
                            dirList.Add(findData[i].cFileName);
                        }
                    }
                }
                finally
                {
                    popDirectory();
                }
            }
            return((string[])ArrayHelper.CollectionToArray(dirList, typeof(string)));
        }