示例#1
0
 public BPMInterpreter(string[] string_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         string   text  = string_0[i];
         string[] array = text.Split(new char[]
         {
             ' ',
             '\t',
             '='
         }, StringSplitOptions.RemoveEmptyEntries);
         int    num  = ChartParser.getNoteFromResolution(array[0]);
         int    num2 = Convert.ToInt32(array[2]);
         string a;
         if ((a = array[1]) != null)
         {
             if (!(a == "TS"))
             {
                 if (a == "B" && (this.bpmList.Count == 0 || this.bpmList[num] != num2))
                 {
                     this.bpmList.Add(num, num2);
                 }
             }
             else if (this.TSList.Count == 0 || this.TSList[num] != num2)
             {
                 this.TSList.Add(num, num2);
             }
         }
     }
     if (!this.TSList.ContainsKey(0))
     {
         this.TSList.Add(0, 4);
     }
 }
示例#2
0
 public InstrumentType(string[] string_0) : this()
 {
     if (string_0.Length != 0)
     {
         for (int i = 0; i < string_0.Length; i++)
         {
             string   text  = string_0[i];
             string[] array = text.Split(new char[]
             {
                 ' ',
                 '\t',
                 '=',
                 '"',
                 'E'
             }, StringSplitOptions.RemoveEmptyEntries);
             this.method_5(ChartParser.getNoteFromResolution(array[0]), array[1]);
         }
     }
 }
示例#3
0
 public SectionInterpreter(string[] string_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         string   text  = string_0[i];
         string[] array = text.Split(new char[]
         {
             '=',
             '"'
         }, 3, StringSplitOptions.RemoveEmptyEntries);
         if (array.Length == 3 && !(array[1].Trim() != "E"))
         {
             array[2] = array[2].TrimEnd(new char[]
             {
                 ' ',
                 '\t'
             });
             if (array[2].EndsWith("\""))
             {
                 array[2] = array[2].Substring(0, array[2].Length - 1);
             }
             int num = ChartParser.getNoteFromResolution(array[0].Trim());
             if (array[2].StartsWith("section "))
             {
                 this.sectionList.Add(num, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(array[2].Substring("section ".Length).Replace('_', ' ')));
             }
             else if (this.otherList.ContainsKey(num))
             {
                 this.otherList[num].Add(array[2]);
             }
             else
             {
                 this.otherList.Add(num, new List <string>());
                 this.otherList[num].Add(array[2]);
             }
         }
     }
 }
        public NoteEventInterpreter(string[] stringImported, int constant480)
        {
            if (!(this.alwaysTrue = (stringImported.Length == 0)))            //If string is empty
            {
                //Cycles through the string array imported (All notes/SP)
                for (int i = 0; i < stringImported.Length; i++)
                {
                    string currentString = stringImported[i];

                    /*
                     * Indexes:
                     * 0=Offset
                     * 1=Event Type
                     * 2=Note Value
                     * 3=Sustain Length
                     */
                    string[] NotesEventsArray = currentString.Split(new char[]
                    {
                        ' ',
                        '\t',
                        '='
                    }, StringSplitOptions.RemoveEmptyEntries);
                    int    offset = ChartParser.getNoteFromResolution(NotesEventsArray[0]);
                    string eventType;
                    if ((eventType = NotesEventsArray[1]) != null)
                    {
                        if (!(eventType == "N"))
                        {
                            if (!(eventType == "S"))
                            {
                                if (eventType == "E")
                                {
                                    //Interprets Events
                                    if (this.eventList.ContainsKey(offset))
                                    {
                                        this.currentEventLine = NotesEventsArray[2];
                                        for (int j = 3; j < NotesEventsArray.Length; j++)
                                        {
                                            this.currentEventLine = this.currentEventLine + " " + NotesEventsArray[j];
                                        }
                                        this.eventList[offset].Add(this.currentEventLine);
                                    }
                                    else
                                    {
                                        this.currentEventLine = NotesEventsArray[2];
                                        for (int k = 3; k < NotesEventsArray.Length; k++)
                                        {
                                            this.currentEventLine = this.currentEventLine + " " + NotesEventsArray[k];
                                        }
                                        this.eventList.Add(offset, new List <string>());
                                        this.eventList[offset].Add(this.currentEventLine);
                                    }
                                }
                            }
                            //Interprets Starpower
                            else
                            {
                                switch (Convert.ToInt32(NotesEventsArray[2]))
                                {
                                case 0:
                                    if (!this.class228_2.ContainsKey(offset))
                                    {
                                        this.class228_2.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 1:
                                    if (!this.class228_3.ContainsKey(offset))
                                    {
                                        this.class228_3.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 2:
                                    if (!this.class228_1.ContainsKey(offset))
                                    {
                                        this.class228_1.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 3:
                                    if (!this.class228_4.ContainsKey(offset))
                                    {
                                        this.class228_4.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 4:
                                    if (!this.class228_5.ContainsKey(offset))
                                    {
                                        this.class228_5.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 5:
                                    if (!this.class228_6.ContainsKey(offset))
                                    {
                                        this.class228_6.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;
                                }
                            }
                        }
                        //Interprets Notes

                        /*
                         * Indexes:
                         * 0=Offset
                         * 1=Event Type
                         * 2=Note Value
                         * 3=Sustain Length
                         */
                        else
                        {
                            bool[] notes         = new bool[32];
                            int    sustainLength = ChartParser.getNoteFromResolution(NotesEventsArray[3]);
                            if (sustainLength <= constant480 / 4)
                            {
                                sustainLength = 0;
                            }
                            if (!this.noteList.ContainsKey(offset))
                            {
                                this.noteList.Add(offset, new NotesAtOffset(notes, sustainLength));
                            }
                            else
                            {
                                int currentSustainLength = this.noteList[offset].sustainLength;
                                //Updates sustain length
                                if (currentSustainLength < sustainLength)
                                {
                                    this.noteList[offset].sustainLength = sustainLength;
                                }
                            }
                            int note = Convert.ToInt32(NotesEventsArray[2]);
                            this.noteList[offset].noteValues[note] = true;
                        }
                    }
                }
            }
        }