public static bool TryLoad(string pFile, out BaseStats pStats) { pStats = new BaseStats(); try { using (var file = File.Open(pFile, FileMode.Open)) { XmlSerializer xser = new XmlSerializer(typeof(BaseStats)); pStats = (BaseStats)xser.Deserialize(file); // Log.WriteLine(LogLevel.Info, "Job {0} loaded! Data for {1} levels.", pStats.Job.ToString(), pStats.entries.Count); } return(true); } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Exception while loading stats from job {0}: {1}", pFile, ex.ToString()); return(false); } }
public static bool TryLoad(string pFile, out BaseStats pStats) { pStats = new BaseStats(); try { using (var file = File.Open(pFile, FileMode.Open)) { XmlSerializer xser = new XmlSerializer(typeof(BaseStats)); pStats = (BaseStats)xser.Deserialize(file); // Log.WriteLine(LogLevel.Info, "Job {0} loaded! Data for {1} levels.", pStats.Job.ToString(), pStats.entries.Count); } return true; } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Exception while loading stats from job {0}: {1}", pFile, ex.ToString()); return false; } }