how to get percentage
#14
hi, i have problems with reading from the file ".restore", sometimes the read are correct but sometimes are corrupt, possibly the file it's open by cat but my code do this:

public static OclRestoreData Deserialize(string fileName)
{
File.Copy(fileName, fileName + "Cp", true);
OclRestoreData rData = new OclRestoreData();

FileInfo dataFile = new FileInfo(fileName + "Cp");
FileStream stream = null;

try
{
stream = dataFile.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
}
catch (IOException)
{
//the file is unavailable because it is:
//still being written to
//or being processed by another thread
//or does not exist (has already been processed)
rData = null;
return rData;
}
finally
{
if (stream != null)
{
stream.Close();
//file is not locked
byte[] bytes = File.ReadAllBytes(fileName + "Cp");
int cursor = 0;

// Reading version_bin
rData.version_bin = BitConverter.ToUInt32(bytes, cursor);
cursor += 4;
and the rest of the reading... any idea???


Messages In This Thread
how to get percentage - by koursan - 09-17-2011, 12:03 AM
RE: how to get percentage - by atom - 09-17-2011, 09:45 AM
RE: how to get percentage - by tonygr82 - 10-04-2011, 10:25 PM
RE: how to get percentage - by atom - 10-05-2011, 09:42 AM
RE: how to get percentage - by tonygr82 - 10-05-2011, 04:37 PM
RE: how to get percentage - by tonygr82 - 10-07-2011, 06:09 AM
RE: how to get percentage - by atom - 10-07-2011, 09:36 AM
RE: how to get percentage - by tonygr82 - 10-07-2011, 05:30 PM
RE: how to get percentage - by atom - 10-07-2011, 05:49 PM
RE: how to get percentage - by tonygr82 - 10-08-2011, 05:18 PM
RE: how to get percentage - by KT819GM - 10-08-2011, 06:08 PM
RE: how to get percentage - by tonygr82 - 10-08-2011, 06:40 PM
RE: how to get percentage - by koursan - 10-09-2011, 10:41 AM
RE: how to get percentage - by tonygr82 - 10-14-2011, 07:57 AM
RE: how to get percentage - by atom - 10-14-2011, 09:38 AM
RE: how to get percentage - by atom - 10-24-2011, 12:37 PM