Example #1
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

            //save value types --------------------------------------
            binWrt.Write(iId);
            binWrt.Write(iFrom);
            if (sFrom == null)
            {
                binWrt.Write(false);
            }
            else
            {
                binWrt.Write(true);
                binWrt.Write(sFrom);
            }
            binWrt.Write(sTo);
            binWrt.Write(sSignature);

            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
            }
        }
Example #2
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

            //save value types --------------------------------------

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
            }

            //save list items ---------------------------------------
            int iCount = this.Count;

            binWrt.Write(iCount);
            foreach (KeyValuePair <string, LemmaRule> kvp in this)
            {
                binWrt.Write(kvp.Key);
                kvp.Value.Serialize(binWrt, false);
            }

            //default rule is already saved in the list. Here just save its id.
            binWrt.Write(lrDefaultRule.Signature);
        }
Example #3
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

            //save value types --------------------------------------
            binWrt.Write(sWord);
            binWrt.Write(sLemma);
            binWrt.Write(sSignature);
            if (sMsd == null)
            {
                binWrt.Write(false);
            }
            else
            {
                binWrt.Write(true);
                binWrt.Write(sMsd);
            }
            binWrt.Write(dWeight);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
                lrRule.Serialize(binWrt, false);
            }
        }
Example #4
0
        public void Serialize(BinaryWriter binWrt, bool bSerializeExamples, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
            }

            rlRules.Serialize(binWrt, false);

            if (!bSerializeExamples)
            {
                binWrt.Write(false); // lstExamples == null
                binWrt.Write(0);     // dictExamples.Count == 0
            }
            else
            {
                if (lstExamples == null)
                {
                    binWrt.Write(false); // lstExamples == null

                    //save dictionary items
                    int iCount = dictExamples.Count;
                    binWrt.Write(iCount);

                    foreach (KeyValuePair <string, LemmaExample> kvp in dictExamples)
                    {
                        binWrt.Write(kvp.Value.Rule.Signature);
                        kvp.Value.Serialize(binWrt, false);
                    }
                }
                else
                {
                    binWrt.Write(true); // lstExamples != null

                    //save list & dictionary items
                    int iCount = lstExamples.Count;
                    binWrt.Write(iCount);

                    foreach (LemmaExample le in lstExamples)
                    {
                        binWrt.Write(le.Rule.Signature);
                        le.Serialize(binWrt, false);
                    }
                }
            }
        }
Example #5
0
 public void Serialize(BinaryWriter binWrt, bool bSerializeExamples)
 {
     lsett.Serialize(binWrt);
     elExamples.Serialize(binWrt, bSerializeExamples, false);
     ltnRootNode.Serialize(binWrt);
 }