Example #1
0
        public static LfMultiText FromMultiITsString(ITsMultiString value, ILgWritingSystemFactory wsManager)
        {
            if (value == null || value.StringCount == 0)
            {
                return(null);
            }
            LfMultiText mt = new LfMultiText();

            for (int index = 0; index < value.StringCount; index++)
            {
                int       wsId;
                ITsString tss   = value.GetStringFromIndex(index, out wsId);
                string    wsStr = wsManager.GetStrFromWs(wsId);
                if (!string.IsNullOrEmpty(wsStr))
                {
                    string        valueStr = LfMerge.Core.DataConverters.ConvertLcmToMongoTsStrings.TextFromTsString(tss, wsManager);
                    LfStringField field    = LfStringField.FromString(valueStr);
                    if (field != null)
                    {
                        mt.Add(wsStr, field);
                    }
                }
                //MainClass.Logger.Warning("Adding multistring ws: {0}, str {1}", wsStr, valueStr);
            }
            return(mt);
        }
Example #2
0
        public static LfMultiText FromLcmMultiString(IMultiAccessorBase other, ILgWritingSystemFactory wsManager)
        {
            LfMultiText newInstance = new LfMultiText();

            foreach (int wsid in other.AvailableWritingSystemIds)
            {
                string        wsstr = wsManager.GetStrFromWs(wsid);
                ITsString     value = other.get_String(wsid);
                string        text  = LfMerge.Core.DataConverters.ConvertLcmToMongoTsStrings.TextFromTsString(value, wsManager);
                LfStringField field = LfStringField.FromString(text);
                if (field != null)
                {
                    newInstance.Add(wsstr, field);
                }
            }
            return(newInstance);
        }