public void Add(MailPackage package, Stream data) { using (FileStream fs = File.OpenWrite(string.Format("package.{0:MMddyyyyHHmmssfffff}.txt", DateTime.Now))) { DataContractSerializer ds = new DataContractSerializer(typeof(MailPackage)); ds.WriteObject(fs, package); } }
public void Add(MailPackage package, Stream data) { //first add the stream to the repository string uniqueId = string.Format("{0}.{1:MMddyyyyHHmmssfffff}", package.ReferenceId, package.Received); _StreamRepository.Add(data, uniqueId); //send the rest of the message details to msmq Message msg = new Message(); msg.Formatter = _Formatter; msg.Body = package; _MQ.Send(msg); }