Major upgrade
This commit is contained in:
@@ -15,11 +15,11 @@ GOVERNMENT.
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
|
||||
namespace Raytheon.Common
|
||||
{
|
||||
@@ -85,23 +85,9 @@ namespace Raytheon.Common
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose(true);
|
||||
Dispose(true);
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
}
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -315,8 +301,6 @@ namespace Raytheon.Common
|
||||
|
||||
try
|
||||
{
|
||||
ErrorLogger.Instance().Write("ExcelReader::ReadAllRows() - for sheet " + sheetName, ErrorLogger.LogLevel.INFO);
|
||||
|
||||
if (startingRow < 1 || startingCol < 1)
|
||||
{
|
||||
throw new Exception("ExcelReader::ReadAllRows() - startingRow and startingCol inputs must be greater than 0");
|
||||
@@ -414,34 +398,20 @@ namespace Raytheon.Common
|
||||
/// <param name="disposing"></param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
if (disposing)
|
||||
{
|
||||
if (disposing)
|
||||
//close and release
|
||||
if (_excelWorkBook != null)
|
||||
{
|
||||
//close and release
|
||||
if (_excelWorkBook != null)
|
||||
{
|
||||
_excelWorkBook.Close();
|
||||
Marshal.ReleaseComObject(_excelWorkBook);
|
||||
}
|
||||
_excelWorkBook.Close();
|
||||
Marshal.ReleaseComObject(_excelWorkBook);
|
||||
}
|
||||
|
||||
//quit and release
|
||||
if (_excelApp != null)
|
||||
{
|
||||
_excelApp.Quit();
|
||||
Marshal.ReleaseComObject(_excelApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
try
|
||||
//quit and release
|
||||
if (_excelApp != null)
|
||||
{
|
||||
ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Do not rethrow. Exception from error logger that has already been garbage collected
|
||||
_excelApp.Quit();
|
||||
Marshal.ReleaseComObject(_excelApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user