public WriteFile ( StoreFile file, string dataPath, StoreMode storeMode ) : bool | ||
file | StoreFile | The file in which to store the data. |
dataPath | string | |
storeMode | StoreMode | |
return | bool |
public bool WriteFile(StoreFile file, string dataPath, StoreMode storeMode)
{
if(file == null || dataPath == null) {
throw new ArgumentNullException("file");
}
if(File.Exists(dataPath)) {
try {
byte[] buffer = File.ReadAllBytes(dataPath);
SetFileData(file, buffer, storeMode);
}
catch {
file.ResetData();
return false;
}
}
return true;
}