I'm doing an application that will read a file and parse all the script name that this file execute. I want to be able to stuck each script name in different variable so once the program is done reading the first file he can go read the second file that would be stock in my first dynamic variable. Since i'm reading a file line by line when i find a script name to execute i display it in a richtextbox but how can i also add it to a dynamic variable.
Example First file executed contains:
blablabla
@Exec=test.sqi
blablabla
@Exec=test2.sqi
At the end of my file reading i want to be able to have variable like those: ScriptName1 = test.sqi ScriptName2 = test2.sqi
while ((Line = file.ReadLine()) != null)
{
if (Line.Contains(FirstString))
{
int Pos1 = Line.IndexOf(FirstString) + FirstString.Length;
int Pos2 = Line.IndexOf(LastString);
FinalString = Line.Substring(Pos1, Pos2 - Pos1);
FinalStringTrimed = FinalString.Trim('(',')');
Extension = FinalStringTrimed.Substring(0,3);
Extension = "." + Extension ;
FileName = FinalStringTrimed.Substring(4, FinalStringTrimed.Length - 4);
FullFileName = FileName + Extension;
richTextBoxProcess.AppendText(FullFileName);
richTextBoxProcess.AppendText(Environment.NewLine);
MessageBox.Show(FullFileName);
}
counter++;
}
file.Close();
}
Thank for the help!