Пример #1
0
        public void ReadMessages(Folder f)
        {
            if (f.ContentCount > 0)
            {
                using (var fs = ndb.GetReadStream())
                {
                    // Get the Contents table for the folder
                    var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                                     ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id));

                    if (ndb.IsUnicode4K)
                    {
                        foreach (var m in ms)
                        {
                            ltp.ReadProperties <Message>(fs, m.Nid, pgMessageDetail4K, m);
                        }
                    }

                    // We may be called on a background thread, so we need to dispatch this to the UI thread
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        f.Messages.Clear();
                        foreach (var m in ms)
                        {
                            f.AddMessage(m);
                        }
                    }));
                }
            }
        }
Пример #2
0
        public void ReadMessages(Folder f)
        {
            if (f.ContentCount > 0)
            {
                using (var fs = ndb.GetReadStream())
                {
                    // Get the Contents table for the folder
                    // For 4K, not all the properties we want are available in the Contents table, so supplement them from the Message itself
                    var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                                     ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id))
                             .Select(m => ndb.IsUnicode4K ? Add4KMessageProperties(fs, m) : m)
                             .ToList();    // to force complete execution on the current thread

                    // We may be called on a background thread, so we need to dispatch this to the UI thread
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        f.Messages.Clear();
                        foreach (var m in ms)
                        {
                            f.AddMessage(m);
                        }
                    }));
                }
            }
        }
Пример #3
0
        // Recurse down the folder tree, building a structure of Folder classes
        private Folder ReadFolderStructure(FileStream fs, NID nid, Folder parentFolder = null)
        {
            Folder f = new Folder {
                Nid = nid, XstFile = this, ParentFolder = parentFolder
            };

            ltp.ReadProperties <Folder>(fs, nid, pgFolder, f);

            f.Folders.AddRange(ltp.ReadTableRowIds(fs, NID.TypedNID(EnidType.HIERARCHY_TABLE, nid))
                               .Where(id => id.nidType == EnidType.NORMAL_FOLDER)
                               .Select(id => ReadFolderStructure(fs, id, f))
                               .OrderBy(sf => sf.Name)
                               .ToList());
            return(f);
        }
Пример #4
0
        // Recurse down the folder tree, building a structure of Folder classes
        private Folder ReadFolderStructure(FileStream fs, NID nid)
        {
            Folder f = new Folder {
                Nid = nid
            };

            ltp.ReadProperties <Folder>(fs, nid, pgFolder, f);

            foreach (var sf in ltp.ReadTableRowIds(fs, NID.TypedNID(EnidType.HIERARCHY_TABLE, nid))
                     .Where(id => id.nidType == EnidType.NORMAL_FOLDER)
                     .Select(id => ReadFolderStructure(fs, id))
                     .OrderBy(sf => sf.Name))
            {
                f.Folders.Add(sf);
            }

            return(f);
        }
Пример #5
0
 public List <Message> ReadMessages(Folder f)
 {
     f.Messages.Clear();
     if (f.ContentCount > 0)
     {
         using (var fs = ndb.GetReadStream())
         {
             // Get the Contents table for the folder
             // For 4K, not all the properties we want are available in the Contents table, so supplement them from the Message itself
             var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                              ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id))
                      .Select(m => ndb.IsUnicode4K ? Add4KMessageProperties(fs, m) : m)
                      .Select(m => f.AddMessage(m))
                      .ToList();    // to force complete execution on the current thread
             return(ms);
         }
     }
     return(new List <Message>());
 }