Esempio n. 1
0
        private void UpdateStringTableFromHKey(string hkey)
        {
            if (hkey == null)
            {
                return;
            }

            // HKEY = Hierarchy Key
            int dotIndex = hkey.LastIndexOf('.');

            if (dotIndex == -1)
            {
                return;
            }

            string directoryPath = hkey.Remove(dotIndex, hkey.Length - dotIndex);

            // Adds directory path to global strings
            StringKey directoryPathGlobalString = StringKey.FindCreate((long)crc.Compute(directoryPath, true));

            directoryPathGlobalString.SetValue(directoryPath, Language.English);
            directoryPathGlobalString.SetValue(directoryPath, Language.French);
            directoryPathGlobalString.SetValue(directoryPath, Language.German);
            directoryPathGlobalString.SetValue(directoryPath, Language.Italian);
            directoryPathGlobalString.SetValue(directoryPath, Language.Japanese);
            directoryPathGlobalString.SetValue(directoryPath, Language.Spanish);

            StringKey.AddString(directoryPathGlobalString); // Adds string globally

            // All 6 languages found in DLC files
            string[] localization = { "enUS", "jaJP", "deDE", "itIT", "esES", "frFR" };

            foreach (string local in localization)
            {
                string stringTablePath = directoryPath + ".stringTable@" + local;

                // Adds string table index path to global strings
                StringKey stringTablePathGlobalString = StringKey.FindCreate((long)crc.Compute(stringTablePath, true));

                stringTablePathGlobalString.SetValue(stringTablePath, Language.English);
                stringTablePathGlobalString.SetValue(stringTablePath, Language.French);
                stringTablePathGlobalString.SetValue(stringTablePath, Language.German);
                stringTablePathGlobalString.SetValue(stringTablePath, Language.Italian);
                stringTablePathGlobalString.SetValue(stringTablePath, Language.Japanese);
                stringTablePathGlobalString.SetValue(stringTablePath, Language.Spanish);

                // Adds string globally
                StringKey.AddString(stringTablePathGlobalString);
            }
        }