コード例 #1
0
 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);
     }
 }
コード例 #2
0
ファイル: BaseStats.cs プロジェクト: Dextan/Estrella
 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;
     }
 }