My NPC Adder !

01/12/2011 14:49 Ian*#16
private void button1_Click(object sender, EventArgs e)
{
string text = this.textBox3.Text;
string str2 = this.textBox1.Text;
string str3 = this.textBox5.Text;
string str4 = this.textBox2.Text;
string str5 = this.textBox4.Text;
new FileStream(@"C:\\OldCODB\NPCs.txt", FileMode.Append, FileAccess.Write).Close();
StreamReader reader = new StreamReader(@"C:\\OldCoDB\NPCs.txt");
string str6 = reader.ReadToEnd();
reader.Close();
StreamWriter writer = new StreamWriter(@"C:\\OldCODB\NPCs.txt");
writer.Write(str6);
writer.WriteLine(text + " " + str3 + " 2 66 " + str2 + " " + str4 + " " + str5);
writer.Close();
}

theres his code.

make ur own.

_|_
01/12/2011 15:04 Iron~Man#17
Quote:
Originally Posted by Ian* View Post
private void button1_Click(object sender, EventArgs e)
{
string text = this.textBox3.Text;
string str2 = this.textBox1.Text;
string str3 = this.textBox5.Text;
string str4 = this.textBox2.Text;
string str5 = this.textBox4.Text;
new FileStream(@"C:\\OldCODB\NPCs.txt", FileMode.Append, FileAccess.Write).Close();
StreamReader reader = new StreamReader(@"C:\\OldCoDB\NPCs.txt");
string str6 = reader.ReadToEnd();
reader.Close();
StreamWriter writer = new StreamWriter(@"C:\\OldCODB\NPCs.txt");
writer.Write(str6);
writer.WriteLine(text + " " + str3 + " 2 66 " + str2 + " " + str4 + " " + str5);
writer.Close();
}

theres his code.

make ur own.

_|_
At least he could make the path to be chosen by the users
01/12/2011 16:22 PuN|SheR#18
Quote:
Originally Posted by Iron~Man View Post
At least he could make the path to be chosen by the users
LOL , there's no need for path, OldCODB must be in C:/ so it can work... :bandit:
01/12/2011 16:29 Syst3m_W1z4rd#19
one thing.
U dont need this:
Code:
StreamReader reader = new StreamReader(@"C:\\OldCoDB\NPCs.txt");
string str6 = reader.ReadToEnd();
reader.Close();
01/12/2011 20:52 damnfuck#20
can some one tell me what i have to delete from the NPCDialog.cs to delete a createt npc again cuz my server doesnt work anymore when i added a new npc
01/13/2011 12:30 PuN|SheR#21
Quote:
Originally Posted by damnfuck View Post
can some one tell me what i have to delete from the NPCDialog.cs to delete a createt npc again cuz my server doesnt work anymore when i added a new npc
How about using this ? [Only registered and activated users can see links. Click Here To Register...]
01/13/2011 12:38 PuN|SheR#22
Quote:
Originally Posted by Syst3m_W1z4rd View Post
one thing.
U dont need this:
Code:
StreamReader reader = new StreamReader(@"C:\\OldCoDB\NPCs.txt");
string str6 = reader.ReadToEnd();
reader.Close();
I Did that,cause when i use streamwriter , it deletes all npc's in there,and writes only what i wrote, so i did streamreader reader ..
string allnpcsbefore =reader.ReadToEnd(); and then
writer.WriteLine(allnpcsbefore)
writer.Writeline(textbox.text etc.. )
01/14/2011 17:25 _DreadNought_#23
rofl.
01/14/2011 18:32 Syst3m_W1z4rd#24
Quote:
Originally Posted by PuN|SheR View Post
I Did that,cause when i use streamwriter , it deletes all npc's in there,and writes only what i wrote, so i did streamreader reader ..
string allnpcsbefore =reader.ReadToEnd(); and then
writer.WriteLine(allnpcsbefore)
writer.Writeline(textbox.text etc.. )
You could just do:
Code:
StreamWriter SW = new StreamWriter(@"C:\OldCODB\npc.txt", FileMode.Append);
01/16/2011 10:38 PuN|SheR#25
Yap, I Forgot about that :)
01/16/2011 12:20 Iron~Man#26
I Doubt you even know about that ;)
01/26/2011 00:34 PuN|SheR#27
Quote:
Originally Posted by Iron~Man View Post
I Doubt you even know about that ;)
And You're OUT !
07/20/2011 22:46 Tjix#28
Quote:
Originally Posted by PuN|SheR View Post
LOL , there's no need for path, OldCODB must be in C:/ so it can work... :bandit:
No. I have my OldCODB in my source directory, in "My documents". Lols. I don't know why everyone believes that you have to have OldCODB in c:/?