private static ErrorPacket GetErrorPacket(Exception ex, string licenseKey, string licenseName, string version) { ErrorPacket ePack = new ErrorPacket(); try { ePack.ApplicationName = System.Windows.Forms.Application.ProductName; } catch { } ePack.Culture = System.Globalization.CultureInfo.CurrentCulture.EnglishName; ePack.ClientIpAddress = NetworkUtils.GetCurrentIpAddress(); ePack.ExceptionMessage = ex.Message; ePack.StackTrace = ex.StackTrace; if (ex.InnerException != null) { ePack.StackTrace += "\r\n*****Inner Exception****\r\n"; ePack.StackTrace += ex.InnerException.ToString(); } ePack.ExceptionType = ex.GetType().ToString(); ePack.LicenseKey = licenseKey; ePack.LicenseName = licenseName; ePack.OSVersion = System.Environment.OSVersion.ToString(); ePack.Timestamp = System.DateTime.Now; ePack.Version = version; return ePack; }
private static void saveErrorPacket(ErrorPacket errorPacket, string fileName) { try { FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate); XmlSerializer xs = new XmlSerializer(typeof(ErrorPacket)); xs.Serialize(fs, errorPacket); fs.Close(); } catch (IOException) { throw; } }