Click here to Skip to main content
16,005,241 members
Home / Discussions / C#
   

C#

 
AnswerRe: Install !!? Pin
Vitaliy Tsvayer20-Aug-06 3:32
Vitaliy Tsvayer20-Aug-06 3:32 
GeneralRe: Install !!? Pin
thunderbirdje20-Aug-06 10:54
thunderbirdje20-Aug-06 10:54 
AnswerRe: Install !!? Pin
Nader Elshehabi20-Aug-06 4:50
Nader Elshehabi20-Aug-06 4:50 
GeneralRe: Install !!? Pin
Anthony Mushrow20-Aug-06 10:59
professionalAnthony Mushrow20-Aug-06 10:59 
QuestionHaving a strange problem... Pin
Anthony Mushrow20-Aug-06 2:42
professionalAnthony Mushrow20-Aug-06 2:42 
AnswerRe: Having a strange problem... Pin
leppie20-Aug-06 3:12
leppie20-Aug-06 3:12 
GeneralRe: Having a strange problem... Pin
Anthony Mushrow20-Aug-06 11:02
professionalAnthony Mushrow20-Aug-06 11:02 
GeneralRe: Having a strange problem... [modified] Pin
Anthony Mushrow20-Aug-06 11:08
professionalAnthony Mushrow20-Aug-06 11:08 
Here is the relevant code upto the problem, and i don't wanna here nothin' about how messy the code is, or how i should use xml, cuz i don't wanna.

//Don't ask why its menu item 5
//This is the 'Open' menu item
void MenuItem5Click(object sender, System.EventArgs e)
{
this.Open();
}

//This is the button 'Load'
void Button1Click(object sender, System.EventArgs e)
{
this.Open();
}

//And this is the void they're pointing to
void Open()
{
this.treeView1.Nodes.Clear();

this.openFileDialog1.InitialDirectory = @"C:\Program Files\Datel\Action Replay Code Manager\local_codelists\";
this.openFileDialog1.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
this.openFileDialog1.Title = "AR DS Code Editor";
this.openFileDialog1.ShowDialog();
if(this.openFileDialog1.FileName.Length > 0)
{

string FileLine;
FileStream FS = File.Open(this.openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
StreamReader SR = new StreamReader(FS, true);
FileLine = SR.ReadLine();
while(FileLine != null)
{

int trim = FileLine.IndexOf("<");
FileLine = FileLine.Remove(0, trim);


switch(FileLine)
{
case("<game>"):
{
string oName = SR.ReadLine();
int indexOfStart = oName.IndexOf('>');
int indexOfEnding = oName.LastIndexOf('<');
oName = oName.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);

string oID = SR.ReadLine();
indexOfStart = oID.IndexOf('>');
indexOfEnding = oID.LastIndexOf('<');
oID = oID.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);

Cheat oNode = new Cheat();
oNode.sType = "game";
oNode.sName = oName;
oNode.sID = oID;
oNode.Text = oName;

this.treeView1.Nodes.Add(oNode);
oNode.ForeColor = Color.Red;
this.treeView1.Select();
break;
}

case("<cheat>"):
{
string oName = SR.ReadLine();
int indexOfStart = oName.IndexOf('>');
int indexOfEnding = oName.LastIndexOf('<');
oName = oName.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);

string oCode = SR.ReadLine();
indexOfStart = oCode.IndexOf('>');
indexOfEnding = oCode.LastIndexOf('<');
oCode = oCode.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);

Cheat oNode = new Cheat();
oNode.sType = "cheat";
oNode.sName = oName;
oNode.sCode = oCode;
oNode.Text = oName;

this.treeView1.SelectedNode.Nodes.Add(oNode); //This is where the error occurs for the menu item

oNode.ForeColor = Color.LimeGreen;

break;
}


-- modified at 17:08 Sunday 20th August, 2006
GeneralRe: Having a strange problem... Pin
leppie20-Aug-06 11:25
leppie20-Aug-06 11:25 
GeneralRe: Having a strange problem... Pin
Anthony Mushrow20-Aug-06 12:56
professionalAnthony Mushrow20-Aug-06 12:56 
GeneralRe: Having a strange problem... Pin
Anthony Mushrow20-Aug-06 12:59
professionalAnthony Mushrow20-Aug-06 12:59 
GeneralRe: Having a strange problem... [modified] Pin
beatles169220-Aug-06 20:09
beatles169220-Aug-06 20:09 
GeneralRe: Having a strange problem... Pin
Anthony Mushrow21-Aug-06 3:58
professionalAnthony Mushrow21-Aug-06 3:58 
GeneralRe: Having a strange problem... Pin
Anthony Mushrow21-Aug-06 5:54
professionalAnthony Mushrow21-Aug-06 5:54 
Questionhorizontal splitter Pin
balkang20-Aug-06 0:57
balkang20-Aug-06 0:57 
AnswerRe: horizontal splitter Pin
Nader Elshehabi20-Aug-06 1:13
Nader Elshehabi20-Aug-06 1:13 
GeneralRe: horizontal splitter Pin
balkang20-Aug-06 1:40
balkang20-Aug-06 1:40 
QuestionChekers game Pin
Shanak6919-Aug-06 23:01
Shanak6919-Aug-06 23:01 
AnswerRe: Chekers game Pin
Nader Elshehabi19-Aug-06 23:20
Nader Elshehabi19-Aug-06 23:20 
Questionlistview scrolling Pin
Green Fuze19-Aug-06 22:49
Green Fuze19-Aug-06 22:49 
AnswerRe: listview scrolling Pin
Nader Elshehabi19-Aug-06 23:25
Nader Elshehabi19-Aug-06 23:25 
GeneralRe: listview scrolling Pin
Green Fuze20-Aug-06 1:10
Green Fuze20-Aug-06 1:10 
QuestionOleDbCommand - Command Error Pin
Mike Jeferson19-Aug-06 22:23
Mike Jeferson19-Aug-06 22:23 
AnswerRe: OleDbCommand &amp;amp;quot;Command Error&amp;amp;quot; Pin
beatles169219-Aug-06 23:00
beatles169219-Aug-06 23:00 
GeneralRe: OleDbCommand &amp;amp;amp;quot;Command Error&amp;amp;amp;quot; [modified] Pin
Mike Jeferson19-Aug-06 23:17
Mike Jeferson19-Aug-06 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.