Esempio n. 1
0
        /// <summary>
        /// Extracts the thread to posts.
        /// </summary>
        /// <param name="xmlDump">
        /// The XML dump.
        /// </param>
        /// <returns>
        /// The extract thread to posts.
        /// </returns>
        public static List <ImageInfo> ExtractThreadtoPosts(string xmlDump)
        {
            var rtnList    = new List <ImageInfo>();
            var rtnHashChk = new Hashtable();

            try
            {
                var ds = new DataSet();

                ds.ReadXml(new StringReader(xmlDump));

                foreach (var newPicPool in
                         ds.Tables["post"].Rows.Cast <DataRow>()
                         .Where(row => row["id"] != null)
                         .Select(row => new ImageInfo {
                    ImageUrl = row["id"].ToString()
                }))
                {
                    newPicPool.ImageUrl = Utility.ReplaceHexWithAscii(newPicPool.ImageUrl);

                    if (rtnHashChk.Contains(newPicPool.ImageUrl))
                    {
                        continue;
                    }

                    rtnList.Add(newPicPool);
                    rtnHashChk.Add(newPicPool.ImageUrl, "OK");
                }
            }
            catch (Exception ex)
            {
                Utility.SaveOnCrash(xmlDump, ex.StackTrace, null);
            }

            return(rtnList);
        }