BUG-2125: Fixed OneNote export, COM interaction needs a default value for out arguments.

This commit is contained in:
Robin 2017-01-26 09:07:30 +01:00
commit 13ba150deb

View file

@ -106,10 +106,12 @@ namespace Greenshot.Interop.Office {
if(oneNoteApplication == null) { if(oneNoteApplication == null) {
return null; return null;
} }
string unfiledNotesPath; // ReSharper disable once RedundantAssignment
string unfiledNotesPath = "";
oneNoteApplication.GetSpecialLocation(specialLocation, out unfiledNotesPath); oneNoteApplication.GetSpecialLocation(specialLocation, out unfiledNotesPath);
string notebookXml; // ReSharper disable once RedundantAssignment
string notebookXml = "";
oneNoteApplication.GetHierarchy("", HierarchyScope.hsPages, out notebookXml, XMLSchema.xs2010); oneNoteApplication.GetHierarchy("", HierarchyScope.hsPages, out notebookXml, XMLSchema.xs2010);
if(!string.IsNullOrEmpty(notebookXml)) { if(!string.IsNullOrEmpty(notebookXml)) {
Log.Debug(notebookXml); Log.Debug(notebookXml);
@ -144,7 +146,8 @@ namespace Greenshot.Interop.Office {
try { try {
using (IOneNoteApplication oneNoteApplication = COMWrapper.GetOrCreateInstance<IOneNoteApplication>()) { using (IOneNoteApplication oneNoteApplication = COMWrapper.GetOrCreateInstance<IOneNoteApplication>()) {
if (oneNoteApplication != null) { if (oneNoteApplication != null) {
string notebookXml; // ReSharper disable once RedundantAssignment
string notebookXml = "";
oneNoteApplication.GetHierarchy("", HierarchyScope.hsPages, out notebookXml, XMLSchema.xs2010); oneNoteApplication.GetHierarchy("", HierarchyScope.hsPages, out notebookXml, XMLSchema.xs2010);
if (!string.IsNullOrEmpty(notebookXml)) { if (!string.IsNullOrEmpty(notebookXml)) {
Log.Debug(notebookXml); Log.Debug(notebookXml);
@ -215,7 +218,7 @@ namespace Greenshot.Interop.Office {
if(p1.IsCurrentlyViewed || p2.IsCurrentlyViewed) { if(p1.IsCurrentlyViewed || p2.IsCurrentlyViewed) {
return p2.IsCurrentlyViewed.CompareTo(p1.IsCurrentlyViewed); return p2.IsCurrentlyViewed.CompareTo(p1.IsCurrentlyViewed);
} }
return String.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal); return string.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal);
}); });
return pages; return pages;
} }