Example #1
0
 /// <summary>
 /// Adds the default word-forming character overrides to the list of valid
 /// characters for each vernacular writing system that is using the old
 /// valid characters representation.
 /// </summary>
 private void AddDefaultWordformingOverridesIfNeeded()
 {
     foreach (IWritingSystem wsObj in Cache.ServiceLocator.WritingSystems.VernacularWritingSystems)
     {
         string validCharsSrc = wsObj.ValidChars;
         if (!ValidCharacters.IsNewValidCharsString(validCharsSrc))
         {
             ValidCharacters valChars = ValidCharacters.Load(wsObj, LoadException);
             valChars.AddDefaultWordformingCharOverrides();
             wsObj.ValidChars = valChars.XmlString;
         }
     }
     Cache.ServiceLocator.WritingSystemManager.Save();
 }
Example #2
0
        /// <summary>
        /// Adds the default word-forming character overrides to the list of valid
        /// characters for each vernacular writing system that is using the old
        /// valid characters representation.
        /// </summary>
        /// <param name="cache">The cache.</param>
        void AddDefaultWordformingOverridesIfNeeded(FdoCache cache)
        {
            ILgWritingSystemFactory lgwsf = cache.LanguageWritingSystemFactoryAccessor;

            foreach (ILgWritingSystem wsObj in cache.LangProject.VernWssRC)
            {
                IWritingSystem ws            = lgwsf.get_EngineOrNull(wsObj.Hvo);
                string         validCharsSrc = ws.ValidChars;
                if (!ValidCharacters.IsNewValidCharsString(validCharsSrc))
                {
                    LanguageDefinition langDef  = new LanguageDefinition(ws);
                    ValidCharacters    valChars = ValidCharacters.Load(langDef);
                    valChars.AddDefaultWordformingCharOverrides();

                    ws.ValidChars = langDef.ValidChars = valChars.XmlString;
                    using (new SuppressSubTasks(cache))
                    {
                        ws.SaveIfDirty(cache.DatabaseAccessor);
                    }
                    langDef.Serialize();
                }
            }
        }