private void ProcessEnex(string fileName, IProgress <ImportProgress> progress)
        {
            int  imported = 0;
            long read     = 0;
            long maxSize  = (new FileInfo(fileName).Length * 3) / 4;

            Report(new ImportProgress {
                Title = "Importing Notes", MaxValue = (int)(maxSize / 1000)
            });
            Notebook    mainNotebook = context.Notebooks.First();
            CultureInfo provider     = CultureInfo.InvariantCulture;

            foreach (var note in ReadNotes(fileName))
            {
                Note newNote = new Note()
                {
                    Notebook    = mainNotebook,
                    Attachments = new List <Attachment>()
                };
                foreach (var element in ReadElements(note, "note"))
                {
                    switch (element.Name)
                    {
                    case "title":
                        newNote.Title = element.ReadElementContentAsString();
                        break;

                    case "created":
                        newNote.CreateTime = DateTime.ParseExact(element.ReadElementContentAsString(), "yyyyMMdd'T'HHmmss'Z'", provider);
                        if (newNote.UpdateTime == null)
                        {
                            newNote.UpdateTime = newNote.CreateTime;
                        }
                        break;

                    case "content":
                        newNote.NoteData = element.ReadElementContentAsString();
                        break;

                    case "updated":
                        newNote.UpdateTime = DateTime.ParseExact(element.ReadElementContentAsString(), "yyyyMMdd'T'HHmmss'Z'", provider);
                        break;

                    case "tag":
                        string tagNode = element.ReadElementContentAsString();
                        context.AddTag(newNote, tagNode);
                        break;

                    case "resource":
                        Attachment att  = new Attachment();
                        byte[]     data = null;
                        foreach (var attElement in ReadElements(element, "resource"))
                        {
                            switch (attElement.Name)
                            {
                            case "mime":
                                att.Mime = attElement.ReadElementContentAsString();
                                break;

                            case "file-name":
                                att.FileName = attElement.ReadElementContentAsString();
                                break;

                            case "source-url":
                                if (att.FileName == null)
                                {
                                    att.FileName = attElement.ReadElementContentAsString().Split('/').Last().Split('\\').Last();
                                }
                                else
                                {
                                    attElement.Read();
                                }
                                break;

                            case "data":
                                byte[] buffer    = new byte[10240];
                                int    readBytes = 0;
                                using (MemoryStream ms = new MemoryStream())
                                    using (BinaryWriter bin = new BinaryWriter(ms))
                                    {
                                        while ((readBytes = attElement.ReadElementContentAsBase64(buffer, 0, 10240)) > 0)
                                        {
                                            bin.Write(buffer, 0, readBytes);
                                            read += readBytes;
                                            Report(new ImportProgress {
                                                Progress = (int)(read / 1000)
                                            });
                                        }
                                        bin.Flush();
                                        data = ms.ToArray();
                                    }
                                break;

                            default:
                                attElement.Read();
                                break;
                            }
                        }
                        if (att.FileName == null)
                        {
                            att.FileName = newNote.Title + ExtensionHelper.GetExtension(att.Mime, "");
                        }
                        att.SetAttachmentFile(attachmentDir, data);
                        context.Attachments.Add(att);
                        newNote.Attachments.Add(att);
                        break;

                    default:
                        element.Read();
                        break;
                    }
                }
                newNote.NoteData = fixAttachments(newNote);
                newNote.Notebook.Notes.Add(newNote);
                Report(new ImportProgress {
                    Text = "" + imported++ + " notes imported\n\n" + read.ReadableFileSize() + " / " + maxSize.ReadableFileSize() + " unpacked..."
                });
            }
            Report(new ImportProgress {
                Text = "Finishing up..."
            });
        }