public void AttachDirectory(MessagerModel messager,string folderPath)
 {
     if (messager == null)
         return;
     DirectoryInfo info = new DirectoryInfo(folderPath);
     Attachment attachment = new Attachment();
     attachment.Name = info.Name;
     attachment.Time = info.LastWriteTime;
     attachment.IsDirectory = true;
     attachment.FullPath = info.FullName;
     if (!messager.Attachments.Contains(attachment))
         messager.Attachments.Add(attachment);
 }
 public void AttachFile(MessagerModel messager, string file)
 {
     if (messager == null)
         return;
     FileInfo info = new FileInfo(file);
     Attachment attachment = new Attachment();
     attachment.Name = info.Name;
     attachment.Size = info.Length;
     attachment.Time = info.LastWriteTime;
     attachment.IsFile = true;
     attachment.FullPath = info.FullName;
     if (!messager.Attachments.Contains(attachment))
         messager.Attachments.Add(attachment);
 }