public AttachmentMangerForm(IFeatureClass featurecls, int id) : this() { fc = featurecls; fid = id; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.StartPosition = FormStartPosition.CenterParent; this.dataGridView1.ColumnCount = 4; this.dataGridView1.Columns[0].Name = "attcName"; this.dataGridView1.Columns[0].HeaderText = "附件"; this.dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; this.dataGridView1.Columns[0].Visible = true; this.dataGridView1.Columns[1].Name = "attcExt"; this.dataGridView1.Columns[1].Visible = false; this.dataGridView1.Columns[2].Name = "attcId"; this.dataGridView1.Columns[2].Visible = false; this.dataGridView1.Columns[3].Name = "attcPath"; this.dataGridView1.Columns[3].Visible = false; attcMgr = fc.GetAttachmentManager(); IAttachmentCollection attclist = attcMgr.GetAttachmentsByFeatureId(id); for (int i = 0; i < attclist.Count; i++) { IAttachment attc = attclist.Get(i); string[] newRow = { attc.Name, "", attc.Id.ToString(), "" }; this.dataGridView1.Rows.Add(newRow); } }
// Token: 0x06000D03 RID: 3331 RVA: 0x0003642C File Offset: 0x0003462C private void UploadSingleFile(string fileName, IAttachmentCollection attachmentCollection, Action abortFileOperation) { abortFileOperation(); string fileName2 = Path.GetFileName(fileName); using (IOCostStream iocostStream = new IOCostStream(new FileStream(fileName, FileMode.Open))) { using (new FileSystemPerformanceTracker("MailboxUpload", iocostStream, this.logger)) { using (HashAlgorithm hashAlgorithm = new SHA1CryptoServiceProvider()) { using (IStreamAttachment streamAttachment = (IStreamAttachment)attachmentCollection.CreateIAttachment(AttachmentType.Stream)) { using (new StorePerformanceTracker("MailboxUpload", this.logger)) { CopyStreamResult arg; using (IOCostStream iocostStream2 = new IOCostStream(streamAttachment.GetContentStream())) { arg = MailboxFileStore.streamCopier.CopyStream(iocostStream, iocostStream2, hashAlgorithm, abortFileOperation); iocostStream2.Flush(); } streamAttachment[AttachmentSchema.DisplayName] = fileName2; streamAttachment[AttachmentSchema.AttachLongFileName] = fileName2; streamAttachment[AttachmentSchema.AttachHash] = hashAlgorithm.Hash; streamAttachment.Save(); this.tracer.TraceDebug <string, CopyStreamResult>((long)this.GetHashCode(), "Uploaded file '{0}' to mailbox. {1}", fileName, arg); } } } } } }
partial void Attachments_SetCondition(ref IRevision instance, ref IAttachmentCollection setValue);