* commandline:

* DiscImageChef.Settings/Settings.cs:
	  Corrected a share violation when the preferences file exists
	  but it's not ours.
This commit is contained in:
2017-05-14 22:09:21 +01:00
parent 5be233268b
commit 5f0bea2e48
2 changed files with 22 additions and 3 deletions

View File

@@ -1,3 +1,8 @@
2017-05-14 Natalia Portillo <claunia@claunia.com>
* Settings.cs: Corrected a share violation when the
preferences file exists but it's not ours.
2016-09-05 Natalia Portillo <claunia@claunia.com>
* Settings.cs: Added filters.

View File

@@ -167,6 +167,9 @@ namespace DiscImageChef.Settings
reportsPath = null;
}
FileStream prefsFs = null;
StreamReader prefsSr = null;
try
{
switch(ptID)
@@ -183,7 +186,9 @@ namespace DiscImageChef.Settings
SaveSettings();
}
NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(new FileInfo(preferencesFilePath));
prefsFs = new FileStream(preferencesFilePath, FileMode.Open, FileAccess.Read);
NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(prefsFs);
if(parsedPreferences != null)
{
NSObject obj;
@@ -288,13 +293,18 @@ namespace DiscImageChef.Settings
}
else
Current.Stats.VerifyStats = false;
}
}
else
Current.Stats = null;
prefsFs.Close();
}
else
{
prefsFs.Close();
SetDefaultSettings();
SaveSettings();
}
@@ -357,14 +367,18 @@ namespace DiscImageChef.Settings
}
XmlSerializer xs = new XmlSerializer(Current.GetType());
StreamReader sr = new StreamReader(settingsPath);
Current = (DicSettings)xs.Deserialize(sr);
prefsSr = new StreamReader(settingsPath);
Current = (DicSettings)xs.Deserialize(prefsSr);
}
break;
}
}
catch
{
if(prefsFs != null)
prefsFs.Close();
if(prefsSr != null)
prefsSr.Close();
SetDefaultSettings();
SaveSettings();
}