[C#] Read File, and sort lines

Newbie Spellweaver
Joined
Mar 31, 2007
Messages
75
Reaction score
1
Alright I've got a file saved as me.xbot which has lines such as:
Code:
(0:0) Actions
(1:0) Timers
(2:0) Triggers
(3:0) Who Detection

The 0's will be different numbers depending on the function they choose in its in-program editor but As it stands right now I have no clue how to do it. I've done the following but its failed epically.
Code:
        public void ReadBot(String FileName)
        {
            FileStream openBot = new FileStream(FileName, FileMode.Open, FileAccess.Read);
            StreamReader readBot = new StreamReader(openBot);
            String ReadText = readBot.ReadToEnd();
            if(ReadText.Contains("(0:")){
                frmActionsEditor btAct = new frmActionsEditor();
                Int32 i = 0;
                List<string> thing = new List<string>(ReadText.Length);
                while (i <= 499)
                {
                    btAct.botActionsArray.SetValue(ReadText, i);
                    i++;
                }
            }else if(ReadText.Contains("(1:")){
                frmTimersEditor btTmr = new frmTimersEditor();
                Int32 i = 0;
                while (i <= 499)
                {
                    btTmr.botTimersArray.SetValue(ReadText, i);
                    i++;
                }
            }else if(ReadText.Contains("(2:")){
                frmTriggersEditor btTrg = new frmTriggersEditor();
                Int32 i = 0;
                while (i <= 499)
                {
                    btTrg.botTriggersArray.SetValue(ReadText, i);
                    i++;
                }
            }
            else if (ReadText.Contains("(3:"))
            {
                frmWhoEditor btWho = new frmWhoEditor();
                Int32 i = 0;
                while (i <= 499)
                {
                    btWho.botWhoArray.SetValue(ReadText, i);
                    i++;
                }
            }
            else
            {
                //Bot Settings
            }
            MessageBox.Show("Worked..?");
            readBot.Close();
            openBot.Close();
        }
 
Back