Beispiel #1
0
        // Serialization Functions (Latino) ------
        #if LATINO
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

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

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

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

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

            //default rule is already saved in the list. Here just save its id.
            binWrt.WriteString(lrDefaultRule.Signature);
        }
Beispiel #2
0
        // Serialization Functions (Latino) ---------------
        #if LATINO
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

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

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Save(binWrt);
                lrRule.Save(binWrt, false);
            }
        }
Beispiel #3
0
        // Serialization Functions (Latino) -----
        #if LATINO
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

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

            if (bThisTopObject)
            {
                lsett.Save(binWrt);
            }
        }
Beispiel #4
0
        // Serialization Functions (Latino) -------------------

        #if LATINO
        public void Save(Latino.BinarySerializer binWrt, bool bSerializeExamples, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

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

            rlRules.Save(binWrt, false);

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

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

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

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

                    foreach (LemmaExample le in lstExamples)
                    {
                        binWrt.WriteString(le.Rule.Signature);
                        le.Save(binWrt, false);
                    }
                }
            }
        }