public static void InsertTerms(string sPathName, bool bForceUTF8) { string sModuleName = GetModuleName(sPathName); string sLang = GetLanguage(sPathName); System.Text.Encoding enc = GetEncoding(sLang); if (bForceUTF8) { enc = Encoding.UTF8; } using (StreamReader sr = new StreamReader(sPathName, enc, true)) { string sData = sr.ReadToEnd(); int nListStart = sData.IndexOf("$app_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$app_strings", sData, nListStart); } nListStart = sData.IndexOf("$app_list_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$app_list_strings", sData, nListStart); } nListStart = sData.IndexOf("$mod_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$mod_strings", sData, nListStart); } nListStart = sData.IndexOf("$mod_list_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$mod_list_strings", sData, nListStart); } } }
public static void InsertTerms(string sPathName, ZipInputStream stmZip, bool bForceUTF8) { string sModuleName = GetModuleName(sPathName); string sLang = GetLanguage(sPathName); System.Text.Encoding enc = GetEncoding(sLang); if (bForceUTF8) { enc = Encoding.UTF8; } // 01/12/2006 Paul. Don't use using as it is clsing the zip stream. StreamReader sr = new StreamReader(stmZip, enc, true); { string sData = String.Empty; try { // 01/12/2006 Paul. Problem importing it_it_3.5.1.langpack.zip, modules/OptimisticLock/language/it_it.lang.php // Specified argument was out of the range of valid values. Parameter name: length // Catch the error and allow processing of the rest of the files. sData = sr.ReadToEnd(); } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), sPathName + "; " + ex.Message); return; } int nListStart = sData.IndexOf("$app_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$app_strings", sData, nListStart); } nListStart = sData.IndexOf("$app_list_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$app_list_strings", sData, nListStart); } nListStart = sData.IndexOf("$mod_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$mod_strings", sData, nListStart); } nListStart = sData.IndexOf("$mod_list_strings"); if (nListStart >= 0) { LanguagePackImport.ParseList(sModuleName, sLang, "$mod_list_strings", sData, nListStart); } } }