Beispiel #1
0
 internal void Deserialize(Stream str, bool lazyLoad)
 {
     Pullenti.Morph.Internal.ByteArrayWrapper wr = null;
     using (MemoryStream tmp = new MemoryStream())
     {
         Pullenti.Morph.Internal.MorphDeserializer.DeflateGzip(str, tmp);
         wr = new Pullenti.Morph.Internal.ByteArrayWrapper(tmp.ToArray());
         int pos = 0;
         int cou = wr.DeserializeInt(ref pos);
         for (; cou > 0; cou--)
         {
             int p1 = wr.DeserializeInt(ref pos);
             Pullenti.Semantic.Utils.DerivateGroup ew = new Pullenti.Semantic.Utils.DerivateGroup();
             if (lazyLoad)
             {
                 ew.LazyPos = pos;
                 pos        = p1;
             }
             else
             {
                 ew.Deserialize(wr, ref pos);
             }
             ew.Id = m_AllGroups.Count + 1;
             m_AllGroups.Add(ew);
         }
         m_Root = new ExplanTreeNode();
         m_Root.Deserialize(wr, this, lazyLoad, ref pos);
     }
     m_Buf = wr;
 }
Beispiel #2
0
        internal void Deserialize(Pullenti.Morph.Internal.ByteArrayWrapper str, DerivateDictionary dic, bool lazyLoad, ref int pos)
        {
            int        cou = str.DeserializeShort(ref pos);
            List <int> li  = (cou > 0 ? new List <int>() : null);

            for (; cou > 0; cou--)
            {
                int id = str.DeserializeInt(ref pos);
                if (id > 0 && id <= dic.m_AllGroups.Count)
                {
                    Pullenti.Semantic.Utils.DerivateGroup gr = dic.m_AllGroups[id - 1];
                    if (gr.LazyPos > 0)
                    {
                        int p0 = pos;
                        pos = gr.LazyPos;
                        gr.Deserialize(str, ref pos);
                        gr.LazyPos = 0;
                        pos        = p0;
                    }
                }
                li.Add(id);
            }
            if (li != null)
            {
                Groups = li;
            }
            cou = str.DeserializeShort(ref pos);
            if (cou == 0)
            {
                return;
            }
            for (; cou > 0; cou--)
            {
                int            ke  = str.DeserializeShort(ref pos);
                int            p1  = str.DeserializeInt(ref pos);
                ExplanTreeNode tn1 = new ExplanTreeNode();
                if (Nodes == null)
                {
                    Nodes = new Dictionary <short, ExplanTreeNode>();
                }
                short sh = (short)ke;
                if (lazyLoad)
                {
                    tn1.LazyPos = pos;
                    pos         = p1;
                }
                else
                {
                    tn1.Deserialize(str, dic, false, ref pos);
                }
                if (!Nodes.ContainsKey(sh))
                {
                    Nodes.Add(sh, tn1);
                }
            }
        }
Beispiel #3
0
 void _loadTreeNode(ExplanTreeNode tn)
 {
     lock (m_Lock)
     {
         int pos = tn.LazyPos;
         if (pos > 0)
         {
             tn.Deserialize(m_Buf, this, true, ref pos);
         }
         tn.LazyPos = 0;
     }
 }