Click here to Skip to main content
15,891,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ITS WINDOWS PHONE APP...
C#
FileStream fileread;
FileStream filewrite;
StreamReader scoreread;
StreamWriter scorewitte;
public void gethighscxore()
{
Boolean boolwork = true;

// create fo
fileread = new FileStream("ok.txt", FileMode.Open, FileAccess.Read);

scoreread = new StreamReader(fileread);

for (int i = 0; i < maxhscore; i++)
{
texthscore1[i] = scoreread.ReadLine();

if (texthscore1[i] == null)
{
texthscore1[i] = "0";
}
}

scoreread.Close();
fileread.Close();

if (boolwork)
{
int j = 0;

for (int i = 0; i < maxhscore; i++)
{
if (plane_.score > Convert.ToInt32(texthscore1[i]) && i == j)
{
texthscore2[i] = plane_.score.ToString();
i++;
if (i < maxhscore)
{
texthscore2[i] = texthscore1[j];
}
}
else
{
texthscore2[i] = texthscore1[j];
}
j++;
}
}
filewrite = new FileStream("ok.txt", FileMode.Create, FileAccess.Write);

scorewitte = new StreamWriter(filewrite);

for (int i = 0; i < maxhscore; i++)
{
scorewitte.WriteLine(texthscore2[i]);

}
scorewitte.Close();
filewrite.Close();
}

this is the proper code..this couch exception error,,,
System.MethodAccessException
i think ther is any problem in fileaccesing...
pls help me how can i resolve it
Posted
v3
Comments
Sergey Alexandrovich Kryukov 16-Feb-14 0:57am    
In what line?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900