/// <summary>
 /// コンストラクタです。
 /// </summary>
 public MhtDownloader(string url)
 {
     this.init();
     MimePart mo = new MimePart(url);
     this.AddMimeObject(mo);
     this.AddMimeObjects(mo.ParseHtml());
 }
Esempio n. 2
0
        private void AddObject(ArrayList arrayList, string url)
        {
            StringBuilder sb;
            string url2;
            string target;

            sb = new StringBuilder();
            foreach (char ch in url)
            {
                if (ch != '\r' && ch != '\n')
                {
                    sb.Append(ch);
                }
            }
            url2 = sb.ToString();
            foreach (object obj in arrayList)
            {
                //すでに登録済み
                if ((obj as MimePart).location == url2)
                {
                    return;
                }
            }

            if (this.location.StartsWith("http://"))
            {
                //HTTPから取得
                if (url2.StartsWith("http://"))
                {
                    target = url2;
                }
                else
                {
                    target = new Uri(new Uri(this.location), url2).AbsoluteUri;
                }
            }
            else if (File.Exists(new FileInfo(Path.GetDirectoryName(this.location) + "\\" + url2).FullName))
            {
                //ローカルファイルから取得
                target = new FileInfo(Path.GetDirectoryName(this.location) + "\\" + url2).FullName;
            }
            else
            {
                //取得不可能
                return;
            }

            MimePart mo = new MimePart(target);
            if (mo.data == null)
            {
                //取得できなかった場合
                return;
            }

            arrayList.Add(mo);
        }
 /*
 private ArrayList Objects
 {
     get
     {
         return this.objects;
     }
 }
 */
 protected void AddMimeObject(MimePart mimeObject)
 {
     this.objects.Add(mimeObject);
 }