상속: MimePart
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            MetaDataData[] metadata = mm.GetEventMetaData(eventId);
            for(int i = 0; i < metadata.Length; i++)
            {
                MetaDataData meta = metadata[i];
                if (meta.Payload.GetType().Name == "Document")
                {
                    Document doc = (Document)meta.Payload;
                    if (doc.Location.StartsWith("http://dockets.sandiego.gov/sirepub"))
                    {
                        using (CustomWebClient webclient = new CustomWebClient())
                        {
                            byte[] data = webclient.DownloadData(doc.Location);

                            string url = string.Format("http://granicus.sandiego.gov/panes/EditEventMetaData.php?root_type=event&root_id={0}&meta_id={1}", eventId,meta.ID);
                            webclient.Headers.Add("Cookie", mm.CookieContainer.GetCookieHeader(new Uri(url)));

                            MultipartHelper helper = new MultipartHelper();
                            NameValueCollection props = new NameValueCollection();
                            props.Add("form_panel1_submit", "Save Changes");
                            props.Add("form_panel1_payload1", meta.Name);
                            props.Add("form_panel1_payload2", "");
                            helper.Add(new NameValuePart(props));
                            MemoryStream stream = new MemoryStream(data);
                            FilePart pdf = new FilePart(stream, "form_panel1_file", "application/pdf");
                            pdf.FileName = "fromsire.pdf";
                            helper.Add(pdf);

                            helper.Upload(webclient, url, "POST");
                        }
                    }
                }
                worker.ReportProgress((Int32) (((Double)(i + 1) / (Double)metadata.Length) * 100));
            }
            worker.ReportProgress(100);
        }
 public void Add(FilePart part)
 {
     this.files.Add(part);
 }