CSharpSynth.Banks.InstrumentBank.loadStream C# (CSharp) Метод

loadStream() публичный Метод

public loadStream ( Stream bankStream, string directory, byte Programs, byte DrumPrograms ) : void
bankStream Stream
directory string
Programs byte
DrumPrograms byte
Результат void
        public void loadStream(Stream bankStream, string directory, byte[] Programs, byte[] DrumPrograms)
        {
            StreamReader reader = new StreamReader(bankStream);
            List<string> text = new List<string>();
            while (reader.Peek() > -1)
                text.Add(reader.ReadLine());
            reader.Close();
            bankStream.Close();
            if (text[0].Trim() != "[BankFile]")
                throw new Exception("Not a valid BankFile!");
            for (int x = 1; x < text.Count; x++)
            {//Load each instrument, banks can have mixed instruments!
                string[] split = text[x].Split(new string[] { "/" }, StringSplitOptions.None);
                switch(split[1].Trim().ToLower())
                {
                    case "analog":
                        loadAnalog(split, Programs, DrumPrograms);
                        break;
                    case "fm":
                        loadFm(split, directory, Programs, DrumPrograms);
                        break;
                    case "sfz":
                        loadSfz(split, directory, Programs, DrumPrograms);
                        break;
                }
            }
        }