Skip to content

Commit 1f39871

Browse files
committed
Temporary commit to continue working
1 parent c0d04c9 commit 1f39871

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

Rubberduck.Core/Common/ClipboardWriter.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IClipboardWriter
1717
void Flush();
1818
//void AppendInfo(ClipboardFormat xmlSpreadsheetFormat, ClipboardFormat rtfFormat, ClipboardFormat htmlFormat, ClipboardFormat csvFormat, ClipboardFormat unicodeTextFormat);
1919
void AppendInfo(ColumnInfo[] columnInfos,
20-
IEnumerable<object> results,
20+
object results,
2121
string titleFormat,
2222
bool includeXmlSpreadsheetformat = false,
2323
bool includeRtfFormat = false,
@@ -88,15 +88,33 @@ public void Flush()
8888
//public void AppendInfo(ClipboardFormat xmlSpreadsheetFormat, ClipboardFormat rtfFormat, ClipboardFormat htmlFormat, ClipboardFormat csvFormat, ClipboardFormat unicodeTextFormat)
8989
//TODO: bitFlag
9090
public void AppendInfo(ColumnInfo[] columnInfos,
91-
IEnumerable<object> results,
91+
object results,
9292
string titleFormat,
9393
bool includeXmlSpreadsheetformat = false,
9494
bool includeRtfFormat = false,
9595
bool includeHtmlFormat = false,
9696
bool includeCsvFormat = false,
9797
bool includeUnicodeFormat = false)
9898
{
99-
var resultsAsArray = results.Select(result => result.ToArray()).ToArray();
99+
//var resultsAsArray = results.Select(result => result.ToArray()).ToArray();
100+
object[][] resultsAsArray;
101+
if (results is IEnumerable<Rubberduck.Parsing.Symbols.Declaration> declarations)
102+
{
103+
resultsAsArray = declarations.Select(declaration => declaration.ToArray()).ToArray();
104+
}
105+
else if (results is System.Collections.ObjectModel.ObservableCollection<Rubberduck.Parsing.Inspections.Abstract.IInspectionResult> inspectionResults)
106+
{
107+
resultsAsArray = inspectionResults.OfType<IExportable>().Select(result => result.ToArray()).ToArray();
108+
}
109+
else if (results is System.Collections.ObjectModel.ObservableCollection<Rubberduck.UI.UnitTesting.ViewModels.TestMethodViewModel> testMethodViewModels)
110+
{
111+
resultsAsArray = testMethodViewModels.Select(test => test.ToArray()).ToArray();
112+
}
113+
else
114+
{
115+
resultsAsArray = null;
116+
}
117+
100118
var title = string.Format(titleFormat, DateTime.Now.ToString(CultureInfo.InvariantCulture));
101119

102120
if (includeXmlSpreadsheetformat)

Rubberduck.Core/UI/Inspections/InspectionResultsViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,8 @@ private void ExecuteCopyResultsCommand(object parameter)
659659
? Resources.RubberduckUI.CodeInspections_NumberOfIssuesFound_Singular
660660
: Resources.RubberduckUI.CodeInspections_NumberOfIssuesFound_Plural;
661661

662-
_clipboard.AppendInfo(ColumnInformation, Results as IEnumerable<object>, resource, true, true, true, true, true);
662+
var resultsArgument = Results as IEnumerable<object>;
663+
_clipboard.AppendInfo(ColumnInformation, resultsArgument, resource, true, true, true, true, true);
663664

664665
_clipboard.Flush();
665666
}

0 commit comments

Comments
 (0)