internal static List <Patch> LoadMetadata(string folderPath)
        {
            //rip through the textfile
            var lines = File.ReadLines(GetFullConfigFilepath(folderPath));

            byte instIndex = ARAM.defaultFirstSampleIndex; //set instIndex to the default value before even checking
            var  dupeIndex = 0;
            var  result    = new List <Patch>();

            foreach (var line in lines)
            {
                var tempLine = line;

                if (tempLine.Contains(';'))
                {
                    tempLine = tempLine.Split(';')[0].Trim(); //get rid of comments if there are any
                }

                if (tempLine.ToLower().Contains(BASE_INSTRUMENT))
                {
                    if (tempLine.Contains(OVERWRITE)) //change instIndex if "default" isn't in the textfile after all
                    {
                        instIndex = 0x00;
                    }
                    else if (!tempLine.Contains(DEFAULT))
                    {
                        var splitLine = line.Split(": ")[1];
                        instIndex = HexHelpers.HexStringToByte(splitLine);
                    }
                }

                if (LineShouldBeSkipped(line))
                {
                    continue;
                }

                var lineContents = CleanTextFileLine(tempLine);

                if (lineContents[0].Contains("0x"))
                {
                    //if the Patch filename isn't the same as the BRR filename, glitches happen
                    lineContents[0] = $"Duplicate #{dupeIndex} {lineContents[0]}";
                    dupeIndex++;
                }

                var temp = new Patch
                {
                    index      = instIndex,
                    ADSR1      = byte.Parse(lineContents[1], NumberStyles.HexNumber),
                    ADSR2      = byte.Parse(lineContents[2], NumberStyles.HexNumber),
                    Gain       = byte.Parse(lineContents[3], NumberStyles.HexNumber),
                    Multiplier = byte.Parse(lineContents[4], NumberStyles.HexNumber),
                    Sub        = byte.Parse(lineContents[5], NumberStyles.HexNumber),
                    Filename   = lineContents[0]
                };

                result.Add(temp);
                instIndex++;
            }

            return(result);
        }
        internal static Config LoadConfig(string folderPath)
        {
            byte   tempPackNum   = 0xFF;
            byte   tempBaseInst  = 0xFF;
            ushort tempBRRoffset = 0xFFFF;

            //load the first three lines of the config.txt
            var lines = File.ReadLines(GetFullConfigFilepath(folderPath)).ToList();

            for (int i = 0; i < 3; i++)
            {
                var line = lines[i].ToLower().Split(":");
                if (line[0].Contains(PACK_NUMBER))
                {
                    if (line[1].Contains(DEFAULT))
                    {
                        Program.GracefulCrash("Please specify a pack number in your config.txt!");
                    }
                    else
                    {
                        tempPackNum = HexHelpers.HexStringToByte(line[1]);
                    }
                }
                else if (line[0].Contains(BASE_INSTRUMENT))
                {
                    if (line[1].Contains(DEFAULT))
                    {
                        tempBaseInst = 0x1A;
                    }
                    else if (line[1].Contains(OVERWRITE))
                    {
                        tempBaseInst = 0x00;
                    }
                    else
                    {
                        tempBaseInst = HexHelpers.HexStringToByte(line[1]);
                    }
                }
                else if (line[0].Contains(SAMPLE_OFFSET))
                {
                    if (line[1].Contains(DEFAULT))
                    {
                        tempBRRoffset = ARAM.samplesOffset_1A;
                    }
                    else if (line[1].Contains(OVERWRITE))
                    {
                        tempBRRoffset = ARAM.samplesOffset;
                    }
                    else
                    {
                        tempBRRoffset = HexHelpers.HexStringToUInt16(line[1]);
                    }
                }
            }

            //load patches here
            var tempPatches = LoadMetadata(folderPath);

            var result = new Config(GetFolderName(folderPath), tempPackNum, tempBaseInst, tempBRRoffset, tempPatches);

            //Check that everything's there
            if (result.offsetForSampleDir == 0xFFFF)
            {
                Program.GracefulCrash("Couldn't find a value for Sample Directory Offset in config.txt!");
            }
            else if (result.offsetForBRRdump == 0xFFFF)
            {
                Program.GracefulCrash("Couldn't find a value for BRR Sample Dump Offset in config.txt!");
            }
            else if (result.offsetForInstrumentConfig == 0xFFFF)
            {
                Program.GracefulCrash("Couldn't find a value for Instrument Config Table Offset in config.txt!");
            }
            else if (result.packNumber == 0xFF)
            {
                Program.GracefulCrash("Couldn't find a value for Pack Number in config.txt!");
            }

            return(result);
        }