Exemplo n.º 1
0
        public void should_save_to_file()
        {
            var binaryContent = Encoding.UTF8.GetBytes("My MIME part content");
            var mimePart      = new MimePart(binaryContent, _textContentFileName);
            var tempFilePath  = Path.GetTempFileName();

            var returnValue = mimePart.StoreToFile(tempFilePath);

            returnValue.ShouldEqual(returnValue);
            File.ReadAllBytes(tempFilePath).ShouldEqual(binaryContent);
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MimePart     objPart = _message.LeafMimeParts[lstAttachments.SelectedIndex + 1];
            DialogResult dres    = dlgSave.ShowDialog();

            if (dres != DialogResult.Cancel)
            {
                string saveToPath = dlgSave.FileName;
                objPart.StoreToFile(saveToPath);
                MessageBox.Show("File saved!");
            }
        }