public static PSO2Text ReadNIFLText(BufferedStreamReader streamReader, int offset, string fileName)
        {
            var txt  = new PSO2Text();
            var nifl = streamReader.Read <AquaCommon.NIFL>();
            var end  = nifl.NOF0Offset + offset;
            var rel0 = streamReader.Read <AquaCommon.REL0>();

            streamReader.Seek(rel0.REL0DataStart + offset, SeekOrigin.Begin);

            var categoryPointer = streamReader.Read <int>();
            var categoryCount   = streamReader.Read <int>();

            //Read through categories
            streamReader.Seek(categoryPointer + offset, SeekOrigin.Begin);
            for (int i = 0; i < categoryCount; i++)
            {
                var categoryNameOffset     = streamReader.Read <int>();
                var categoryDataInfoOffset = streamReader.Read <int>();
                var subCategoryCount       = streamReader.Read <int>();

                //Setup subcategory lists
                txt.text.Add(new List <List <PSO2Text.textPair> >());
                for (int j = 0; j < subCategoryCount; j++)
                {
                    txt.text[i].Add(new List <PSO2Text.textPair>());
                }

                //Get category name
                long bookmark = streamReader.Position();
                streamReader.Seek(categoryNameOffset + offset, SeekOrigin.Begin);

                txt.categoryNames.Add(ReadCString(streamReader));

                //Get Category Info
                streamReader.Seek(categoryDataInfoOffset + offset, SeekOrigin.Begin);

                for (int sub = 0; sub < subCategoryCount; sub++)
                {
                    var categoryIndexOffset = streamReader.Read <int>();
                    var subCategoryId       = streamReader.Read <int>();
                    var categoryIndexCount  = streamReader.Read <int>();
                    var bookMarkSub         = streamReader.Position();

                    streamReader.Seek(categoryIndexOffset + offset, SeekOrigin.Begin);
                    for (int j = 0; j < categoryIndexCount; j++)
                    {
                        var  pair          = new PSO2Text.textPair();
                        int  nameLoc       = streamReader.Read <int>();
                        int  textLoc       = streamReader.Read <int>();
                        long bookmarkLocal = streamReader.Position();

                        streamReader.Seek(nameLoc + offset, SeekOrigin.Begin);
                        pair.name = ReadCString(streamReader);

                        streamReader.Seek(textLoc + offset, SeekOrigin.Begin);
                        pair.str = ReadUTF16String(streamReader, end);

                        txt.text[i][subCategoryId].Add(pair);
                        streamReader.Seek(bookmarkLocal, SeekOrigin.Begin);
                    }
                    streamReader.Seek(bookMarkSub, SeekOrigin.Begin);
                }

                streamReader.Seek(bookmark, SeekOrigin.Begin);
            }

#if DEBUG
            if (fileName != null)
            {
                StringBuilder output = new StringBuilder();

                for (int i = 0; i < txt.text.Count; i++)
                {
                    output.AppendLine(txt.categoryNames[i]);

                    for (int j = 0; j < txt.text[i].Count; j++)
                    {
                        output.AppendLine($"Group {j}");

                        for (int k = 0; k < txt.text[i][j].Count; k++)
                        {
                            var pair = txt.text[i][j][k];
                            output.AppendLine($"{pair.name} - {pair.str}");
                        }
                        output.AppendLine();
                    }
                    output.AppendLine();
                }

                File.WriteAllText(fileName + ".txt", output.ToString());
            }
#endif
            return(txt);
        }
        //Expects somewhat strict formatting, but reads this from a .text file
        public static PSO2Text ReadPSO2TextFromTxt(string filename)
        {
            var      lines = File.ReadAllLines(filename);
            PSO2Text text  = new PSO2Text();

            //We start on line 3 to avoid the metadata text
            if (lines.Length < 4)
            {
                return(null);
            }
            int mode = 0;

            for (int i = 3; i < lines.Length; i++)
            {
                switch (mode)
                {
                case 0:     //Category
                    if (lines[i] == "")
                    {
                        return(text);
                    }
                    text.categoryNames.Add(lines[i]);
                    text.text.Add(new List <List <PSO2Text.textPair> >());
                    mode = 1;
                    break;

                case 1:     //Group
                    if (lines[i] == "")
                    {
                        mode = 0;
                    }
                    else if (lines[i].Contains("Group"))
                    {
                        text.text[text.text.Count - 1].Add(new List <PSO2Text.textPair>());
                        mode = 2;
                    }
                    break;

                case 2:     //Text
                    if (lines[i] == "")
                    {
                        mode = 1;
                    }
                    else if (lines[i].Contains('-'))
                    {
                        PSO2Text.textPair pair = new PSO2Text.textPair();
                        string[]          line = lines[i].Split('-');

                        //Handle - being used as the name for whatever reason. Should be an uncommon issue
                        if (line[0] == "")
                        {
                            pair.name = "-";
                            lines[i]  = ReplaceFirst(lines[i], "- ", "");
                        }
                        else if (line[0][line[0].Length - 1] == ' ')
                        {
                            pair.name = line[0].Substring(0, line[0].Length - 1);     //Get rid of the space
                        }

                        string schrodingersSpace = "";
                        if (line[1][0].ToString() == " ")
                        {
                            schrodingersSpace = " ";
                        }
                        pair.str = ReplaceFirst(lines[i], line[0] + "-" + schrodingersSpace, "");     //Safely get the next part, in theory.

                        text.text[text.text.Count - 1][text.text[text.text.Count - 1].Count - 1].Add(pair);
                    }
                    break;
                }
            }

            return(text);
        }