I haven't really looked at it, but I'm going to assume that the Win7 crash is UAC related;
The application might be getting a file permission denied error,
depending on where the user has the application extracted/ran from.
to remedy such a problem, it is wise to use the application data folder.
Code:
// C#
public static class SafeIO
{
public static System.String AppData(System.String dataFile)
{
return System.String.Format("{0}\\{1}\\{2}\\{3}",
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData),
System.Windows.Forms.Application.CompanyName,
System.Windows.Forms.Application.ProductName,
dataFile
);
}
}
//Example use:
string path = SafeIO.AppData("MyData.dat");
byte[] data = System.IO.File.ReadAllBytes(path);
on a Vista/7 system, the above would return
C:\Users\{user name}\Application Data\{company}\{product}\MyData.dat
in my case,
C:\Users\Xyphos\Application Data\Xyphos Software\TestApp\MyData.dat
...no clue how that would work in WinXP; but I'm sure you could tell me
