private BoostEngine() { try { m_BoostSettings = BoostSettings.LoadAppSettingsFromFile(); m_CurrentAnalysisTimeFrame = m_BoostSettings.DefaultAnalysisTimeFrame; m_CurrentAnalysisDataBasis = m_BoostSettings.DefaultAnalysisDataBasis; } catch (Exception e) { throw new Exception(e.Message); } FriendChange = 0; }
public static BoostSettings LoadAppSettingsFromFile() { BoostSettings appSettings = null; try { if (File.Exists(s_FilePath)) { try { using (Stream stream = new FileStream(s_FilePath, FileMode.Open)) { XmlSerializer serializer = new XmlSerializer(typeof(BoostSettings)); appSettings = serializer.Deserialize(stream) as BoostSettings; } } catch { File.Delete(s_FilePath); appSettings = new BoostSettings(); createNewFile(); } } else { appSettings = new BoostSettings(); createNewFile(); } } catch (UnauthorizedAccessException e) { throw new Exception(e.Message); } return(appSettings); }