Exemplo n.º 1
0
            private void LoadDMSGFile(FileTypes type, Languages language, ResourceBit rb)
            {
                String Path = GetFilePath(type, language);
                //int index = GetFileNumber(type, language);

                if (!String.IsNullOrEmpty(Path))
                {
                    d_msgFile en_d_msg = new d_msgFile(Path);

                    if ((en_d_msg == null) || (en_d_msg.EntryList == null) || (en_d_msg.Header == null))
                        return;

                    int Length = (int)en_d_msg.Header.EntryCount;

                    // for each entry
                    for (int i = 0; i < Length; i++)
                    {
                        if ((en_d_msg.EntryList[i] == null) ||
                            (en_d_msg.EntryList[i].data == null) ||
                            (en_d_msg.EntryList[i].data[0] == null) ||
                            (en_d_msg.EntryList[i].data[0].Length <= 0))
                            continue;

                        //if (String.IsNullOrEmpty(en_d_msg.EntryList[i].data[0]) || String.IsNullOrEmpty(en_d_msg.EntryList[i].data[0].Trim('.')))
                        //continue;

                        if (en_d_msg.EntryList[i].data[0].Length > 0)
                        {
                            // SpellNames are special case. To make them match up with FFACETools, we need to double the index.
                            String s = en_d_msg.EntryList[i].data[0];
                            if (type == FileTypes.SpellNames)
                                ResourcesCache.Add((int)((uint)(i * 2) | (uint)rb), s);
                            else
                                ResourcesCache.Add((int)((uint)i | (uint)rb), s);
                        }
                    }
                }
            }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the Key Item names into a permanent array for use by GetPhrases().
        /// </summary>
        private void LoadKeyItemInfo(int language)
        {
            // Initialize Streams
            d_msgFile en_d_msg = new d_msgFile(this._fileNumberArrayList[GetFileNumber(ffxiFileTypes.KEY, language)], this.FFXIConvert);

            if ((en_d_msg == null) || (en_d_msg.EntryList == null) || (en_d_msg.Header == null))
                return;

            int ATKeys_Items_Array_Pos = -1;
            if (_ATKeys_Items == null)
                _ATKeys_Items = new FFXIATPhrase[en_d_msg.Header.EntryCount];
            else
            {
                // Append to it
                ATKeys_Items_Array_Pos = _ATKeys_Items.Length - 1;
                Array.Resize(ref _ATKeys_Items, (int)(_ATKeys_Items.Length + en_d_msg.Header.EntryCount));
            }

            int step = SplashScreen.ComputeStep((int)en_d_msg.Header.EntryCount);
            // for each entry
            for (int i = 0; i < en_d_msg.Header.EntryCount; i++)
            {
                SplashScreen.SetStatus(String.Empty, step); // 49 * 10 = 490/10000 = 5%

                if ((en_d_msg.EntryList[i] == null) ||
                    (en_d_msg.EntryList[i].data == null) ||
                    (en_d_msg.EntryList[i].data.Length == 0))
                    continue;

                int data_cnt = 0;
                // Length - 1 b/c I do NOT want to include DESCRIPTIONS... ugh, stupid German and French
                for (; data_cnt < (en_d_msg.EntryList[i].data.Length - 1); data_cnt++)
                {
                    if ((en_d_msg.EntryList[i].data[data_cnt] == null) ||
                        (en_d_msg.EntryList[i].data[data_cnt].Trim().Trim("\0\u0001.".ToCharArray()) == String.Empty) ||
                        (en_d_msg.EntryList[i].data[data_cnt].Length <= 0))
                        continue;
                    else break;
                }
                // Length - 1 b/c I do NOT want to include DESCRIPTIONS... ugh, stupid German and French
                if (data_cnt >= (en_d_msg.EntryList[i].data.Length - 1))
                    continue;

                ATKeys_Items_Array_Pos++;

                // to save memory, only create a structure for a valid Spell Info block
                _ATKeys_Items[ATKeys_Items_Array_Pos] = new FFXIATPhrase();
                _ATKeys_Items[ATKeys_Items_Array_Pos].StringResource = 0x13;
                _ATKeys_Items[ATKeys_Items_Array_Pos].Language = (byte)language;
                _ATKeys_Items[ATKeys_Items_Array_Pos].MessageID = en_d_msg.EntryList[i].MessageID;
                _ATKeys_Items[ATKeys_Items_Array_Pos].GroupID = en_d_msg.EntryList[i].GroupID;

                if (en_d_msg.EntryList[i].data.Length >= 3)
                {
                    if ((language >= ffxiLanguages.NUM_LANG_MIN) && (language <= ffxiLanguages.NUM_LANG_MAX))
                        _ATKeys_Items[ATKeys_Items_Array_Pos].value = new String(en_d_msg.EntryList[i].data[data_cnt].ToCharArray());
                }
                else _ATKeys_Items[ATKeys_Items_Array_Pos].value = "<<UNKNOWN>>";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads the Spell names into a temporary array for reference by LoadAutoTranslateFile().
        /// </summary>
        private void LoadSpellInfo(int language)
        {
            d_msgFile en_d_msg = new d_msgFile(this._fileNumberArrayList[GetFileNumber(ffxiFileTypes.SPEL, language)], this.FFXIConvert);

            if ((en_d_msg == null) || (en_d_msg.EntryList == null) || (en_d_msg.Header == null))
                return;

            // Setup Spell Info structure for program
            if (SpellInfo == null)
            {
                SpellInfo = new FFXIATPhrase[en_d_msg.Header.EntryCount];
            }
            else if (SpellInfo.Length != en_d_msg.Header.EntryCount)
            {
                Array.Resize(ref SpellInfo, (int)en_d_msg.Header.EntryCount);
            }

            int step = SplashScreen.ComputeStep(SpellInfo.Length > 0 ? SpellInfo.Length : 1);
            //StreamWriter fi = File.CreateText("Spells.txt");

            for (int i = 0; i < SpellInfo.Length; i++)
            {
                // to save memory, only create a structure for a valid Spell Info block
                SpellInfo[i] = new FFXIATPhrase();
                SplashScreen.SetStatus(String.Empty, step); // 49 * 10 = 490/10000 = 5%

                if ((en_d_msg.EntryList[i] == null) ||
                    (en_d_msg.EntryList[i].data == null) ||
                    (en_d_msg.EntryList[i].data[0] == null) ||
                    (en_d_msg.EntryList[i].data[0].Length <= 0))
                    continue;

                if (en_d_msg.EntryList[i].data[0].Length > 0)
                    SpellInfo[i].value = new String(en_d_msg.EntryList[i].data[0].ToCharArray());
                else SpellInfo[i].value = "<<UNKNOWN>>";
                SpellInfo[i].Language = (byte)language;
                //fi.WriteLine("{0} {1}", i, SpellInfo[i].value);
            }
            //fi.Close();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the Job names into a temporary array for reference by LoadAutoTranslateFile().
        /// </summary>
        private void LoadJobList(int language)
        {
            d_msgFile en_d_msg = new d_msgFile(this._fileNumberArrayList[GetFileNumber(ffxiFileTypes.JOBS, language)], this.FFXIConvert);

            if ((en_d_msg == null) || (en_d_msg.EntryList == null) || (en_d_msg.Header == null))
                return;

            if (JobList == null)
                JobList = new FFXIATPhrase[en_d_msg.Header.EntryCount];
            else if (JobList.Length != en_d_msg.Header.EntryCount)
            {
                Array.Resize(ref JobList, (int)en_d_msg.Header.EntryCount);
            }

            int step = SplashScreen.ComputeStep((int)en_d_msg.Header.EntryCount);

            // for each entry
            for (int i = 0; i < JobList.Length; i++)
            {
                SplashScreen.SetStatus(String.Empty, step); // 21 * 10 = 210/10000 = 2.5%
                JobList[i] = new FFXIATPhrase();
                if ((en_d_msg.EntryList[i] == null) ||
                    (en_d_msg.EntryList[i].data == null) ||
                    (en_d_msg.EntryList[i].data[0] == null) ||
                    (en_d_msg.EntryList[i].data[0].Length <= 0))
                    continue;

                // to save memory, only create a structure for a valid Spell Info block
                if (en_d_msg.EntryList[i].data[0].Length > 0)
                    JobList[i].value = new String(en_d_msg.EntryList[i].data[0].ToCharArray());
                else JobList[i].value = "<<UNKNOWN>>";
                JobList[i].Language = (byte)language;
            }
        }