コード例 #1
0
 /// <summary>
 /// Reads from XML file.
 /// </summary>
 /// <param name="pFileName">Name of the p file.</param>
 /// <returns></returns>
 public static ReportEx ReadFromXMLFile(string pFileName)
 {
     try
     {
         ReportEx rito = new ReportEx();
         if (File.Exists(pFileName))
         {
             using (XmlReader reader = XmlReader.Create(pFileName))
             {
                 XmlSerializer deserializer = new XmlSerializer(typeof(ReportEx));
                 rito = (ReportEx)deserializer.Deserialize(reader);
                 reader.Close();
             }
         }
         else
         {
             throw new FileNotFoundException(pFileName);
         }
         return(rito);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
コード例 #2
0
 ///<summary>
 ///
 ///</summary>
 private void LoadReportEx()
 {
     try
     {
         mReportEx                     = new ReportEx();
         mReportEx.DataEx              = DateTime.Now;
         mReportEx.Exception_Type      = Excep.GetType().ToString();
         mReportEx.Stack_Trace         = Excep.StackTrace.ToString();
         mReportEx.Source              = Excep.Source.ToString();
         mReportEx.Error_Message       = Excep.Message;
         mReportEx.ApplicationName     = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
         mReportEx.ApplicationVersione = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
         mReportEx.ImagePath           = string.Format("{0}\\{1}CrashScreenshot.png", System.IO.Path.GetTempPath(), mReportEx.ApplicationName);
     }
     catch (Exception ex)
     {
         throw new ApplicationException(" " + mClassName + "."
                                        + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
     }
 }