public void persistModel()
        {
            String engine = "MYMEMORY";

            if (model.getEngine().Equals(TranslateSettingsModel.Engine.BING))
            {
                engine = "BING";
            }

            Win32.WritePrivateProfileString("ENGINE", "engine", engine, dataSourcePath);

            Win32.WritePrivateProfileString("MYMEMORY", "email", model.email, dataSourcePath);

            Win32.WritePrivateProfileString("BING", "ClientIDAndSecret", model.getClientCredentials().First + ";" + model.getClientCredentials().Second, dataSourcePath);

            List <string> writableStringList = new List <string>();

            foreach (Pair codeNamePair in model.getAllLanguages())
            {
                writableStringList.Add(codeNamePair.First + ":" + codeNamePair.Second);
            }

            string writableString = string.Join(";", writableStringList.ToArray());

            Win32.WritePrivateProfileString("TRANSLATE", "ALLLANGUAGES", writableString, dataSourcePath);

            string langPrefStr = model.getLanguagePreference().First + ":" + model.getLanguagePreference().Second;

            Win32.WritePrivateProfileString("TRANSLATE", "LANGUAGEPREF", langPrefStr, dataSourcePath);
        }
예제 #2
0
        internal static Pair getLanguagePreference()
        {
            Util.writeInfoLog("getting Language Preference");

            if (initLanguages())
            {
                return(trSettingsModel.getLanguagePreference());
            }

            return(new Pair("", ""));
        }