public void saveTranslation(string ISOCode, Dictionary <FMC_Translation.translations, List <string> > translation) { translationInformation ti = new translationInformation(); ti.twoLetterISOCode = ISOCode; ti.translation = translation; BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + Path.DirectorySeparatorChar + "Translation.fmc"); bf.Serialize(file, ti); file.Close(); }
public Dictionary <FMC_Translation.translations, List <string> > loadTranslation(FMC_Translation translationScript) { Dictionary <FMC_Translation.translations, List <string> > translation = null; if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "Translation.fmc")) { translationInformation ti = new translationInformation(); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + Path.DirectorySeparatorChar + "Translation.fmc", FileMode.Open); ti = (translationInformation)bf.Deserialize(file); file.Close(); if (translationScript.Get2LetterISOCodeFromSystemLanguage() == ti.twoLetterISOCode) { translation = ti.translation; } } return(translation); }