ReadDictionary() public method

Assume that the entire file is a collection of key/value pairs.
public ReadDictionary ( ) : string>.Dictionary
return string>.Dictionary
        private void Start()
        {
#if !UNITY_METRO
            // Check for overridden localization data.
            var localizationFilePath = Application.persistentDataPath + "/Localization.txt";
            FileInfo localizationFile = new FileInfo(localizationFilePath);

            if (localizationFile.Exists)
            {
                Debug.Log("Found localization file at " + localizationFilePath);

                using (var fileStream = localizationFile.OpenRead())
                {
                    using (var binaryReader = new BinaryReader(fileStream))
                    {
                        var bytes = binaryReader.ReadBytes((int)localizationFile.Length);
                        var nguiByteReader = new ByteReader(bytes);
                        var localizationData = nguiByteReader.ReadDictionary();
                        Localization.Set("TestLanguage", localizationData);
                        return;
                    }
                }
            }
#endif

            // Get current system language.
            SystemLanguage systemLanguage = Application.systemLanguage;
            Debug.Log(string.Format("System Language: {0}", systemLanguage));

            // Check if available, otherwise fallback to English.
            TextAsset textAsset = Resources.Load(systemLanguage.ToString(), typeof(TextAsset)) as TextAsset;
            if (textAsset == null)
            {
                systemLanguage = SystemLanguage.English;
                Debug.Log(string.Format("Using fallback language: {0}", systemLanguage));
            }

            Localization.language = systemLanguage.ToString();
        }
	/// <summary>
	/// Load the specified asset and activate the localization.
	/// </summary>

	static public void Load (TextAsset asset)
	{
		ByteReader reader = new ByteReader(asset);
		Set(asset.name, reader.ReadDictionary());
	}
Example #3
0
 /// <summary>
 /// Load the specified asset and activate the localization.
 /// </summary>
 void Load(TextAsset asset)
 {
     mLanguage = asset.name;
     PlayerPrefs.SetString("Language", mLanguage);
     ByteReader reader = new ByteReader(asset);
     mDictionary = reader.ReadDictionary();
     UIRoot.Broadcast("OnLocalize", this);
 }
Example #4
0
	/// <summary>
	/// Set the localization data directly.
	/// </summary>

	static public void Set (string languageName, byte[] bytes)
	{
		ByteReader reader = new ByteReader(bytes);
		Set(languageName, reader.ReadDictionary());
	}
    /// <summary>
    /// Set the localization data directly.
    /// </summary>

    static public void Set(string languageName, byte[] bytes)
    {
        ByteReader reader = new ByteReader(bytes);

        Set(languageName, reader.ReadDictionary());
    }
    static public void Load(TextAsset asset)
    {
        ByteReader reader = new ByteReader(asset);

        Set(asset.name, reader.ReadDictionary());
    }
Example #7
0
    public static void Load(TextAsset asset)
    {
        ByteReader byteReader = new ByteReader(asset);

        Localization.Set(asset.name, byteReader.ReadDictionary());
    }
Example #8
0
    public static void Set(string languageName, byte[] bytes)
    {
        ByteReader byteReader = new ByteReader(bytes);

        Localization.Set(languageName, byteReader.ReadDictionary());
    }
Example #9
0
	/// <summary>
	/// Load the specified asset and activate the localization.
	/// </summary>

	public void Load (TextAsset asset)
	{
		ByteReader reader = new ByteReader(asset);
		Set(asset.name, reader.ReadDictionary());
		OnLocalizationChanged();
	}
Example #10
0
        public static void Set(String languageName, Byte[] bytes)
        {
            ByteReader byteReader = new ByteReader(bytes);

            Provider.Set(languageName, byteReader.ReadDictionary());
        }
Example #11
0
 public static void Set(string languageName, byte[] bytes)
 {
     ByteReader byteReader = new ByteReader(bytes);
     Localization.Set(languageName, byteReader.ReadDictionary());
 }
Example #12
0
 public static void Load(TextAsset asset)
 {
     ByteReader byteReader = new ByteReader(asset);
     Localization.Set(asset.name, byteReader.ReadDictionary());
 }
Example #13
0
 static public void Load(byte[] asset)
 {
     mDictionary.Clear();
     ByteReader reader = new ByteReader(asset);
     mDictionary = reader.ReadDictionary();
 }
Example #14
0
 private MusicPathManager()
 {
     TextAsset musicPath = Resources.Load("audioSources/MusicPath") as TextAsset;
     ByteReader reader = new ByteReader(musicPath);
     mDictionary = reader.ReadDictionary();
 }
Example #15
0
    void Load(TextAsset asset)
    {
        ByteReader reader = new ByteReader(asset);

        DPalabras = reader.ReadDictionary();
    }