Wanting to.... [Read On]
ok guys get ready for this.
i am wanting to read a file for specific words line by line when that keyword is found print a byte to another file for example search for "lol1" in nay.txt, then write byte 0x02 to nay.dat, this i have achieved what i know want to do is keep looking through the file and for every "lol1" print a new byte to nay.dat.
Here is my current code for this part of the program:
There are alot of comments and stuff that isnt needed, this is here as i have been testing multiple things, anyway i hope some one can help,
i have been trying for hours but i just cant think of a solution...
cheers in advance.
i am wanting to read a file for specific words line by line when that keyword is found print a byte to another file for example search for "lol1" in nay.txt, then write byte 0x02 to nay.dat, this i have achieved what i know want to do is keep looking through the file and for every "lol1" print a new byte to nay.dat.
Here is my current code for this part of the program:
Code:
String line;
byte[] data = System****.File.ReadAllBytes("" + global + "/" + "TROPTRNS.dat"); // put real name
BinaryWriter BW = new BinaryWriter(File.OpenWrite("" + global + "/" + "TROPTRNS.dat"));
int counter = 0;
string tt = "T";
string TextLine = "";
System****.StreamReader Test = new System****.StreamReader("" + global + "/" + "TROPCONF.sfm");
TextLine = Test.ReadLine();
do
{
TextLine = Test.ReadLine();
if (TextLine.Contains("Bronze"))
{
listBox1.Items.Add("Bronze");
}
else if (TextLine.Contains("Silver"))
{
listBox1.Items.Add("Silver");
}
else if (TextLine.Contains("Gold"))
{
listBox1.Items.Add("Gold");
}
} while (Test.Peek() != -1); // while ((line = Test.ReadLine()) != null); //Test.Peek() != -1
//listBox1.Items.Add(TextLine);
for (int i = 0x377; i <= 0x377; i++)
{
while (i < data.Length)
{
BW.BaseStream.Position = i;
if (TextLine.Contains("ttype=\"B\" "))
{
BW.Write(0x10000004);
//i += 176;
}
else if (TextLine.Contains("ttype=\"S\" ")) // .Contains
{
BW.Write(0x88888888);
//i += 176;
}
else if (TextLine.Contains("ttype=\"G\" "))
{
BW.Write(0x99999999);
//i += 176;
}
i += 176;
//Test.ReadLine() +1;
}
}
Test.Close();
BW.Close();
i have been trying for hours but i just cant think of a solution...
cheers in advance.

