/// <summary>
		/// Loads the language pack for a language.
		/// </summary>
		/// <param name="language">The language of the pack to load.</param>
		/// <param name="reader">The stream to read from.</param>
		/// <returns>
		/// The language pack that was loaded, or <c>null</c> if no pack exists for the language.
		/// </returns>
		public LanguagePack LoadLanguage(GameLanguage language, IReader reader)
		{
			if (_languageGlobals == null)
				return null;

			var data = _languageGlobals.Languages[(int)language];
			var table = data.LoadStrings(reader);
			var pack = new LanguagePack(language);
			foreach (var group in _groupsByTag.Values)
				pack.AddStringList(CreateList(group, (int)language, table));
			return pack;
		}
		/// <summary>
		/// Saves the language pack for a language.
		/// </summary>
		/// <param name="pack">The pack to save.</param>
		/// <param name="stream">The stream to write to.</param>
		public void SaveLanguage(LanguagePack pack, IStream stream)
		{
			// Null out all of the language's string lists
			var languageIndex = (int)pack.Language;
			ResetLanguage(languageIndex);

			// Merge lists from the pack
			var currentIndex = 0;
			foreach (var stringList in pack.StringLists)
				currentIndex += MergeStringList(stringList, languageIndex, currentIndex);

			// Rebuild the table and save
			var strings = pack.StringLists.SelectMany(l => l.Strings).ToList();
			_languageGlobals.Languages[languageIndex].SaveStrings(strings, stream);
			SaveGroups(stream);
		}
Exemplo n.º 3
0
 /// <summary>
 /// Saves the language pack for a language.
 /// </summary>
 /// <param name="pack">The pack to save.</param>
 /// <param name="stream">The stream to write to.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 public void SaveLanguage(LanguagePack pack, IStream stream)
 {
 }
Exemplo n.º 4
0
		/// <summary>
		/// Saves the language pack for a language.
		/// </summary>
		/// <param name="pack">The pack to save.</param>
		/// <param name="stream">The stream to write to.</param>
		public void SaveLanguage(LanguagePack pack, IStream stream)
		{
			_cachedPacks[pack.Language] = pack;
			_baseLoader.SaveLanguage(pack, stream);
		}
Exemplo n.º 5
0
		/// <summary>
		///     Loads everything.
		/// </summary>
		private void LoadAll()
		{
			using (IReader reader = _streamManager.OpenRead())
				_currentPack = _cache.Languages.LoadLanguage(_currentLanguage, reader);

			LoadStrings();
			LoadGroups();

			Dispatcher.Invoke(new Action(delegate { lvLocales.DataContext = _stringView; }));
		}
Exemplo n.º 6
0
 /// <summary>
 /// Saves the language pack for a language.
 /// </summary>
 /// <param name="pack">The pack to save.</param>
 /// <param name="stream">The stream to write to.</param>
 public void SaveLanguage(LanguagePack pack, IStream stream)
 {
     _cachedPacks[pack.Language] = pack;
     _baseLoader.SaveLanguage(pack, stream);
 }